07-10-2013 01:35 PM
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;
model bad (event='1') = X Y Z
output out=reg_result p=predprob;
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?
07-10-2013 01:47 PM
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.
07-10-2013 01:56 PM
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).