Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Forecasting
- /
- Predictive Probabilities

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 08-01-2017 02:44 PM
(1756 views)

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
/link=probit;
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?

Thank you in advance,

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@Shawn08 wrote:

The 'p' variable created gives me the predicted probabilities for each

observationsin the dataset. However, I would like to estimate the probability byvariablesinstead of byobservations. 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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@Shawn08 wrote:

The 'p' variable created gives me the predicted probabilities for each

observationsin the dataset. However, I would like to estimate the probability byvariablesinstead of byobservations. 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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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
/link=probit technique=newton expb;
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

**SAS Innovate 2025** is scheduled for May 6-9 in Orlando, FL. Sign up to be **first to learn** about the agenda and registration!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.