BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Shawn08
Obsidian | Level 7

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
Reeza
Super User

@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.

 

View solution in original post

4 REPLIES 4
Reeza
Super User

@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.

 

Shawn08
Obsidian | Level 7

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

Ksharp
Super User

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

SAS Innovate 2025: Save the Date

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

Save the date!

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.

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