[R] Labels in GLMNET

RichS richschwinn at yahoo.com
Mon May 3 23:40:04 CEST 2010


In the ESL(2) (by F-H-T), they have labels on their Lasso graphs
(specifically for the South African Heart Disease data). 

So my question is, how do I label each variable in a similar way on my
graph. 

The following code should produce a plot with 9 enumerated variables: 

library(glmnet) 
x=matrix(rnorm(100*9),100,9) 
y=rnorm(100) 
g2=sample(1:2,100,replace=TRUE) 
g4=sample(1:4,100,replace=TRUE) 
fit1=glmnet(x,y) 
predict(fit1,newx=x[1:5,],s=c(0.01,0.005)) 
predict(fit1,type="coef") 
labs=cbind("sbp","tob","ldl","adi","fam","tpa","oby","alc","age") 
par(mfrow=c(1,1)) 
plot(fit1, label=TRUE) 

How can I replace the numbers in the margin with labels in labs? 

Was this ability only available in GLMpath (no longer available/working)? 

Thank you!   

RS 

PS  I've been searching for an answer for 2 days, but if I overlooked some
obvious post, please send the link!!!
-- 
View this message in context: http://r.789695.n4.nabble.com/Labels-in-GLMNET-tp2124662p2124662.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list