for the data file, open R and type in >install.packages(\"alr4\") Refer to the U
ID: 3275021 • Letter: F
Question
for the data file, open R and type in >install.packages("alr4")
Refer to the UN data in Problem 1.1. Use a software package to compute the simple linear regression model corresponding to the graph in problem 1.1.3. Draw a graph of log(fertility) versus log (ppgdp), and add the fitted line to the graph. Test the hypothesis that the slope is 0 versus the alternative that it is negative (a one-sided test). Give the significance level of the test and a sentence that summarizes the result. Give the value of the coefficient of determination, and explain its meaning.Explanation / Answer
We first give the complete R program and its output:
> library(alr4)
> data(UN11)
> lm1 <- lm(fertility~ppgdp,UN11)
> summary(lm1)
Call:
lm(formula = fertility ~ ppgdp, data = UN11)
Residuals:
Min 1Q Median 3Q Max
-1.9006 -0.8801 -0.3547 0.6749 3.7585
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.178e+00 1.048e-01 30.331 < 2e-16 ***
ppgdp -3.201e-05 4.655e-06 -6.877 7.9e-11 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.206 on 197 degrees of freedom
Multiple R-squared: 0.1936, Adjusted R-squared: 0.1895
F-statistic: 47.29 on 1 and 197 DF, p-value: 7.903e-11
> plot(log(UN11$ppgdp),log(UN11$fertility)
+ )
> lm2 <- lm(log(fertility)~log(ppgdp),UN11)
> abline(lm2)
> summary(lm2)
Call:
lm(formula = log(fertility) ~ log(ppgdp), data = UN11)
Residuals:
Min 1Q Median 3Q Max
-0.79828 -0.21639 0.02669 0.23424 0.95596
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.66551 0.12057 22.11 <2e-16 ***
log(ppgdp) -0.20715 0.01401 -14.79 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.3071 on 197 degrees of freedom
Multiple R-squared: 0.526, Adjusted R-squared: 0.5236
F-statistic: 218.6 on 1 and 197 DF, p-value: < 2.2e-16
2.16.3: The slope is negative as seen in the output and it is significant.
2.16.4: The coefficient of determination is 52.6% which means that approximately 53% of the variation of fertility is explained by ppgdp.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.