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==- ----===---==---- =----- =----====-------- =--
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
Related questions
Question
i need a simple linear regression equation for miles per gallon as the response variable and weight as the predictor variable.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
Recommended textbooks for you
MATLAB: An Introduction with Applications
Statistics
ISBN:
9781119256830
Author:
Amos Gilat
Publisher:
John Wiley & Sons Inc
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
ISBN:
9781305504912
Author:
Frederick J Gravetter, Larry B. Wallnau
Publisher:
Cengage Learning
MATLAB: An Introduction with Applications
Statistics
ISBN:
9781119256830
Author:
Amos Gilat
Publisher:
John Wiley & Sons Inc
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
ISBN:
9781305504912
Author:
Frederick J Gravetter, Larry B. Wallnau
Publisher:
Cengage Learning
Elementary Statistics: Picturing the World (7th E…
Statistics
ISBN:
9780134683416
Author:
Ron Larson, Betsy Farber
Publisher:
PEARSON
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
Statistics
ISBN:
9781319013387
Author:
David S. Moore, George P. McCabe, Bruce A. Craig
Publisher:
W. H. Freeman