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
Transform „years“ into event-based new variables „t0, t-1…“Hello together. I am still a beginner and hope you can help me with my – most likely – simple quest…
Generating KM curves in stratified analysis with time varying covariateI am trying to generate KM curves in a survival analysis that is stratified by matched pairs and als…
Understanding interactions using -clogit_I have a 1:4 matched dataset. One case (a brain tumor that responded to an experimental treatment) m…
Out of sample tests with conditional logistic regressionHi all, This might be really simple question about out of sample tests, but still I couldn't find a…
Generating KM curves in stratified analysis with time varying covariateI am trying to generate KM curves in a survival analysis that is stratified by matched pairs and als…
Subscribe to:
Post Comments (Atom)
0 Response to Lasso Regression for logit model
Post a Comment