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
Two-way fixed effects and multiple FEs (some questions to clear things up with the models used)Dear Stata Community: I am new to Stata, and have begun gathering information as to how to run fixe…
Nearstat Error MessageDear Statalist-Community, I am trying to calculate the distance between two datsets using their lat…
Weakly balanced panelMy data looks like this. ----------------------- copy starting from the next line ------------------…
Generating variables t-4 to 5Dear Statalisters, I am new to Stata and have been trying to generate the following variable. Varia…
Install Unix stata on Ubuntu in Windows Subsystem for Linuxl'm trying to install Stata on a unix kernel (unbuntu 20.10) installed on WSL on Windows 10 and i ge…
Subscribe to:
Post Comments (Atom)
0 Response to Lasso Regression for logit model
Post a Comment