ge <- lm.ridge(Employed~.,longley,lambda=seq(0,0.1,0.001)) ge matplot(gr$lambda,t(gr$ceof),type="l") matplot(ge$lambda,t(ge$ceof),type="l") matplot(ge$lambda,t(ge$coef),type="l") abline(h=0,lwd=2) select(ge) gr$coef[,gr$lam==0.03] ge$coef[,ge$lam==0.03] abline(v=0.00428) abline(v=0.032) data(state) statedata <- data.frame(state.x77,row.names=state.abb,check.names=T) statedata g <- lm(Life.Exp~.,data=statedata) summary(g) g <- update(g,.~.,-Area) summary(g) g <- update(g,.~.-Area) summary(g) g <- update(g,.~.-Illiteracy) summary(g) g <- update(g,.~.-Income) summary(g) help(stepwise) help(lm) help(step) g <- lm(Life.Exp~.,data=statedata) step(g,direction="backward") step(g,direction="forward") g <- lm(Life.Exp~1,data=statedata) g step(g,direction="forward") help(step) g <- lm(Life.Exp~.,data=statedata) step(g,direction="backward") step(g,direction="forward") g <- lm(Life.Exp~1,data=statedata) g step(g,direction="forward") help(step) g <- lm(Life.Exp~.,data=statedata) step(g,direction="both")