Turn on suggestions

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

Showing results for

- Home
- /
- Programming
- /
- Programming
- /
- Proc Logistic. Why is predicted probability different than calculated ...

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-24-2021 12:24 PM
(604 views)

As in a subject.

data have; set sashelp.cars; isUSA = Origin="USA"; run; proc logistic data=have; model isUSA=EngineSize Cylinders Horsepower; output out=pred p=p; run; data want; keep p p_manual; set pred; p_manual = 1/(1+EXP(-1 * 0.3199 -3.091*EngineSize +0.5735*Cylinders +0.0334*Horsepower)); run;

Why is **p** different than **p_manual **variable in the want dataset?

Thanks.

- Tags:
- proc logistic

1 ACCEPTED SOLUTION

Accepted Solutions

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

How different?

Here's an example showing results that match exactly.

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

You were missing a set of brackets in your formula:

p_manual = 1/(1+EXP(-1 *(0.3199 -3.091*EngineSize +0.5735*Cylinders +0.0334*Horsepower)));

@Jedrek369 wrote:

As in a subject.

data have; set sashelp.cars; isUSA = Origin="USA"; run; proc logistic data=have; model isUSA=EngineSize Cylinders Horsepower; output out=pred p=p; run; data want; keep p p_manual; set pred; p_manual = 1/(1+EXP(-1 * 0.3199 -3.091*EngineSize +0.5735*Cylinders +0.0334*Horsepower)); run;Why is

pdifferent thanp_manualvariable in the want dataset?

Thanks.

3 REPLIES 3

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

How different?

Here's an example showing results that match exactly.

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

You were missing a set of brackets in your formula:

p_manual = 1/(1+EXP(-1 *(0.3199 -3.091*EngineSize +0.5735*Cylinders +0.0334*Horsepower)));

@Jedrek369 wrote:

As in a subject.

data have; set sashelp.cars; isUSA = Origin="USA"; run; proc logistic data=have; model isUSA=EngineSize Cylinders Horsepower; output out=pred p=p; run; data want; keep p p_manual; set pred; p_manual = 1/(1+EXP(-1 * 0.3199 -3.091*EngineSize +0.5735*Cylinders +0.0334*Horsepower)); run;Why is

pdifferent thanp_manualvariable in the want dataset?

Thanks.

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

Shoot. That's embarrassing. Thanks anyway.

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

Tip: The formula

p_manual = 1/(1+EXP(-1 * (...)));

can be simplified to

p_manual = logistic(...);

(see LOGISTIC function).

**Available on demand!**

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.