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==- ----===---==---- =----- =----====-------- =--

MATLAB: An Introduction with Applications
6th Edition
ISBN:9781119256830
Author:Amos Gilat
Publisher:Amos Gilat
Chapter1: Starting With Matlab
Section: Chapter Questions
Problem 1P
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
MATLAB: An Introduction with Applications
MATLAB: An Introduction with Applications
Statistics
ISBN:
9781119256830
Author:
Amos Gilat
Publisher:
John Wiley & Sons Inc
Probability and Statistics for Engineering and th…
Probability and Statistics for Engineering and th…
Statistics
ISBN:
9781305251809
Author:
Jay L. Devore
Publisher:
Cengage Learning
Statistics for The Behavioral Sciences (MindTap C…
Statistics for The Behavioral Sciences (MindTap C…
Statistics
ISBN:
9781305504912
Author:
Frederick J Gravetter, Larry B. Wallnau
Publisher:
Cengage Learning
Elementary Statistics: Picturing the World (7th E…
Elementary Statistics: Picturing the World (7th E…
Statistics
ISBN:
9780134683416
Author:
Ron Larson, Betsy Farber
Publisher:
PEARSON
The Basic Practice of Statistics
The Basic Practice of Statistics
Statistics
ISBN:
9781319042578
Author:
David S. Moore, William I. Notz, Michael A. Fligner
Publisher:
W. H. Freeman
Introduction to the Practice of Statistics
Introduction to the Practice of Statistics
Statistics
ISBN:
9781319013387
Author:
David S. Moore, George P. McCabe, Bruce A. Craig
Publisher:
W. H. Freeman