Re: [R] glmnet: obtain predictions using predict and also by extracting coefficients

2012-03-21 Thread Weidong Gu
Hi Juliet, First of all, cv.glmnet is used to estimate lambda based on cross-validation. To get a glmnet prediction, you should use glmnet function which uses all data in the training set. Second, you constructed testX using a different data set (data.test.std) from one for glmnet predict (data.te

Re: [R] glmnet: obtain predictions using predict and also by extracting coefficients

2012-03-21 Thread Juliet Hannah
Oops. Coefficients are returned on the scale of the original data. testX <- cbind(1,data.test) yhat2 <- testX %*% beta # works plot(yhat2,yhat_enet) On Wed, Mar 21, 2012 at 2:35 PM, Juliet Hannah wrote: > All, > > For my understanding, I wanted to see if I can get glmnet predictions > using

[R] glmnet: obtain predictions using predict and also by extracting coefficients

2012-03-21 Thread Juliet Hannah
All, For my understanding, I wanted to see if I can get glmnet predictions using both the predict function and also by multiplying coefficients by the variable matrix. This is not worked out. Could anyone suggest where I am going wrong? I understand that I may not have the mean/intercept correct,