Reputation: 39
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?
Upvotes: 0
Views: 185
Reputation: 12909
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;
Upvotes: 3