ch2problem28-rcode

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

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

View Full Document Right Arrow Icon
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 #__________________________________________________________________
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
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&lt;-data.frame(age=60) predict.lm(fit.1.27,new,interval=&quot;predict&quot;) # 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 &lt;- 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 &lt;- 8.173*sqrt(1+1/60 + (60-mean(age))^2/sum((age-mean(age))^2)) std.err.pred60 # [1] 8.240827...
View Full Document

This note was uploaded on 06/16/2009 for the course STAT 540 taught by Professor Staff during the Spring '08 term at Colorado State.

Page1 / 2

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

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online