Hello,
I am attempting to build a model for mortality prediction using lasso regression. So far I have separated variables into continuous and categorical subsets and have split the data. However, when it comes to attempting the actual lasso regression, an error occurs. My data set has around 400 observations and 190 variables. I have run the following codes so far:
*lasso regression steps
*dividing variables into categorical and continuous subsets
vl set, categorical(6) uncertain(0) dummy
vl list vlcategorical
vl list vlother
vl move (s1 s2 s3 s4 s5) vlother
vl list vldummy
vl move (mv2 mv3 mv4 mv5 mv6 mv7 mv8 mv9 mv10 mv11 mv12 mv13 mv14) vlother
vl list vlcontinuous
vl list vldummy
vl list vlcategorical
vl create factors = vldummy + vlcategorical
vl substitute ifactors = i.factors
label data "Survey data with vl"
save survey_vl
*splitting sample into Training and Testing
set seed 1234
splitsample, generate(sample) nsplit(2)
label define svalues 1 "Training" 2 "Testing"
label values sample svalues
lasso logit mortalityd $ifactors $vlcontinuous if sample == 1, rseed(1234)
*the number of observations is less than the cross-validation folds r(198);
It is when I ran the last code that the error occurred. I do not understand what the error means and I do not understand what cross-validation is either. I would really appreciate some help in the understanding of this and understanding how I could rectify it. I am using Stata 17 from my university portal.
Thank you!
Barsa
Related Posts with Lasso Regression for logit model
Multivariate tobit modelHi, I am trying to run a multivariate tobit model using lots of dummy independent variables for my …
Examples of great Dyndoc filesHello everyone, I'm using STATA 15, SE. I'm looking for a completed dyndoc file that I can learn f…
stpm2, initial values not feasibleHello, I am trying to run a flexible Parametric model in Stata. I study various outcomes and I run …
stpm2 r(1400) - initial values not feasibleHello everyone! I'm working on a predictive flexible parametric survival model and when I run the c…
Robustness Checks - coefficients unchanged, but additional control is significant.Hi, I have estimated a model and am now conducting some robustness checks. One of these involves th…
Subscribe to:
Post Comments (Atom)
0 Response to Lasso Regression for logit model
Post a Comment