glmnetUtils icon indicating copy to clipboard operation
glmnetUtils copied to clipboard

Feature Request: Returning x and y in the formula interface

Open c7rishi opened this issue 4 years ago • 1 comments

Hello,

Thanks for the excellent package. The functions are super helpful, and they make life much simpler while fitting glmnet models on a given dataset. One additional feature that I think would be great to have is an option of returning the predictor (and response) matrices created from the formula while fitting the model. This will be similar to the lm() and glm() functions where the logical arguments x and y determine whether these matrices/vectors are to be returned with the output. This is particularly useful e.g., in a post-analysis where one fits another model (say, a random forest) with the same predictors used in the glmnet.

Thanks, Saptarshi

c7rishi avatar Dec 27 '20 16:12 c7rishi

👍 @hongooi73 Could you just export the makeModelComponents(MF) functions? I have a similar use case. and as you make clear, your design matrix construction is not covered by standard R functions. (My own use case is calculating the "impact" of a coefficient in a linear model, by summing the w_i x_i,j over a dataset (indexed by j))

seanv507 avatar May 14 '22 12:05 seanv507