Call: lm(formula = wage ~ age + agesq + exper, data = nbasal) Residuals: Min 1Q
ID: 3223127 • Letter: C
Question
Call:
lm(formula = wage ~ age + agesq + exper, data = nbasal)
Residuals:
Min 1Q Median 3Q Max
-2268.8 -608.0 -173.0 378.3 4478.5
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 65.505 2985.866 0.022 0.983
age 123.113 206.307 0.597 0.551
agesq -4.202 3.614 -1.163 0.246
exper 231.988 48.705 4.763 0.00000314 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 906.3 on 265 degrees of freedom
Multiple R-squared: 0.1875, Adjusted R-squared: 0.1783
F-statistic: 20.39 on 3 and 265 DF, p-value: 0.000000000006448
> summary(mod2)
Call:
lm(formula = lwage ~ age + agesq + exper, data = nbasal)
Residuals:
Min 1Q Median 3Q Max
-2.4771 -0.3900 0.1087 0.4969 1.8959
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.24357 2.58563 1.641 0.1019
age 0.24852 0.17865 1.391 0.1654
agesq -0.00710 0.00313 -2.269 0.0241 *
exper 0.25593 0.04218 6.068 0.00000000446 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.7848 on 265 degrees of freedom
Multiple R-squared: 0.216, Adjusted R-squared: 0.2072
F-statistic: 24.34 on 3 and 265 DF, p-value: 0.00000000000006049
> mod1<-lm(wage~age+agesq+exper,data=nbasal)
> mod2<-lm(lwage~age+agesq+exper,data=nbasal)
> mod3<-lm(lwage~age+agesq+exper+draft+experXdraft,data=nbasal)
> mod4<-lm(lwage~age+agesq+draft,data=nbasal)
> mod5<-lm(lwage~age+agesq+exper+draft,data=nbasal)
> mod6<-lm(lwage~age+agesq+exper+draft+exper_10Xdraft,data=nbasal)
> mod7<-lm(lwage~age_30+agesq_30+exper_10+draft_1+exper_10Xdraft_1,data=nbasal)
>
>
> summary(mod1)
Call:
lm(formula = wage ~ age + agesq + exper, data = nbasal)
Residuals:
Min 1Q Median 3Q Max
-2268.8 -608.0 -173.0 378.3 4478.5
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 65.505 2985.866 0.022 0.983
age 123.113 206.307 0.597 0.551
agesq -4.202 3.614 -1.163 0.246
exper 231.988 48.705 4.763 0.00000314 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 906.3 on 265 degrees of freedom
Multiple R-squared: 0.1875, Adjusted R-squared: 0.1783
F-statistic: 20.39 on 3 and 265 DF, p-value: 0.000000000006448
> summary(mod2)
Call:
lm(formula = lwage ~ age + agesq + exper, data = nbasal)
Residuals:
Min 1Q Median 3Q Max
-2.4771 -0.3900 0.1087 0.4969 1.8959
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.24357 2.58563 1.641 0.1019
age 0.24852 0.17865 1.391 0.1654
agesq -0.00710 0.00313 -2.269 0.0241 *
exper 0.25593 0.04218 6.068 0.00000000446 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.7848 on 265 degrees of freedom
Multiple R-squared: 0.216, Adjusted R-squared: 0.2072
F-statistic: 24.34 on 3 and 265 DF, p-value: 0.00000000000006049
> summary(mod3)
Call:
lm(formula = lwage ~ age + agesq + exper + draft + experXdraft,
data = nbasal)
Residuals:
Min 1Q Median 3Q Max
-2.44617 -0.32023 0.04864 0.34504 1.65358
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.2289561 2.0142509 0.610 0.54237
age 0.4420529 0.1387197 3.187 0.00164 **
agesq -0.0072206 0.0024120 -2.994 0.00305 **
exper -0.0409674 0.0401862 -1.019 0.30905
draft -0.0559423 0.0048970 -11.424 < 0.0000000000000002 ***
experXdraft 0.0053594 0.0006204 8.638 0.000000000000000904 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.587 on 234 degrees of freedom
(29 observations deleted due to missingness)
Multiple R-squared: 0.4854, Adjusted R-squared: 0.4744
F-statistic: 44.14 on 5 and 234 DF, p-value: < 0.00000000000000022
> summary(mod4)
Call:
lm(formula = lwage ~ age + agesq + draft, data = nbasal)
Residuals:
Min 1Q Median 3Q Max
-2.49422 -0.30751 0.09283 0.41890 2.63707
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.079132 2.276060 -0.035 0.97229
age 0.458965 0.160309 2.863 0.00457 **
agesq -0.006601 0.002787 -2.369 0.01866 *
draft -0.019653 0.002387 -8.232 0.0000000000000126 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.6836 on 236 degrees of freedom
(29 observations deleted due to missingness)
Multiple R-squared: 0.296, Adjusted R-squared: 0.2871
F-statistic: 33.08 on 3 and 236 DF, p-value: < 0.00000000000000022
> summary(mod5)
Call:
lm(formula = lwage ~ age + agesq + exper + draft, data = nbasal)
Residuals:
Min 1Q Median 3Q Max
-2.48241 -0.32755 0.07521 0.40247 2.36712
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.567791 2.307837 0.679 0.49760
age 0.402755 0.158883 2.535 0.01190 *
agesq -0.007615 0.002764 -2.755 0.00632 **
exper 0.120535 0.040764 2.957 0.00342 **
draft -0.017814 0.002430 -7.330 0.00000000000368 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.6727 on 235 degrees of freedom
(29 observations deleted due to missingness)
Multiple R-squared: 0.3213, Adjusted R-squared: 0.3097
F-statistic: 27.81 on 4 and 235 DF, p-value: < 0.00000000000000022
> summary(mod6)
Call:
lm(formula = lwage ~ age + agesq + exper + draft + exper_10Xdraft,
data = nbasal)
Residuals:
Min 1Q Median 3Q Max
-2.44617 -0.32023 0.04864 0.34504 1.65358
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.2289561 2.0142509 0.610 0.54237
age 0.4420529 0.1387197 3.187 0.00164 **
agesq -0.0072206 0.0024120 -2.994 0.00305 **
exper -0.0409674 0.0401862 -1.019 0.30905
draft -0.0023482 0.0027754 -0.846 0.39836
exper_10Xdraft 0.0053594 0.0006204 8.638 0.000000000000000904 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.587 on 234 degrees of freedom
(29 observations deleted due to missingness)
Multiple R-squared: 0.4854, Adjusted R-squared: 0.4744
F-statistic: 44.14 on 5 and 234 DF, p-value: < 0.00000000000000022
> summary(mod7)
Call:
lm(formula = lwage ~ age_30 + agesq_30 + exper_10 + draft_1 +
exper_10Xdraft_1, data = nbasal)
Residuals:
Min 1Q Median 3Q Max
-2.43580 -0.33069 0.06267 0.34895 1.64246
Coefficients: (1 not defined because of singularities)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7.5386337 0.1023549 73.652 < 0.0000000000000002 ***
age_30 0.4327157 0.1381964 3.131 0.00196 **
agesq_30 -0.0071008 0.0024064 -2.951 0.00349 **
exper_10 -0.0395884 0.0395991 -1.000 0.31847
draft_1 NA NA NA NA
exper_10Xdraft_1 0.0056981 0.0004738 12.027 < 0.0000000000000002 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.5866 on 235 degrees of freedom
(29 observations deleted due to missingness)
Multiple R-squared: 0.4838, Adjusted R-squared: 0.475
F-statistic: 55.06 on 4 and 235 DF, p-value: < 0.00000000000000022
> anova(mod3,mod4)
Analysis of Variance Table
Model 1: lwage ~ age + agesq + exper + draft + experXdraft
Model 2: lwage ~ age + agesq + draft
Res.Df RSS Df Sum of Sq F Pr(>F)
1 234 80.623
2 236 110.287 -2 -29.664 43.048 < 0.00000000000000022 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> anova(mod3,mod5)
Analysis of Variance Table
Model 1: lwage ~ age + agesq + exper + draft + experXdraft
Model 2: lwage ~ age + agesq + exper + draft
Res.Df RSS Df Sum of Sq F Pr(>F)
1 234 80.623
2 235 106.331 -1 -25.708 74.614 0.000000000000000904 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
B. How does being drafted one selection later affect annual salary for an individual with zero years of experience? Is the effect statistically different from zero? Report the p-value
C. How does being drafted one selection later affect annual salary for an individual with five years of experience? Is the effect statistically different from zero? Report the p-value
D. How does being drafted one selection later affect annual salary for an individual with ten years of experience? Is the effect statistically different from zero? Report the p-value
E. Construct a 95% confidence interval for predicted annual salary of the average player that is 30 years old, has 10 years of experience and was drafted first overall in the nba draft
H0 : 35 :0Explanation / Answer
Part-A
From summary(mod6) we have t=8.638 and t2=8.6382=74.615.
The t2 is distributed as F with degree of freed(1,234)
Part-B
From summary(mod3) we have p-value of coefficient of draft as p < 0.0000000000000002 which is less than 0.05 and so we conclude that effect of draft is significant with zero years experience. Coefficient of draft is -0.0559423 which is negative and indicates a decrease in annual salary for zero experience as for draft 1.
Part-C:
From summary(mod3) we have p-value of coefficient of draft as p < 0.0000000000000002 which is less than 0.05 and so we conclude that effect of draft is significant with zero years experience.
Also, p-value of coefficient of exper*draft is p= 0.000000000000000904 which is less than 0.05 indicating that effect of draft change as experience change and hence for 5 years experience effect of draft is =-0.0559423+5*0.0053594=-0.0291453 which is negative and indicates a decrease in annual salary for 5 years experience for draft 1.
Part-D:
From summary(mod6) we have p-value of coefficient of exper10*draft is p= 0.000000000000000904 which is less than 0.05 indicating that effect of draft change as experience change and hence for 10 years experience effect of draft 1 by 0.0053594 in annual salary for 10 years experience as draft increase by one unit.
Part-E:
To calculate prediction intevral add an extra data point for these values and use the following link
Prediction Interval for Linear Regression
Assume that the error term in the simple linear regression model is independent of x, and is normally distributed, with zero mean and constant variance. For a given value of x, the interval estimate of the dependent variable y is called the prediction interval.
Problem
In the data set faithful, develop a 95% prediction interval of the eruption duration for the waiting time of 80 minutes.
Solution
We apply the lm function to a formula that describes the variable eruptions by the variable waiting, and save the linear regression model in a new variable eruption.lm.
> attach(faithful) # attach the data frame
> eruption.lm = lm(eruptions ~ waiting)
Then we create a new data frame that set the waiting time value.
> newdata = data.frame(waiting=80)
We now apply the predict function and set the predictor variable in the newdata argument. We also set the interval type as "predict", and use the default 0.95 confidence level.
> predict(eruption.lm, newdata, interval="predict")
fit lwr upr
1 4.1762 3.1961 5.1564
> detach(faithful) # clean up
Answer
The 95% prediction interval of the eruption duration for the waiting time of 80 minutes is between 3.1961 and 5.1564 minutes.
Note
Further detail of the predict function for linear regression model can be found in the R documentation.
> help(predict.lm)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.