R Code for HW5

# R Code for HW5 - table with Extra Sum of Squares Fit75 =...

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

# R Code for HW5 Sta108, Fall 2007, Utts ### Problem 6.15 Data = read.table ( "~/Documents/School/Sta108utts/CH06PR15.txt" ) names ( Data )= c ( "Y" , "X1" , "X2" , "X3" ) #(b) #print scatter-plot matrix and correlation matrix pairs ( Data , pch = 19 ) cor ( Data ) #(c) #fit regression model (6.5) Fit = lm ( Y ~ X1 + X2 + X3 , data = Data ) Fit ### Problem 6.16 #(a) #Test for regression relation. See F-statistic in summary() summary ( Fit ) qf ( 1 - 0.10 , 4 - 1 , 46 - 4 ) #F-value F(1-alpha, p-1, n-p) ### Problem 6.17 #(a) #90% the confidence interval for mean response at Xh Xh = data.frame ( X1 = 35 , X2 = 45 , X3 = 2.2 ) predict ( Fit , Xh , se.fit = TRUE , interval = "confidence" , level = 0.90 ) #(b) #90% prediction interval for mean response at Xh predict ( Fit , Xh , se.fit = TRUE , interval = "prediction" , level = 0.90 ) ### Problem 7.5 #(a) #First, run the model as with X2 then X1 then X3. Then print the ANOVA
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: table with Extra Sum of Squares Fit75 = lm(Y ~ X2 + X1 + X3, data = Data) anova ( Fit75 ) #(b) #perform F-test. See ANOVA table dim ( Data ) qf ( 1-0.025 , 1 , 46-4 ) #F-value F(1-alpha, 1, n-p) ### Problem 7.26 #(a) #fit regression model (6.1) Fit2 = lm ( Y ~ X1 + X2 , data = Data ) Fit2 #(b) summary ( Fit2 ) #(c) #Check for SSR(X1) Fit3 = lm ( Y ~ X1 + X3 , data = Data ) anova ( Fit3 ) #Check for SSR(X1|X3) Fit3 = lm ( Y ~ X3 + X1 , data = Data ) anova ( Fit3 ) #Check for SSR(X2) Fit4 = lm ( Y ~ X2 + X3 , data = Data ) anova ( Fit4 ) #Check for SSR(X2|X3) Fit4 = lm ( Y ~ X3 + X2 , data = Data ) anova ( Fit4 )...
View Full Document

## This note was uploaded on 09/01/2011 for the course ISYE 6414 taught by Professor Staff during the Fall '08 term at Georgia Tech.

Ask a homework question - tutors are online