In: Statistics and Probability
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 ~ wt+hp', data=cars_df).fit() print(model.summary())
OLS Regression Results ============================================================================== Dep. Variable: mpg R-squared: 0.825 Model: OLS Adj. R-squared: 0.813 Method: Least Squares F-statistic: 63.86 Date: Thu, 13 Feb 2020 Prob (F-statistic): 5.81e-11 Time: 23:12:29 Log-Likelihood: -70.042 No. Observations: 30 AIC: 146.1 Df Residuals: 27 BIC: 150.3 Df Model: 2 Covariance Type: nonrobust ============================================================================== coef std err t P>|t| [0.025 0.975] ------------------------------------------------------------------------------ Intercept 37.1892 1.627 22.862 0.000 33.851 40.527 wt -3.8068 0.653 -5.831 0.000 -5.146 -2.467 hp -0.0322 0.010 -3.348 0.002 -0.052 -0.012 ============================================================================== Omnibus: 4.159 Durbin-Watson: 2.250 Prob(Omnibus): 0.125 Jarque-Bera (JB): 3.028 Skew: 0.772 Prob(JB): 0.220 Kurtosis: 3.202 Cond. No. 563. ============================================================================== Warnings: [1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
Is at least one of the two variables (weight and horsepower) significant in the model? Run the overall F-test and provide your interpretation at 5% level of significance. Include the following in your analysis:
From Given output we can
a) Define the null and alternative hypothesis in mathematical terms and in words.
Answer -
H0 : both variables (weight and horsepower) insignificant in the model
Ha : least one of the two variables (weight and horsepower) significant in the model
b) Report the level of significance
Answer-
level of significance = 5% = 0.05
c) Include the test statistic and the P-value. (Hint: F-Statistic and Prob (F-Statistic) in the output).
Answer -
test statistic = 63.86
P-value = 5.81e-11
d) Provide your conclusion and interpretation of the test. Should the null hypothesis be rejected? Why or why not?
Answer -
Decision Rule : we reject Ho if p-value is less than level of significance.
Conclusion : p -value < 0.05 so we reject H0 hypothesis
Interpretation : There is least one of the two variables (weight and horsepower) significant in the model
-----------------------------------------------------------------------------------------------------------------------------------------------
Dear student,
I am waiting for your feedback. I have given my 100% to solve your
queries. If you are satisfied by my given answer please help me out
by giving thumbs up.
Thank You!!!