

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Class: Statistical Analysis; Subject: Statistics; University: University of Illinois - Urbana-Champaign; Term: Unknown 1989;
Typology: Study notes
1 / 3
This page cannot be seen from the preview
Don't miss anything!


library(MASS); data(Cars93); attach(Cars93) data.frame(Make, MPG.highway, Price)
price = cut(Price,c(0,12,20,max(Price))) levels(price)=c("cheap","okay","expensive") mpg = cut(MPG.highway,c(0,20,30,max(MPG.highway))) levels(mpg) = c("poor","decent","excellent")
table(Type) table(price,Type) table(price,Type,mpg) ftable(price,Type,mpg) ftable(price,Type,mpg, col.vars=c(‘price’,’mpg’))
barplot(table(price,Type),beside=T) # the price by different types barplot(table(Type,price),beside=T) # type by different prices
data(PlantGrowth) PlantGrowth[1:5, ]
attach(PlantGrowth) weight.ctrl = weight[group == "ctrl"] # similar for trt1 and trt detach(PlantGrowth)
pg = unstack(PlantGrowth) boxplot(pg)
bio = unstack(twins, Biological~Social) attach(bio) boxplot(bio)
stack(bio) stack(pg) stack(pg, select = -ctrl)
EW = read.table(“http://www.stat.uiuc.edu/~dunger/EW2000.txt”, header=T) pairs(EW) # We don’t really need to see all of these. attach(EW) plot(data.frame(weight,squat,BP,deadlift,total))