Unformatted text preview: , "Cultur" , "Xray" , "Beds" , "Census" , "Nurse" , "Facility" ), method = "Cp" ) #Three best models are chosen by 3 lowest Cp criterions #To automatically print models in the increasing order of Cp criterion: ModelSel = leaps ( x = DataX , y = DataY , names = c ( "Age" , "Risk" , "Cultur" , "Xray" , "Beds" , "Census" , "Nurse" , "Facility" ), method = "Cp" ) ModelSel $ which [ order ( ModelSel $ Cp ), ] #To print Cp criterion in increasing order sort ( ModelSel $ Cp ) #To plot Cp against p, and add reference line: Cp=p plot ( ModelSel $ size , ModelSel $ Cp , pch = 19 ) abline ( , 1 ) #Fit the best chosen model Fit = lm ( Stay ~ Age + Xray + Census , data = Data ) Fit #Residual plot plot ( Fit $ fitted.values , Fit $ residuals , main = "Residuals vs. Fitted Values" , xlab = "Fitted Values" , ylab = "Residuals" , pch = 19 ) abline ( h = )...
View
Full Document
 Fall '08
 Staff
 Column, Categorical distribution, Utts, Honda Fit, lowest Cp criterions

Click to edit the document details