The block of code below produces a simple linear regression model using "miles per gallon" as the response variable and "weight" (of the car) as a predictor variable. The ols method in statsmodels.formula.api submodule returns all statistics for this simple linear regression model. Click the block of code below and hit the Run button above. from statsmodels.formula.api import ols # create the simple linear regression model with mpg as the response variable and weight as the predictor variable model = ols( 'mpg - wt', data=cars_df).fit() #print the model summary print(model.summary()) OLS Regression Results ---- -- ----- =-------------- 0.745 R-squared: Adj. R-squared: F-statistic: Dep. Variable: mpg OLS Model: 0.736 Method: Least Squares Fri, 26 Nov 2021 81.88 Prob (F-statistic): Log-Likelihood: Date: 8.33e-10 Time: No. Observations: 06:16:17 -75.934 155.9 158.7 30 AIC: Df Residuals: 28 BIC: Df Model: 1 Covariance Type: nonrobust ----- ----- ---- ------ coef std err P>|t| (0.025 0.975) t Intercept 37.3323 2.014 18.534 0.000 33.206 41.458 wt -5.3511 0.591 -9.049 0.000 -6.562 -4.140 ====== ======= ====== === ====== 2.439 Durbin-Watson: Omnibus: Prob(Omnibus): Skew: Kurtosis: 2.338 0.295 2.073 Jarque-Bera (JB): Prob(JB): Cond. No. 0.625 0.355 2.689 12.9 ------ =----===--------- =----E==- ----===---==---- =----- =----====-------- =--

Functions and Change: A Modeling Approach to College Algebra (MindTap Course List)
6th Edition
ISBN:9781337111348
Author:Bruce Crauder, Benny Evans, Alan Noell
Publisher:Bruce Crauder, Benny Evans, Alan Noell
Chapter3: Straight Lines And Linear Functions
Section3.CR: Chapter Review Exercises
Problem 15CR: Life Expectancy The following table shows the average life expectancy, in years, of a child born in...
icon
Related questions
Question

i need a simple linear regression equation for miles per gallon as the response variable and weight as the predictor variable. 

The block of code below produces a simple linear regression model using "miles per gallon" as the response variable and "weight" (of the car) as a predictor
variable. The ols method in statsmodels.formula.api submodule returns all statistics for this simple linear regression model.
Click the block of code below and hit the Run button above.
In [6]:
from statsmodels.formula.api import ols
# create the simple linear regression model with mpg as the response variable and weight as the predictor variable
model =
ols('mpg
wt',
data=cars_df).fit()
#print the model summary
print(model.summary())
OLS Regression Results
==== ===
=============== ===
==== ==
Dep. Variable:
Model:
R-squared:
Adj. R-squared:
mpg
0.745
OLS
0.736
Least Squares
Fri, 26 Nov 2021
Method:
F-statistic:
81.88
Prob (F-statistic):
Log-Likelihood:
Date:
8.33e-10
Time:
06:16:17
-75.934
No. Observations:
30
AIC:
155.9
Df Residuals:
28
BIC:
158.7
Df Model:
1
Covariance Type:
nonrobust
сoef
std err
t
P>|t|
[0.025
0.975]
Intercept
37.3323
2.014
18.534
0.000
33.206
41.458
wt
-5.3511
0.591
-9.049
0.000
-6.562
-4.140
==
===
===
Omnibus:
2.439
Durbin-Watson:
2.338
Prob(Omnibus):
0.295
2.073
Jarque-Bera (JB):
Prob(JB):
Skew:
0.625
0.355
Kurtosis:
2.689
Cond. No.
12.9
======
Transcribed Image Text:The block of code below produces a simple linear regression model using "miles per gallon" as the response variable and "weight" (of the car) as a predictor variable. The ols method in statsmodels.formula.api submodule returns all statistics for this simple linear regression model. Click the block of code below and hit the Run button above. In [6]: from statsmodels.formula.api import ols # create the simple linear regression model with mpg as the response variable and weight as the predictor variable model = ols('mpg wt', data=cars_df).fit() #print the model summary print(model.summary()) OLS Regression Results ==== === =============== === ==== == Dep. Variable: Model: R-squared: Adj. R-squared: mpg 0.745 OLS 0.736 Least Squares Fri, 26 Nov 2021 Method: F-statistic: 81.88 Prob (F-statistic): Log-Likelihood: Date: 8.33e-10 Time: 06:16:17 -75.934 No. Observations: 30 AIC: 155.9 Df Residuals: 28 BIC: 158.7 Df Model: 1 Covariance Type: nonrobust сoef std err t P>|t| [0.025 0.975] Intercept 37.3323 2.014 18.534 0.000 33.206 41.458 wt -5.3511 0.591 -9.049 0.000 -6.562 -4.140 == === === Omnibus: 2.439 Durbin-Watson: 2.338 Prob(Omnibus): 0.295 2.073 Jarque-Bera (JB): Prob(JB): Skew: 0.625 0.355 Kurtosis: 2.689 Cond. No. 12.9 ======
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Similar questions
Recommended textbooks for you
Functions and Change: A Modeling Approach to Coll…
Functions and Change: A Modeling Approach to Coll…
Algebra
ISBN:
9781337111348
Author:
Bruce Crauder, Benny Evans, Alan Noell
Publisher:
Cengage Learning
College Algebra
College Algebra
Algebra
ISBN:
9781305115545
Author:
James Stewart, Lothar Redlin, Saleem Watson
Publisher:
Cengage Learning
Elementary Linear Algebra (MindTap Course List)
Elementary Linear Algebra (MindTap Course List)
Algebra
ISBN:
9781305658004
Author:
Ron Larson
Publisher:
Cengage Learning
College Algebra
College Algebra
Algebra
ISBN:
9781938168383
Author:
Jay Abramson
Publisher:
OpenStax
College Algebra
College Algebra
Algebra
ISBN:
9781337282291
Author:
Ron Larson
Publisher:
Cengage Learning
Algebra & Trigonometry with Analytic Geometry
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:
9781133382119
Author:
Swokowski
Publisher:
Cengage