This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: halfnormalplot(2*coef(g2)[-1], label=T, n=3) # Dantzig selector library(lpSolve) # require the package(lpSolve) source("http://www.stat.ucla.edu/~hqxu/stat201A/R/DS.R") # if online Asat=dat$Asat; Asatc = Asat-mean(Asat); X1=dat[,1:9]; dim(X1) # main effects model b= DS(X1, Asatc, seq(0, 8, .1) ); b # X1 is not normalized b= DS(X1/sqrt(16), Asatc, seq(0, 2, .1) ); # normalized to length 1 g=lm(Asat ~ .^2-1, dat[,1:9]) X2 = model.matrix(g); dim(X2) # main effects plus 2-factor interactions model b = DS(X2, Asatc, seq(0, 8, .1) ); b g2=lm(Asat ~ C+D+A:B+A:C+A:E+A:K+B:C+B:G+B:H+B:K, dat); summary(g2) #r^2=98% #final model g2=lm(Asat ~ D+A:B+A:C+A:E+B:G+B:H+B:K, dat); summary(g2) # AE is signficant at 5% #r^2=94% #2...
View Full Document
This note was uploaded on 11/24/2010 for the course STAT 201a taught by Professor Wu during the Spring '10 term at Pasadena City College.
- Spring '10