Question: Step 5: Multiple regression model to predict miles per gallon using weight and horsepower This block of code produces a multiple regression model with miles

 Step 5: Multiple regression model to predict miles per gallon using

Step 5: Multiple regression model to predict miles per gallon using weight and horsepower This block of code produces a multiple regression model with "miles per gallon" as the response variable, and "weight" and "horsepower" as predictor variables. The ols method in statsmodels.formula.api submodule returns all statistics for this multiple regression model. Click the block of code below and hit the Run button above. In [6]: from statsmodels. formula. api import ols # create the multiple regression model with mpg as the response variable; weight and horsepower as predictor variables. model = ols('mpg ~ wtthp', data=cars_df) . fit() print (model . summary () ) OLS Regression Results :=== Dep. Variable: mpg R- squared: 0. 834 Model : OLS Adj. R-squared: 0. 822 Method: Least Squares F-statistic: 67.76 Date: Thu, 05 Aug 2021 Prob (F-statistic) : 2. 99e-11 Time : 00 : 29:21 Log-Likelihood : -69. 894 No. Observations: 30 AIC : 145.8 Of Residuals: 27 BIC : 150.0 of Model : Covariance Type : nonrobust == coef std err t P> | t] [0. 025 0.975] Intercept 37.7163 1. 668 22. 611 0. 000 34. 294 41.139 wt -3.9503 0. 643 -6. 146 0.000 -5. 269 -2. 631 hp -0. 0326 0. 009 -3.557 0. 001 -0. 051 -0. 014 Omnibus : 3.874 Durbin-Watson: 1. 266 Prob (Omnibus ) : 0. 144 Jarque-Bera (JB) : 2. 797 Skew : 0. 743 Prob (JB) : 0. 247 Kurtosis: 3.173 Cond. No. 598. Warnings : [1] Standard Errors assume that the covariance matrix of the errors is correctly specified

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!