Obsidian | Level 7

## Predictive Probabilities

Hi,

I try to use the proc logistic command in order to obtain the predicted probabilities of each of my variables. Here is the code I am currently using:

``````proc logistic data=gabarit_final simple alpha=0.05 descending;
class fin_dec
cons (ref="0")
fed (ref="0")
EE (ref="0")
educ_can (ref="0")
/ param=ref;
model fin_dec =
cons
fed
nbr_ess_quali
nbr_multi_crit
EE
educ_can
output out=pred predicted=p;
run;
quit;``````

The 'p' variable created gives me the predicted probabilities for each observations in the dataset. However, I would like to estimate the probability by variables instead of by observations. For example, how could I calculate what is the probability of fin_dec = 1 if EE = 1 and the probability of fin_dec = 1 if EE = 0.

Would it be better to use proc qlim or proc probit in order to achieve my goal?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Predictive Probabilities

@Shawn08 wrote:

The 'p' variable created gives me the predicted probabilities for each observations in the dataset. However, I would like to estimate the probability by variables instead of by observations. For example, how could I calculate what is the probability of fin_dec = 1 if EE = 1 and the probability of fin_dec = 1 if EE = 0.

If you're including other variables you still need to consider them - typically this would mean setting them to the mean or reference value. I think you can obtain this in PROC LOGISTIC using ESTIMATE statements.

I'm surprised you're not reporting the ODDS RATIOS though, usually in a logistic model, that's what would be of interest.

4 REPLIES 4
Super User

## Re: Predictive Probabilities

@Shawn08 wrote:

The 'p' variable created gives me the predicted probabilities for each observations in the dataset. However, I would like to estimate the probability by variables instead of by observations. For example, how could I calculate what is the probability of fin_dec = 1 if EE = 1 and the probability of fin_dec = 1 if EE = 0.

If you're including other variables you still need to consider them - typically this would mean setting them to the mean or reference value. I think you can obtain this in PROC LOGISTIC using ESTIMATE statements.

I'm surprised you're not reporting the ODDS RATIOS though, usually in a logistic model, that's what would be of interest.

Obsidian | Level 7

## Re: Predictive Probabilities

Hi,

I would have another question. I'm attemping to manually calculate the predicted value, but I'm unable to do so with the following code:

``````ods trace on;
ods output ParameterEstimates = estimate;
proc logistic data=gabarit_final simple alpha=0.05 descending outest=out;
class fin_dec
cons (ref="0")
metho_AT (ref="0")
metho_AA (ref="0")
fed (ref="0")
EE (ref="0")
educ_can (ref="0")
multi_crit (ref="0")
/ param=ref;
model fin_dec =
cons
metho_AT
metho_AA
fed
nbr_ess_quali
multi_crit
EE
educ_can
output out=pred predicted=p xbeta=xb;
score data=gabarit_final out=estimates2;
run;
ods trace off;``````

The coefficient I get is the comparison between the 0 and 1 of each variable. However, I am unable to use these in order to manually calculate the predicted value. I know that I don't need to calculate it as it is already given, but I would like to learn how SAS does it in order to understand a bit more how SAS work.

Thank you very much

Super User

## Re: Predictive Probabilities

http://blogs.sas.com/content/iml/2014/02/19/scoring-a-regression-model-in-sas.html

https://communities.sas.com/t5/SAS-Statistical-Procedures/How-to-determine-logistic-regression-formu...

I think the CODE option from the first link is a good example. The second has a fully worked example you can walk through.
Super User

## Re: Predictive Probabilities

Also check EFFECTPLOT  statement and using ODS OUTPUT to get its result.  Calling @Rick_SAS

Discussion stats
• 4 replies
• 1169 views
• 4 likes
• 3 in conversation