{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ch2problem27-rcode

# ch2problem27-rcode - (Intercept 156.3466 5.5123...

This preview shows page 1. Sign up to view the full content.

Sheet1 Page 1 # Chapter 2, Problem 27 # Hypothesis Test for problem 2.27 part a # Muscle Mass data # X = age # Y = measure of muscle mass #Read in and examine the data ch1pr27.dat <- read.table("Your path/KNN_data/chap1/CH01PR27.txt") names(ch1pr27.dat) <- c("mass","age") attach(ch1pr27.dat) plot(age,mass) title("Muscle mass versus Age") #_______________________________________________________________ #Part a: Is there a negative linear relationship between #muscle mass and age? Control the risk of Type I error at 0.05. #State the alternatives, decision rule, p-value, and conclusion. fit.1.27 <- lm(mass ~ age) summary(fit.1.27) # Note: part of the output has been deleted: # # Coefficients: # Estimate Std. Error t value Pr(>|t|)
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: # (Intercept) 156.3466 5.5123 28.36 <2e-16 *** # age -1.1900 0.0902 -13.19 <2e-16 *** # ---# Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 # # Residual standard error: 8.173 on 58 degrees of freedom # Multiple R-Squared: 0.7501, Adjusted R-squared: 0.7458 # F-statistic: 174.1 on 1 and 58 DF, p-value: < 2.2e-16 #Can we just read off the p-value from the table above? # Use the command -qt(.95,58) to find rejection region-qt(.95,58) #[1] -1.671553 # p-value pt(-13.19,58) # [1] 2.084381e-19 #__________________________________________________________________ # Part b. # Note that the t-statistic for inference on b0 is given by 156.3466/5.5123=28.36 # See output above...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online