gabrielrvsc / HDeconometrics

Set of R functions for high-dimensional econometrics
Other
30 stars 21 forks source link

ic.glmnet does not work for families other than gaussian (e.g. Poisson, binomial, multinomial, mgaussian) #1

Open tomwenseleers opened 7 years ago

tomwenseleers commented 7 years ago

I just wanted to use ic.glmnet to selected the best lambda based on the BIC for a glmnet with family= multinomial or mgaussian, but I notice that the source code is not adapted to that (as the response y is turned into a vector, whereas the response is a matrix in the case of multinomial or mgaussian). In fact I think it also doesn't work for Poisson or binomial. Would it be hard to allow for these other families by any chance?

gabrielrvsc commented 7 years ago

So far I implemented only for family="gaussian". I don't think it should be a problem to generalize to other types as long as you use their respective log-likelihoods in the BIC. If your data is iid you do not have to go through all this trouble, just use the cv.glmnet from the glmnet package. I don't know if the BIC is the most suited option for all types even for non-iid data.

tomwenseleers commented 7 years ago

Well I was interested in this function for families Poisson, binomial, multinomial and mgaussian, mostly because I am dealing with longitudinal data and that I thought using these information criteria to select lambda would be faster than using cross validation. Or am I mistaken about this?

gabrielrvsc commented 7 years ago

You are right. Information criteria is faster because you only estimate the regularization path once. However, in my experience, if you don't have problems such as time or spatial dependency cross-validation works better.

tomwenseleers commented 7 years ago

Thanks for letting me know - will have a try comparing the two then. I'm dealing with longitudinal data, so I have temporal dependencies, which made me think that using information criteria could be worth a try...

olyagrs commented 6 years ago

@tomwenseleers did you manage to update ic.glmnet for mgauss?