I have a linear model that predicts the stat "buy" that can only have 0 or 1 as an outcome.
All my predictions are some rational numbers like 0.2 or something like that. My idea would be to make every number of 0.5 or above a 1 and everything else a 0. How can I do that?
My idea was with an if then else statement but at least like that it doesn't work:
proc GLMSELECT data=tasks.data plots=all;
by descending gender;
model buy = affiliate age;
if buy >=0.5 then buy = 1 else 0;
run;
How do I need to code it so it works?
You don't need a linear regression model, you need a logistic regression model. Linear regression is designed for continuous outcomes, not binary events. I highly recommend reading up about the differences between categorical and continuous models .
proc logistic data=sashelp.heart plots=all;
class BP_Status Chol_Status Smoking_Status ;
model status(event='Dead') = Height Weight BP_Status Chol_Status Smoking_Status
/ selection=stepwise sle=0.1 sls=0.05
;
run;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.