what are the weights for in predict function in R I got the Coefficient of the min $\lambda$ value from the cv.glmnet function. Now I would like to predict the values using the predict() function. I see that it takes weights as an argument. Do the weights imply the coefficients of the model?
I would like to know how to use the coefficient values to predict the output of a test set data. Do we have any function that takes the coefficient values as inputs? 
 A: The predict function does not take a weights argument, but cv.glmnet does. However, the weights argument is optional and refers to the weights you wish to assign to your observations. For instance, if you had 20 observations and wished to give the ten most recent observations double the weight of the first ten, you could do:
weights = c(rep(1, 10), rep(2, 10))  
cvfit = cv.glmnet(x, y, weights, ...)

You need not worry about the sum of the weights you specify as these are scaled automatically.
You could then pass your cv.glmnet object directly to the predict function:
predict(cvfit, newx, s = "lambda.min")

A: From what I understand, and this could be more a question as well, that for the prediction part, the newx will also need to be weighted. If instead of predict, glmnet can be used as well where weights can be passed for the fixed s being lambda.min.
Can someone respond whether this would be the correct approach? Does predict function automatically incorporate the weights which were passed into cvfit?
