Login  Register

Re: Odds Ratio - Adjusted OR

Posted by Ryan on Dec 14, 2011; 3:18am
URL: http://spssx-discussion.165.s1.nabble.com/Odds-Ratio-Adjusted-OR-tp5065253p5073430.html

Perhaps this example (I just made up) will help the OP...

Directions for the OP: Open SPSS. Go to the drop down menu and click File-->New-->Syntax. Copy the code below my name in this post and paste it into the new syntax file. Then go back to the drop down menu and click Run-->All. 

You will see that the odds ratio produced by CROSSTABS equals the "Exp(B)" for "group(1)" value produced by the LOGISTIC REGRESSION procedure. 

Note that the odds ratio of interest is calculated by: 

odds(cancer|smoker) / odds(no cancer|non-smoker)

where

odds(cancer|smoker) = 

pr(cancer|smoker) / pr(no cancer|smoker)

and
 
odds(cancer|non-smoker) = 

pr(cancer|non-smoker) / pr(no cancer|non-smoker)

Ryan

set seed 9876452.

new file.
inp pro.

loop ID= 1 to 1000.

   comp p1 = 0.65.
   comp p2 = 0.45

   comp logodds1 = ln(p1/(1-p1)).
   comp logodds2 = ln(p2/(1-p2)).

   comp b0 = logodds2.
   comp b1 = logodds1 - logodds2.

   comp group = rv.bernoulli(0.5).

   comp eta = b0 + b1*(group=0).
   comp p = exp(eta) / (1+exp(eta)).
   comp y1 = rv.bernoulli(p).

   end case.
 end loop.
end file.
end inp pro.
exe.

delete variables p1
p2
logodds1
logodds2
b0
b1
eta
p.

RECODE y1 (0=1) (1=0) INTO y2.
EXECUTE.

VALUE LABELS y1 1 'cancer' 0 'no cancer' / y2 1 'no cancer' 0 'cancer' / group 0 'smoker' 1 'non-smoker'.

CROSSTABS
  /TABLES=group BY y2
  /FORMAT=AVALUE TABLES
  /STATISTICS=CHISQ RISK 
  /CELLS=COUNT ROW
  /COUNT ROUND CELL.

LOGISTIC REGRESSION VARIABLES y1
  /METHOD=ENTER group 
  /CONTRAST (group)=Indicator
  /CRITERIA=PIN(.05) POUT(.10) ITERATE(20) CUT(.5).

On Tue, Dec 13, 2011 at 8:11 PM, David Marso <[hidden email]> wrote:
Perhaps you would be so kind as to do yourself a favor (and potential
respondents) by posting the actual crosstab of the problematic situation
(along with SYNTAX to reproduce the ?anomalous? results)!
"The output given by SPSS is wrong via logistic regression."
GRRRRRR!  If this were the case, the proverbial shitstorm would have hit a
LONG time ago!
Please post your tables and most importantly the syntax. It is likely a very
simple misunderstanding on your part re what is being calculated .
HTH, David


John wrote
>
> Khanwer, For some reason when I do the ORs for each of the IV using
> logistic regression, the results are inverse. For example, for Alcohol vs
> cigarette smoking (without using any other variable), I am getting 0.38 as
> opposed to the 2.74 OR obtained by conventional 2x2 cross tabs. In the
> cross tabs, I have dependent variable in columns and independent in the
> rows. I am doing exactly what I am describing here. I am describing the
> most basic thing in statistics so that you can be confident that I am not
> committing basic errors. I don't think I am doing anything wrong. I
> explained the logistic regression procedure step by step in detail in my
> 1st post of the thread. It is definitely not confounding in this case. The
> output given by SPSS is wrong via logistic regression. I need to verify
> with SAS and find out why the SPSS output is wrong.
>
> I changed the reference categories to first now as opposed to the
> reference categories being last. The OR (when I use individual DV vs IV)
> AOR (when I use DV vs multiple IVs) outputs come closer to the "desired"
> results. It seems to be ExpB is the inverse of the OR and AOR. No?
>
> SPSS masters, Clarify this doubt to me. In SPSS, using logistic regression
> does ExpB = AOR? I think at this point, my question is simple. I need to
> know what ExpB is!
>
> Did anyone have the same problem with SPSS?
>
> You may say my coding is wrong (inverse) as in yes for no and no for yes.
> If coding is wrong, then the results should be consistent when I use cross
> tabs also. Nah!
>
> John
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> LISTSERV@.UGA (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>


--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Odds-Ratio-Adjusted-OR-tp5065253p5073222.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD