I am currently using R’s glmnet
package to run a weighted ridge regression on hockey data. I have a sparse matrix with dummy variables denoting whether a player is on the ice playing offense or defense for a given shift, in addition to a few other predictors such as home ice advantage. I have a vector of weights which is the length of each shift. My target variable is a vector of shot rates that occur in a given shift.
The glmnet
call is as follows:
glmnet(y = shot_rates, x = dummy_matrix, weights = shift_length, lambda = previously_obtained_lambda)
(The Lambda is obtained through cross validation on the same data set which is also done using glmnet
.)
As of right now the distribution is entirely Gaussian and every predictor variable is biased towards a mean of zero. I am looking to incorporate prior information (prior means) for each dummy variable and possibly set separate lambda values for each of them but I am not sure how I go about doing that. I believe I can use penalty.factors to adjust the lambdas for each variable so we can put that aside for now and focus on the prior means.
I have looked into using the bayesglm
package and implementing prior.means but my issues with it are two-fold: it is slow as it is and it does not accept sparse matrices which makes things significantly slower. For reference, my matrix of dummy variables contains roughly 600,000 rows and roughly 2,000 columns.
How might I go about efficiently incorporating prior means into my analysis? Thanks in advance for any suggestions.