{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

finalexrev

# finalexrev - R Code and Output > animfat.data percfat...

This preview shows pages 1–3. Sign up to view the full content.

R Code and Output > animfat.data percfat dbelly lwt cwt musc 1 51.4 1.5000 239 167 11 2 58.0 1.5666 229 185 9 3 51.0 1.5333 223 172 11 4 54.5 1.4000 210 160 10 5 53.1 1.5333 234 178 10 6 57.1 1.6000 239 185 9 7 55.3 1.3000 226 172 11 8 49.9 1.5000 225 172 13 9 57.3 1.7666 227 183 9 10 46.0 1.4666 215 164 14 11 54.1 1.6666 210 180 10 12 61.6 1.4333 233 188 8 13 56.1 1.6000 212 182 9 14 51.7 1.3666 244 172 11 15 50.9 1.4000 236 170 12 > library(leaps) > subs <- regsubsets(percfat~.,data=animfat.data,nbest=4, method=c("exhaustive")) > summary(subs) Subset selection object Call: regsubsets.formula(percfat ~ ., data = animfat.data, nbest = 4, method = c("exhaustive")) 4 Variables (and intercept) Forced in Forced out dbelly FALSE FALSE lwt FALSE FALSE cwt FALSE FALSE musc FALSE FALSE 4 subsets of each size up to 4 Selection Algorithm: exhaustive dbelly lwt cwt musc 1 ( 1 ) " " " " " " "*" 1 ( 2 ) " " " " "*" " " 1 ( 3 ) "*" " " " " " " 1 ( 4 ) " " "*" " " " " 2 ( 1 ) "*" " " " " "*" 2 ( 2 ) " " " " "*" "*" 2 ( 3 ) " " "*" " " "*" 2 ( 4 ) "*" " " "*" " "

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

View Full Document
3 ( 1 ) "*" " " "*" "*" 3 ( 2 ) "*" "*" " " "*" 3 ( 3 ) " " "*" "*" "*" 3 ( 4 ) "*" "*" "*" " " 4 ( 1 ) "*" "*" "*" "*" > result1 <- with(animfat.data,leaps(cbind(dbelly,lwt,cwt,musc),percfat, method="r2",nbest=4)) > result1\$r2 [1] 0.876641941 0.586244678 0.060745994 0.009581455 0.893634452 0.887491670 [7] 0.876981865 0.627510132 0.923641698 0.893965073 0.887505869 0.651561688 [13] 0.931563432 > result2 <- with(animfat.data,leaps(cbind(dbelly,lwt,cwt,musc),percfat, method="adjr2",nbest=4)) > result2\$adjr2 [1] 0.86715286 0.55441735 -0.01150431 -0.06660459 0.87590686 0.86874028 [7] 0.85647884 0.56542849 0.90281671 0.86504646 0.85682565 0.55653306 [13] 0.90418881 > result3 <- with(animfat.data,leaps(cbind(dbelly,lwt,cwt,musc),percfat, method="Cp",nbest=4)) > result3\$Cp [1] 7.025167 49.458222 126.244464 133.720663 6.542210 7.439797 [7] 8.975498 45.428485 4.157529 8.493899 9.437723 43.914054 [13] 5.000000 > n <- nrow(animfat.data)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 7

finalexrev - R Code and Output > animfat.data percfat...

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

View Full Document
Ask a homework question - tutors are online