Hi lasso fans,
After lasso logit, I can run lassoknots, then lassoselect, then lassocoef, then store e(b) and it contains all the betas I would expect, along with _cons. So far, so good. When I use dslogit, and follow the same steps, there's no _cons. I don't think I'm missing some subtlety of the DS algorithm that means there is no _cons, or whatever; after all, \beta_0 is right there in the regression formula on p.44 of the [LASSO] manual (under dslogit, Methods and Formulas). Does anyone have any clues on how to get the constant term? Should it be somehow included in the must-must predictor variables? And if so, how?
Robert
example code:
import delimited "http://www.robertgrantstats.co.uk/data/cp3.csv", varnames(1) clear delimiters(",")
order la ofsted4 cinrpriorreferral2012 wfragencyworkerrate2012 cinrassessmentinitial10days2012
// run double-selection logistic regression
dslogit ofsted4 cinrpriorreferral2012 ///
wfragencyworkerrate2012 ///
cinrassessmentinitial10days2012, ///
controls(cinrduring2012-wfrturnoverrate2012) coef selection(cv)
// choose lambda*
lassoknots, for(cinrpriorreferral2012) alllambdas
// set lambda*
lassoselect id=13, for(cinrpriorreferral2012)
// get coefficients
lassocoef (., for(cinrpriorreferral2012))
matrix DSLASSOBETA = e(b)
matrix list DSLASSOBETA
After lasso logit, I can run lassoknots, then lassoselect, then lassocoef, then store e(b) and it contains all the betas I would expect, along with _cons. So far, so good. When I use dslogit, and follow the same steps, there's no _cons. I don't think I'm missing some subtlety of the DS algorithm that means there is no _cons, or whatever; after all, \beta_0 is right there in the regression formula on p.44 of the [LASSO] manual (under dslogit, Methods and Formulas). Does anyone have any clues on how to get the constant term? Should it be somehow included in the must-must predictor variables? And if so, how?
Robert
example code:
import delimited "http://www.robertgrantstats.co.uk/data/cp3.csv", varnames(1) clear delimiters(",")
order la ofsted4 cinrpriorreferral2012 wfragencyworkerrate2012 cinrassessmentinitial10days2012
// run double-selection logistic regression
dslogit ofsted4 cinrpriorreferral2012 ///
wfragencyworkerrate2012 ///
cinrassessmentinitial10days2012, ///
controls(cinrduring2012-wfrturnoverrate2012) coef selection(cv)
// choose lambda*
lassoknots, for(cinrpriorreferral2012) alllambdas
// set lambda*
lassoselect id=13, for(cinrpriorreferral2012)
// get coefficients
lassocoef (., for(cinrpriorreferral2012))
matrix DSLASSOBETA = e(b)
matrix list DSLASSOBETA
Comment