Solved
Contributor
Posts: 40

# Confused - Hard coding Logistic Reg Equation

Hi,

I am new to logistic reg so I think I am missing some basics on how to write equation from Maximum Likelihood Estimates

I am in the final steps of scoring a dataset after building a Logistic Regression model. I have used Reference Cell coding for categorical variable. The confusion I have is:

If I use the Score statement in Proc Logistic, I get the output table with scored probabilities column called P_1. However, If I try to write equation from Maximum Likelihood Estimates, I get different probability values.

Why is that so? Is it because, in the equation, I am not mentioning the reference level for any categorical variable. Can someone please help me write equation for these results (just an example):

Maximum liklihood Coefficients:

Intercept: -0.2367

Var 1:     Age_LE_18: This is reference level

Age_18_to_40: 0.3245

Age_Above_40: 0.4125

Var2       Good_credit_History: Reference Level

The equation I am writing is:   -0.2367  +  0.3245*(Var1='Age_LE_18')  + 0.4125*(Var1='Age_Above_40')  - 0.8795*                             (VAR2='Bad_Credit_History')

If you see, I am not mentioning Reference levels in my equation. If this is right, then why the probabilities do not match with Score Statement?

Thanks

Sachin

Accepted Solutions
Solution
‎10-27-2015 03:56 PM
Super User
Posts: 20,731

## Re: Confused - Hard coding Logistic Reg Equation

[ Edited ]

Usually this is because you're doing something wrong. Post your full SAS code, output and where you think it's wrong. Proc Logistic score output will match the hand calculated output. If you even search on here, you'll find examples where I've coded this out.

All Replies
Solution
‎10-27-2015 03:56 PM
Super User
Posts: 20,731

## Re: Confused - Hard coding Logistic Reg Equation

[ Edited ]

Usually this is because you're doing something wrong. Post your full SAS code, output and where you think it's wrong. Proc Logistic score output will match the hand calculated output. If you even search on here, you'll find examples where I've coded this out.

Contributor
Posts: 40

## Re: Confused - Hard coding Logistic Reg Equation

You right Reeza. I hadwrong value for one of the coefficients.

🔒 This topic is solved and locked.