## Logistic regression

Solved
Occasional Contributor
Posts: 13

# Logistic regression

I want to check the OR of some independent variables in a logistic model.

I used this model :

proc logistic data=results2 descending;
where season between 1001 and 3254;
class
source_revenu_cat (param=ref ref='Aucune')
betail (param=ref ref='auc')
terres_acces (param=ref ref='Non')
region (param=ref ref='1-Sud')
v_urban_rural (param=ref ref='rural')
etudes_ppt_cat (param=ref ref="A - Jamais allée à l'école")
personnes_menage_nombre1 (param=ref ref='1 à 3')
model MDD_W_5 (event='Oui')= region v_urban_rural adultes_15_ans_plus source_revenu_cat terres_acces betail etudes_ppt_cat

personnes_menage_nombre1 ;

format season saison.;
run;

The table of the OR gave me this result; though the percentages don't seem to match !! did I do something wrong with the code or the interpretation ??

Accepted Solutions
Solution
‎05-16-2018 03:43 PM
Super User
Posts: 23,700

## Re: Logistic regression

@sebai wrote:

By the percentages don't match: I mean that because 24% is higher than 19.1% then the OR should be more than 1, right !!?

I think your assumption here is incorrect, you can review how Odds Ratio are calculated here

And your output is clearly not the default SAS output, so it's been manipulated somehow already. Check your actual results from the PROC LOGISTIC and you'll see that the output does not include the Odds Ratio of 1 or an estimate for the reference levels. By default there is no estimate for the reference level, but you're setting it to 1 as the reference level somewhere, which is technically correct. The reference level is assumed to be at 1, since by default the comparisons are to the reference level for categorical data.

``terres_acces (param=ref ref='Non')``

PS. You do note need to set PARAM=REF for every variable you can include it at the end instead and it applies to all variables. If you have different parameterization methods for variables then you would need to set it individually.

``class <list of variables and reference levels> / param=ref;``

All Replies
Super User
Posts: 23,700

## Re: Logistic regression

What do you mean 'the percentages don't match'?

I suspect you may have lost some observations due to missing data in the other variables, you can see this by looking at the top of the results and checking how many observations were used in the model.

@sebai wrote:

I want to check the OR of some independent variables in a logistic model.

I used this model :

proc logistic data=results2 descending;
where season between 1001 and 3254;
class
source_revenu_cat (param=ref ref='Aucune')
betail (param=ref ref='auc')
terres_acces (param=ref ref='Non')
region (param=ref ref='1-Sud')
v_urban_rural (param=ref ref='rural')
etudes_ppt_cat (param=ref ref="A - Jamais allée à l'école")
personnes_menage_nombre1 (param=ref ref='1 à 3')
model MDD_W_5 (event='Oui')= region v_urban_rural adultes_15_ans_plus source_revenu_cat terres_acces betail etudes_ppt_cat

personnes_menage_nombre1 ;

format season saison.;
run;

The table of the OR gave me this result; though the percentages don't seem to match !! did I do something wrong with the code or the interpretation ??

Occasional Contributor
Posts: 13

## Re: Logistic regression

Actually, all my observations were used I have no missing data.

By the percentages don't match: I mean that because 24% is higher than 19.1% then the OR should be more than 1, right !!?

Solution
‎05-16-2018 03:43 PM
Super User
Posts: 23,700

## Re: Logistic regression

@sebai wrote:

By the percentages don't match: I mean that because 24% is higher than 19.1% then the OR should be more than 1, right !!?

I think your assumption here is incorrect, you can review how Odds Ratio are calculated here

And your output is clearly not the default SAS output, so it's been manipulated somehow already. Check your actual results from the PROC LOGISTIC and you'll see that the output does not include the Odds Ratio of 1 or an estimate for the reference levels. By default there is no estimate for the reference level, but you're setting it to 1 as the reference level somewhere, which is technically correct. The reference level is assumed to be at 1, since by default the comparisons are to the reference level for categorical data.

``terres_acces (param=ref ref='Non')``

PS. You do note need to set PARAM=REF for every variable you can include it at the end instead and it applies to all variables. If you have different parameterization methods for variables then you would need to set it individually.

``class <list of variables and reference levels> / param=ref;``
Super User
Posts: 13,523

## Re: Logistic regression

@sebai wrote:

Actually, all my observations were used I have no missing data.

By the percentages don't match: I mean that because 24% is higher than 19.1% then the OR should be more than 1, right !!?

You are describing a Prevalence Ratio.

Another link that may help: https://www.researchgate.net/post/Prevalence_Ratio_Odds_Ratio_and_Relative_Risk

☑ This topic is solved.