• Unless otherwise stated, all data sets are from the faraway package in R. • Un
ID: 3055708 • Letter: #
Question
• Unless otherwise stated, all data sets are from the faraway package in R.
• Unless otherwise stated, use a 5% level ( = 0.05) in all tests.
3. Nineteenth century economist W. Stanley Jevons was concerned about the loss of value in coins due to their loss in weight while in circulation. He collected, cleaned, and weighed 274 gold sovereigns, then grouped them roughly according to age (in decades): Age Number Average Weight (g) Standard Dev. 7.9725 7.9503 7.9276 7.8962 7.8730 123 78 32 17 24 0.01409 0.02272 0.03426 0.04057 0.05353 4 (a) Perform the usual (unweighted) simple linear regression of Average Weight on Age. (b) Form a 95% confidence interval for the regression slope, that is, the average weight (c) Perform a weighted regression of Average Weight on Age, using the group sizes as (d) Under this weighted model, form a 95% confidence interval for the slope. (Again, you (e) Notice that the standard deviations seem to be different for different groups. Perform Produce a summary of the results change per decade. (You may use the function confint.) weights. Produce a summary of the results. may use the function confint, which also works for weighted models.) another weighted regression of Average Weight on Age, this time also accounting for the different standard deviations of the different groups. Produce a summary of the results (f) Under this new weighted model, form a 95% confidence interval for the slope.Explanation / Answer
> data<-read.csv("D://chegg2.csv",header=T)
> data
Age Number AverageWeight StandardDev
1 1 123 7.9725 0.01409
2 2 78 7.9503 0.02272
3 3 32 7.9276 0.03426
4 4 17 7.8962 0.04057
5 5 24 7.8730 0.05353
> avgwgt<-data[,3]
> avgwgt
[1] 7.9725 7.9503 7.9276 7.8962 7.8730
> age<-data[,1]
> age
[1] 1 2 3 4 5
> ##1
> model<-lm(age~avgwgt,data=data)
> model
Call:
lm(formula = age ~ avgwgt, data = data)
Coefficients:
(Intercept) avgwgt
314.87 -39.36
> summary(model)
Call:
lm(formula = age ~ avgwgt, data = data)
Residuals:
1 2 3 4 5
-0.087987 0.038265 0.144838 -0.091005 -0.004111
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 314.870 11.191 28.14 9.86e-05 ***
avgwgt -39.358 1.412 -27.87 0.000101 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.1133 on 3 degrees of freedom
Multiple R-squared: 0.9962, Adjusted R-squared: 0.9949
F-statistic: 776.6 on 1 and 3 DF, p-value: 0.0001014
> ##2
> confint(model,'avgwgt',level=0.95)
2.5 % 97.5 %
avgwgt -43.85275 -34.86331
> ##3
> w<-data[,2]
> w
[1] 123 78 32 17 24
> model2<-lm(age~avgwgt,weights=w)
> model2
Call:
lm(formula = age ~ avgwgt, weights = w)
Coefficients:
(Intercept) avgwgt
322.79 -40.36
> summary(model2)
Call:
lm(formula = age ~ avgwgt, weights = w)
Weighted Residuals:
1 2 3 4 5
-0.5025 0.5190 0.8071 -0.5135 -0.2979
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 322.790 10.946 29.49 8.56e-05 ***
avgwgt -40.357 1.377 -29.30 8.73e-05 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.7131 on 3 degrees of freedom
Multiple R-squared: 0.9965, Adjusted R-squared: 0.9954
F-statistic: 858.6 on 1 and 3 DF, p-value: 8.729e-05
> ##4
> confint(model2,'avgwgt',level=0.95)
2.5 % 97.5 %
avgwgt -44.7399 -35.97376
> ##5
> w2<-data[,4]
> w2
[1] 0.01409 0.02272 0.03426 0.04057 0.05353
> model3<-lm(age~avgwgt,weights=w2)
> model3
Call:
lm(formula = age ~ avgwgt, weights = w2)
Coefficients:
(Intercept) avgwgt
310.37 -38.79
> summary(model3)
Call:
lm(formula = age ~ avgwgt, weights = w2)
Weighted Residuals:
1 2 3 4 5
-0.015219 0.001612 0.024100 -0.017673 0.002864
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 310.366 11.361 27.32 0.000108 ***
avgwgt -38.788 1.436 -27.00 0.000111 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.01946 on 3 degrees of freedom
Multiple R-squared: 0.9959, Adjusted R-squared: 0.9945
F-statistic: 729.1 on 1 and 3 DF, p-value: 0.0001115
>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.