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==- ----===---==---- =----- =----====-------- =--
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...
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
Functions and Change: A Modeling Approach to Coll…
Algebra
ISBN:
9781337111348
Author:
Bruce Crauder, Benny Evans, Alan Noell
Publisher:
Cengage Learning
College Algebra
Algebra
ISBN:
9781305115545
Author:
James Stewart, Lothar Redlin, Saleem Watson
Publisher:
Cengage Learning
Elementary Linear Algebra (MindTap Course List)
Algebra
ISBN:
9781305658004
Author:
Ron Larson
Publisher:
Cengage Learning
Functions and Change: A Modeling Approach to Coll…
Algebra
ISBN:
9781337111348
Author:
Bruce Crauder, Benny Evans, Alan Noell
Publisher:
Cengage Learning
College Algebra
Algebra
ISBN:
9781305115545
Author:
James Stewart, Lothar Redlin, Saleem Watson
Publisher:
Cengage Learning
Elementary Linear Algebra (MindTap Course List)
Algebra
ISBN:
9781305658004
Author:
Ron Larson
Publisher:
Cengage Learning
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:
9781133382119
Author:
Swokowski
Publisher:
Cengage