Andrew ID:
Collaborated with:

On this homework, you can collaborate with your classmates, but you must identify their names above, and you must submit your own homework as an knitted HTML file on Canvas, by Sunday 10pm, this week.

## For reproducibility --- don't change this!

Some R basics

x.list = list(rnorm(6), letters, sample(c(TRUE,FALSE),size=4,replace=TRUE))

Prostate cancer data set

OK, moving along to more interesting things! We’re going to look again, as in lab, at the prostate cancer data set: 9 variables measured on 97 men who have prostate cancer (from the book The Elements of Statistical Learning):

  1. lpsa: log PSA score
  2. lcavol: log cancer volume
  3. lweight: log prostate weight
  4. age: age of patient
  5. lbph: log of the amount of benign prostatic hyperplasia
  6. svi: seminal vesicle invasion
  7. lcp: log of capsular penetration
  8. gleason: Gleason score
  9. pgg45: percent of Gleason scores 4 or 5

To load this prostate cancer data set into your R session, and store it as a matrix pros.dat:

pros.dat =

Computing standard deviations using iteration = vector(length=ncol(pros.dat))
i = 1 = apply(pros.dat.svi, 2, sd) = apply(, 2, sd)

Computing t-tests using vectorization

Computing t-tests using iteration