SO I am having trouble knowing why my predicted probabilities do not match up with what I expect it to.
I am comparing this:
proc logistic data=natdata outmodel=test333;
class ioclass;
model bad (event='1') = X Y Z
output out=reg_result p=predprob;
run;
And in reg_result there is a estimated probability variable.
Then I manually create a variable called probability which is:
1/(1+e^0(intercept+ X*B1 +Y*B2 + Z*B3))
with B1-B3 being the regression coefficients.
Ignoring differences due to rounding, shouldnt the two columns be the same?
Post your full code used, the code above doesn't make sense. You specify a class variable but don't use it and the model statement is missing a semicolon.
And yes, the predicted probability will match the calculated probability if done correctly.
It kind of depends on what coding you used for the dependent variable. Do your predicted probabilities look like (1 - expected prob)? Or are they completely mucked about? I wonder about this because of the 0 in your manual equation--I assume that it is a negative sign in your actual calculations. You might want to add XBETA=logitvalue to the OUTPUT statement to check if your difference is, in fact, due to rounding. Logitvalue should be equal to (intercept+ X*B1 +Y*B2 + Z*B3).
Steve Denham
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.