Prostate - > pdf(file="Prostate.pdf") >

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: > pdf(file="Prostate.pdf") > pros<-read.table("http://www- stat.stanford.edu/~hastie/stats305/Data/prostate.dat", + head=TRUE) plot(pros) > > ### PROSWT appears to have one strange value! > sort(pros$PROSWT) [1] -9.0 -9.0 -9.0 -9.0 -9.0 10.5 14.5 15.7 17.3 19.8 20.1 20.3 [13] 20.6 21.1 21.3 22.5 22.6 22.9 24.7 25.0 25.2 25.4 25.9 26.0 [25] 26.0 26.4 27.4 28.0 28.8 29.0 29.0 29.5 29.6 30.0 30.3 30.7 [37] 31.0 31.3 32.0 32.0 32.8 32.9 33.4 33.4 33.5 33.7 34.2 34.2 [49] 35.2 35.7 36.1 36.3 36.5 37.2 37.6 38.2 38.5 38.9 39.3 39.5 [61] 40.0 40.6 41.0 41.0 41.5 42.9 43.3 45.5 45.6 45.6 46.1 46.2 [73] 46.7 46.8 47.5 47.5 48.0 48.1 48.6 49.0 49.0 50.0 53.0 54.0 [85] 54.1 56.3 57.2 59.2 59.5 60.2 61.3 61.4 65.0 68.8 72.0 77.6 [97] 81.9 84.0 92.0 111.7 118.9 449.0 > ### The -9's are missing values! > ### 449 is a typo; it should be 44.9 > j<-pros$PROSWT > pros[j==449,"PROSWT"]<-44.9 > ###Lets get rid of the missing values > pros<-pros[j!=-9,] > par(mfrow=c(3,3)) > for(n in names(pros))hist(pros[[n]],main= paste("Histogram of",n),xlab=n) > ### Lets take "started" logs of some of the skew variables > lprostate <- data.frame( + lcavol=log(pros$TOTLCA+.25), + lweight=log(pros$PROSWT+.25), + age=pros$AGE, + lbph=log(pros$BPH+.25), + svi=pros$SVINV, + lcp=log(pros$CAP_PEN+.25), + gleason=pros$SCORE, + pgg45=pros$"X.4.5", + lpsa=log(pros$PSA+.25) + ) > plot(lprostate) > names(lprostate) [1] "lcavol" "lweight" "age" "lbph" "svi" "lcp" "gleason" [8] "pgg45" "lpsa" > lm1 <- lm(lpsa~.,data=lprostate) > lm1 # Same as print(lm1) Call: lm(formula = lpsa ~ ., data = lprostate) Coefficients: (Intercept) lcavol lweight age lbph svi 0.181119 0.564361 0.622069 -0.021249 0.096677 0.761637 lcp gleason pgg45 -0.106049 0.049270 0.004458 > summary(lm1) Call: lm(formula = lpsa ~ ., data = lprostate) Residuals: Min 1Q Median 3Q Max -1.766396 -0.355091 -0.003272 0.381028 1.557672 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.181119 1.320595 0.137 0.89123 lcavol 0.564361 0.087831 6.426 6.54e-09 *** lweight 0.622069 0....
View Full Document

This document was uploaded on 11/14/2010.

Page1 / 5

Prostate - > pdf(file="Prostate.pdf") >

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online