{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

R Code for discussion 6

R Code for discussion 6 - #R code Discussion 6 Sta108 Fall...

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

View Full Document Right Arrow Icon
1 #R code: Discussion 6. Sta108, Fall 2007, Utts ### Multiple Regression and Extra Sum of Squares #Example: Grocery Retailer: Problem 6.9 Data = read.table ( "CH06PR09.txt" ) names ( Data ) = c ( "Hours" , "Cases" , "Costs" , "Holiday" ) #scatterplot matrix for ALL variables in dataset pairs ( Data , pch = 19 ) #look for association between: #1. response variable and any of predictor variables #2. any two predictor variables #correlation matrix for ALL variables in dataset cor ( Data ) #gives correlation, r, measure of linear relationship b/w each pair of variables #fit multiple regression model Fit = lm ( Hours ~ Cases + Costs + Holiday , data = Data ) summary ( Fit ) #gives: parameter restimates, standard errors, t-statistic with p-value for testing #Ho: Beta.k = 0 #Ha: Beta.k not= 0, while all other parameters are kept in model #also, gives: sqrt(MSE), df, R-Sq, F-statistic with df and p-value for testing #Ho: Beta.k=0 for all k=1,2,..,p-1 #Ha: not all Beta.k are zero #(Test for regression relation) #variance-covariance matrix for vector of parameters, Beta vcov ( Fit )
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}