Hi everyone! Hope my title makes sense! I'm trying to build a code using forward selection process that has a multinomial response variable! I tried using proc glmselect and proc hpgenselect, but I get error messages since my response variable isn't numeric.
I'm looking to determine how likely people are going to visit a hospital based on variables such as education, work, income, etc. The visit hospital variable has 5 categories (none, most likely none, neutral, most likely yes, yes).
Let me know if it's even possible at all! And what other method I should use! Thanks!
proc hpgenselect data=factorshospital;
class education_cat(ref="0") work_cat(ref="0");
model visits_cat = education_cat work_cat;
selection method=forward;
run;
Here is the log of the error
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 proc glmselect data=factorshospital;
70 class education_cat(ref="0") work_cat(ref="0");
71 model visits_cat = education_cat work_cat
ERROR: Variable visits_cat in list does not match type prescribed for this list.
72 / selection=forward;
73 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GLMSELECT used (Total process time):
Since your Y variable is ordinal not nominal , I think you should recode it by 1,2,3 and specify the right distribution and link function .
data have;
set sashelp.heart;
if bp_status='High' then y=1;
else if bp_status='Normal' then y=2;
else if bp_status='Optimal' then y=3;
run;
proc hpgenselect data=have;
class sex Smoking_Status;
model y = sex Smoking_Status weight height ageatstart/dist= MULTINOMIAL link=cll;
selection method=forward;
run;
@chester2018 wrote:
Hi everyone! Hope my title makes sense! I'm trying to build a code using forward selection process that has a multinomial response variable! I tried using proc glmselect and proc hpgenselect, but I get error messages since my response variable isn't numeric.
I'm looking to determine how likely people are going to visit a hospital based on variables such as education, work, income, etc. The visit hospital variable has 5 categories (none, most likely none, neutral, most likely yes, yes).
proc hpgenselect data=factorshospital; class education_cat(ref="0"); model visits_cat = education_cat; selection method=forward; run;
Whenever you get an error, show us the log for this PROC. We need to see the log from the PROC HPGENSELECT statement down to the last NOTE after the PROC ends, every single line in the log in this range.
Why would you want to do a forward selection with only one X variable?
I plan to do the forward selection method with the additional variables, like work, income, etc. I made the edits in my post.
This is the error message "ERROR: Variable visits_cat in list does not match type prescribed for this list"
Since your Y variable is ordinal not nominal , I think you should recode it by 1,2,3 and specify the right distribution and link function .
data have;
set sashelp.heart;
if bp_status='High' then y=1;
else if bp_status='Normal' then y=2;
else if bp_status='Optimal' then y=3;
run;
proc hpgenselect data=have;
class sex Smoking_Status;
model y = sex Smoking_Status weight height ageatstart/dist= MULTINOMIAL link=cll;
selection method=forward;
run;
Thank you so much! This makes sense!!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.