Programming the statistical procedures from SAS

Proc logistic out and p statements

Reply
Frequent Contributor
Posts: 82

Proc logistic out and p statements

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?

Grand Advisor
Posts: 16,908

Re: Proc logistic out and p statements

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.

Grand Advisor
Posts: 16,908

Re: Proc logistic out and p statements

Here's a good reference thread that has a worked example.

Respected Advisor
Posts: 2,655

Re: Proc logistic out and p statements

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

Ask a Question
Discussion stats
  • 3 replies
  • 148 views
  • 0 likes
  • 3 in conversation