I am trying to find MSE of the test set for a lasso regression in R. I have used the glmnet formula to create the lasso model, but using the model to calculate MSE as in the code below gives the following error:
Error in cbind2(1, newx) %*% nbeta : not-yet-implemented method for <data.frame> %*% <dgCMatrix>
lassofit = glmnet( x , y , alpha = 1 , lambda = opt_lambda_1se , standardize = TRUE )
mean( ( dtest$logprice - predict( lassofit , dtest ) ) ^ 2 )
Any help is greatly appreciated!