Shipping cost is the charge for transporting a product to its destination. In order data, `freight_value` represents that charge. A practical question is whether heavier or larger products tend to cost more to ship—and how much of the variation those attributes explain. section 3.4.2
To investigate, ask an AI assistant: “What is the relationship between product weight, dimensions, and shipping costs?” Then inspect and run the proposed Python workflow:
- Join order items to products by `product_id`. Calculate volume as length × height × width, and keep freight value, weight, and volume; remove rows missing those values. section 3.4.2
- Fit separate linear regressions for weight and volume, then a model using both. Plot the relationships with confidence intervals and compare prediction errors and R². section 3.4.2
Product Weight Model: MAE=6.89, MSE=156.77, RMSE=12.52, R2=0.37 Product Volume Model: MAE=7.41, MSE=163.70, RMSE=12.79, R2=0.34
The reported single-attribute results give the weight model MAE 6.89 and R² 0.37, versus volume MAE 7.41 and R² 0.34. Weight performs somewhat better here, but neither attribute explains every shipping charge. section 3.4.2
The combined model reports R² 0.399: weight and volume together account for about 40% of the observed variation in freight value. Treat that as a reason to investigate, not proof that these attributes alone determine a charge. Check the joined records, missing-value exclusions, plots, and unusually large errors before using the result for a business decision. section 3.4.2 section 4.6
