Call:
lm(formula = log(wage) ~ educ + exper + tenure, data = wage1)
Residuals:
Min 1Q Median 3Q Max
-2.05802 -0.29645 -0.03265 0.28788 1.42809
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.284360 0.104190 2.729 0.00656 **
educ 0.092029 0.007330 12.555 < 2e-16 ***
exper 0.004121 0.001723 2.391 0.01714 *
tenure 0.022067 0.003094 7.133 3.29e-12 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4409 on 522 degrees of freedom
Multiple R-squared: 0.316, Adjusted R-squared: 0.3121
F-statistic: 80.39 on 3 and 522 DF, p-value: < 2.2e-16
we can see from F-statistic part that there are 522 degrees of freedom for the test, but additionally we can use
dfresidual<-df.residual(model)dfresidual
[1] 522
Task 6
From the previous code chunk we see that coefficient are all positive, so A is true. P-value for tenure is 3.29e-12 which is much smaller than 0.05 so effect is statistically significant, so B is true as well. The adjusted r-squared is 0.3121 which confirms C, so D is not true.
Task 8
Again, from the model we see that p-value for the exper coefficient is 0.01714 which is smaller than 0.05 but bigger than 0.01, so the correct answer is 5% significance level.
Task 10
new_model <-lm(log(wage) ~ educ, data = wage1)summary(new_model)
Call:
lm(formula = log(wage) ~ educ, data = wage1)
Residuals:
Min 1Q Median 3Q Max
-2.21158 -0.36393 -0.07263 0.29712 1.52339
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.583773 0.097336 5.998 3.74e-09 ***
educ 0.082744 0.007567 10.935 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4801 on 524 degrees of freedom
Multiple R-squared: 0.1858, Adjusted R-squared: 0.1843
F-statistic: 119.6 on 1 and 524 DF, p-value: < 2.2e-16
The F-statistic for the model is 119.6, with 1 degree of freedom for the predictor (educ) and 524 degrees of freedom for the residuals. The p-value for the F-statistic is less than 2.2e-16, which suggests that the model is statistically significant overall. So the answer is D.