Discussed below are two ways that an odds ratio can be the inverse (reciprocal) of the intended value. See also these notes on odds ratios:
The odds ratio for a confidence interval disagrees with the parameter p-value or confidence interval
Why are the reported odds ratios not equal to exp(beta)?
How can I get odds ratio estimates and confidence intervals using PROC LOGISTIC?
Modeling the nonevent level of the response
An odds ratio is the change in the odds of the event of interest. A binary response variable has an event level and a nonevent level. The event level is the level you want to make statements about. For instance, if the response is "pass" or "fail" and you want to make statements about the probability of passing, then "pass" is the event level of interest. To be certain you are modeling the event level, you should always use the EVENT= option when fitting a logistic model with a binary response. PROC LOGISTIC indicates the level it is modeling in a note in the SAS log and just below the "Response Profile" table. Use these to verify that you are modeling the desired level. If you mistakenly model the nonevent level, the odds ratio will be the reciprocal of what you want.
In the EVENT= option, specify the response level representing the event of interest within quotes whether the response variable is numeric or character. If the response variable is formatted, specify the formatted value of the event level. Without the EVENT= option, by default, PROC LOGISTIC models the probability of the response assigned Ordered Value 1 in the "Response Profile" table.
For details and an example, see this note.
Inverted order of a CLASS predictor
When a predictor is not in the CLASS statement, it is treated as continuous and its odds ratio is the change in odds for a unit increase in the predictor. For a continuous predictor like Age (in years), the odds ratio is the change in odds for a one year increase in age. Now suppose you have a binary predictor, Gender, with values 0 (female) and 1 (male), and Gender is not in the CLASS statement. The odds ratio for Gender is the odds for males over the odds for females. When Gender is in the CLASS statement, the label of the odds ratio in the "Odds Ratio Estimates" table tells you the interpretation. For instance, the label "Gender 0 vs 1" tells you it is the odds for females over the odds for males. However, if you specify:
class Gender (ref="0") / param=ref;
then the dummy variable created for Gender would be identical to the Gender variable itself (as you can see in the "Class Level Information" table) and the odds ratio would be the same as without the CLASS statement.
Example
These statements create the data for a 2×2 table with predictor X and response Y, both coded as 0 and 1. Suppose that Y=1 represents the event of interest, and X=1 indicates exposure to a treatment.
data a;
do x=1,0;
do y=1,0;
input f @@; output;
end; end;
datalines;
8 19
23 12
;
The table is shown by PROC FREQ. The desired odds ratio is the odds of Y=1 in the X=1 group compared to the odds in the X=0 group, which is computed as (8/19)/(23/12) = 0.22. Because the table is arranged with Y=1 as the first column and X=1 as the first row, the odds ratio reported by the RELRISK option is the above calculation.
proc freq order=data;
weight f;
table x*y / nocol norow nopercent relrisk;
run;
0.2197 |
0.0745 |
0.6478 |
0.4509 |
0.2405 |
0.8454 |
2.0525 |
1.2204 |
3.4519 |
|
In PROC LOGISTIC, you need to specify that Y=1 is the event category in order to calculate the odds of Y=1 in each group instead of the odds of Y=0. To be certain you are modeling the desired response level, you should always use the EVENT= option when fitting a logistic model with a binary response. As long as the predictor, X, is coded numerically with a one unit difference between the levels, then entering it as a continuous variable provides the above calculation. A predictor not in the CLASS statement is treated as continuous. This is shown in the first PROC LOGISTIC step.
proc logistic;
freq f;
model y(event="1")=x;
run;
Probability modeled is y=1.
|
The odds ratio is inverted if you model the nonevent level (Y=0) of the response which will happen in this example if you omit the EVENT= option.
proc logistic;
freq f;
model y=x;
run;
Probability modeled is y=0.
|
If X is to be treated as a categorical variable by specifying it in the CLASS statement, it is important that the dummy variable created by the CLASS statement representing X have its high value correspond with the high value of X. If a coding is used that associates the high dummy value with the low original value, then the odds ratio will estimate the odds of the low group (X=0) over the high group (X=1), inverting the odds ratio. This is illustrated by the last two PROC LOGISTIC steps. In the first, the REF="0" and PARAM=REF options create a dummy variable that reproduces X as seen in the "Class Level Information" table. In the "Odds Ratio Estimates" table, note the label "x 1 vs 0" which tells you that the odds of group X=1 is in the numerator.
proc logistic;
freq f;
class x (ref="0") / param=ref;
model y(event="1")=x;
run;
In the second step, the default dummy variable coding reverses the order of the levels — the high dummy value (1) is associated with the low original value (0). In the "Odds Ratio Estimates" table, the label "x 0 vs 1" tells you that the odds of group X=0 is in the numerator, so you are estimating the reciprocal of the desired odds ratio.
proc logistic;
freq f;
class x;
model y(event="1")=x;
run;
Operating System and Release Information
SAS System | SAS/STAT | z/OS | | |
OpenVMS VAX | | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | | |
Microsoft Windows XP 64-bit Edition | | |
Microsoft® Windows® for x64 | | |
OS/2 | | |
Microsoft Windows 95/98 | | |
Microsoft Windows 2000 Advanced Server | | |
Microsoft Windows 2000 Datacenter Server | | |
Microsoft Windows 2000 Server | | |
Microsoft Windows 2000 Professional | | |
Microsoft Windows NT Workstation | | |
Microsoft Windows Server 2003 Datacenter Edition | | |
Microsoft Windows Server 2003 Enterprise Edition | | |
Microsoft Windows Server 2003 Standard Edition | | |
Microsoft Windows Server 2008 | | |
Microsoft Windows XP Professional | | |
Windows 7 Enterprise 32 bit | | |
Windows 7 Enterprise x64 | | |
Windows 7 Home Premium 32 bit | | |
Windows 7 Home Premium x64 | | |
Windows 7 Professional 32 bit | | |
Windows 7 Professional x64 | | |
Windows 7 Ultimate 32 bit | | |
Windows 7 Ultimate x64 | | |
Windows Millennium Edition (Me) | | |
Windows Vista | | |
64-bit Enabled AIX | | |
64-bit Enabled HP-UX | | |
64-bit Enabled Solaris | | |
ABI+ for Intel Architecture | | |
AIX | | |
HP-UX | | |
HP-UX IPF | | |
IRIX | | |
Linux | | |
Linux for x64 | | |
Linux on Itanium | | |
OpenVMS Alpha | | |
OpenVMS on HP Integrity | | |
Solaris | | |
Solaris for x64 | | |
Tru64 UNIX | | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.