{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ch2problem28-rcode

# ch2problem28-rcode - #Part b Obtain a 95 prediction...

This preview shows pages 1–2. Sign up to view the full content.

Sheet1 Page 1 # Problem 2.28 # Note: see problem 2.27 where I read in the data # Part a. Obtain a 95% confidence interval for the mean muscle mass # for women of age 60 #Manual method: std.err.y60 <- 8.173*sqrt(1/60 + (60-mean(age))^2/sum((age-mean(age))^2)) std.err.y60 #[1] 1.055131 Y.hat.h = 156.3466-1.19*60 # [1] 84.9466 # Lower limit for a 95% CI 84.9466 - qt(.975,58)*std.err.y60 # [1] 82.83453 # Upper limit 84.9466 + qt(.975,58)*std.err.y60 # [1] 87.05867 # Interpretation (very important!): A 95% confidence interval for the # mean measure of muscle mass for a woman aged 60 is (82.83,87.06). # This interval was created using a method that has a 5% error rate. #Using R functions: new<-data.frame(age=60) predict.lm(fit.1.27,new,interval="confidence") fit lwr upr [1,] 84.94683 82.83471 87.05895 #__________________________________________________________________

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: #Part b. Obtain a 95% prediction interval for the muscle mass of a #woman whose age is 60. #Using R functions: new<-data.frame(age=60) predict.lm(fit.1.27,new,interval="predict") # fit lwr upr # [1,] 84.94683 68.45067 101.443 #Interpretation: We can predict with 95% confidence that the muscle mass for a 60 year old woman not measured in the study will be between 68.45 and 101.44. #Compare the standard error for prediction to the standard error for Y.hat: Sheet1 Page 2 #Standard error for Y.hat: std.err.y60 <- 8.173*sqrt(1/60 + (60-mean(age))^2/sum((age-mean(age))^2)) std.err.y60 #[1] 1.055131 #Standard error for Y.h(new): std.err.pred60 <- 8.173*sqrt(1+1/60 + (60-mean(age))^2/sum((age-mean(age))^2)) std.err.pred60 # [1] 8.240827...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern