OR and CI

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

OR and CI

Parvaneh Sharafi
Hi everyone,
I am using the MacNemar  for two related samples in non-parametric tests and I need the Odds Ratio and Confidence Interval values. I do get the frequency table and sig. level but I do need OR and CI for each analysis.
Does anyone know how can I get the OR and CI in Mac Nemar analysis?
Best regards!
Parie

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: OR and CI

Marta Garcia-Granero
Parvaneh Sharafi wrote:
> I am using the MacNemar  for two related samples in non-parametric tests and I need the Odds Ratio and Confidence Interval values. I do get the frequency table and sig. level but I do need OR and CI for each analysis.
> Does anyone know how can I get the OR and CI in Mac Nemar analysis?
>
I have a MACRO for that task:

DEFINE PAIREDOR (!POSITIONAL !TOKENS(1)/!POSITIONAL !TOKENS(1)).
DATASET NAME Datos.
DATASET COPY Duplicado WINDOW=FRONT.
SORT CASES BY !1(A) !2(A).
AGGREGATE
  /OUTFILE=*
  /BREAK=!1 !2
  /N=n.
DATASET DECLARE Resultados1 WINDOW=HIDDEN.
DATASET DECLARE Resultados2 WINDOW=HIDDEN.
PRESERVE.
SET ERRORS=NONE RESULTS=NONE.
MATRIX.
GET obs /VAR=n .
COMPUTE a=obs(1).
COMPUTE b=obs(2).
COMPUTE c=obs(3).
COMPUTE d=obs(4).
RELEASE obs.
COMPUTE chi2=((b-c)&**2)&/(b+c).
COMPUTE chi2sig=1-CHICDF(chi2,1).
COMPUTE chi2cor=(ABS(b-c)-1)&**2&/(b+c).
COMPUTE chi2sigc=1-CHICDF(chi2cor,1).
COMPUTE orr=b/c.
COMPUTE seorr=SQRT(1/b+1/c).
COMPUTE loworr=orr*EXP(-1.96*seorr).
COMPUTE upporr=orr*EXP(1.96*seorr).
COMPUTE vnames={'Chi2','Sig'}.
SAVE {chi2,chi2sig;chi2cor,chi2sigc} /OUTFILE=Resultados1 /NAMES=vnames.
COMPUTE vnames={'OddsR','Inferior','Superior'}.
SAVE {orr,loworr,upporr} /OUTFILE=Resultados2 /NAMES=vnames.
END MATRIX.
RESTORE.
OMS /SELECT TABLES
 /IF COMMANDS='Summarize' SUBTYPES='Case Processing Summary'
 /DESTINATION VIEWER=NO.
DATASET ACTIVATE Resultados1.
FORMAT chi2(F8.3) Sig (F8.4).
VAR LABEL chi2 'Chi²'/ Sig 'Sig.'.
STRING Test (A12).
IF ($casenum EQ 1) Test = 'Uncorrected' .
IF ($casenum EQ 2) Test = 'Corrected' .
SUMMARIZE
 /TABLES=Test chi2 Sig
 /FORMAT=LIST NOCASENUM NOTOTAL
 /TITLE='Mcnemar Chi-square tests'
 /CELLS=NONE.
DATASET ACTIVATE Resultados2.
DATASET CLOSE Resultados1.
FORMAT OddsR TO Superior (F8.2).
VAR LABEL OddsR 'OR (McNemar)'.
SUMMARIZE
 /TABLES=ALL
 /FORMAT=LIST NOCASENUM NOTOTAL
 /TITLE='OR & 95%CI (*)'
 /CELLS=NONE.
OMSEND.
DATASET ACTIVATE Duplicado.
DATASET CLOSE Resultados2.
DATASET ACTIVATE Datos.
DATASET CLOSE Duplicado.
ECHO '(*) Asymptotic'.
!ENDDEFINE.

* Sample dataset (aggregated, but the macro works OK with "normal"
datasets) *.
DATA LIST LIST/LowWeight NormalWeight frequency (3 F8).
BEGIN DATA
1    1    8
1    2    22
2    1    8
2    2    18
END DATA.

VAR LABEL LowWeight 'Low weight baby mother'/
          NormalWeight 'Normal weight baby mother'.
VAL LABEL LowWeight NormalWeight 1'smoker' 2'non smoker'.
WEIGHT BY frequency.

* Macro call (replace LowWeight&NormalWeight with your variables) *.
PAIREDOR LowWeight NormalWeight.


Marta

--
For miscellaneous statistical stuff, visit:
http://gjyp.nl/marta/

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: OR and CI

Marta Garcia-Granero
Parvaneh Sharafi wrote (private mail):
>
> - Sorry, I forgot to tell you that I do not use syntaxes.
>
Then you don't know what you are missing... I'd dare say you are only
using 10% of SPSS capabilities.

Ok, let's switch to plan B: use Winpepi (PAIRSETC.exe), it works with
tabulated data, all you have to input is the 4 cells of the frequency
table (from SPSS output). You can download it from:

http://www.brixtonhealth.com/pepi4windows.html

It's freeware, BTW.

Marta


> > Parvaneh Sharafi wrote:
> > > I am using the MacNemar for two related samples in non-
> > parametric tests and I need the Odds Ratio and Confidence Interval
> > values. I do get the frequency table and sig. level but I do need
> > OR and CI for each analysis.
> > > Does anyone know how can I get the OR and CI in Mac Nemar analysis?
> > >
> > I have a MACRO for that task:
> >
> > DEFINE PAIREDOR (!POSITIONAL !TOKENS(1)/!POSITIONAL !TOKENS(1)).
> > DATASET NAME Datos.
> > DATASET COPY Duplicado WINDOW=FRONT.
> > SORT CASES BY !1(A) !2(A).
> > AGGREGATE
> > /OUTFILE=*
> > /BREAK=!1 !2
> > /N=n.
> > DATASET DECLARE Resultados1 WINDOW=HIDDEN.
> > DATASET DECLARE Resultados2 WINDOW=HIDDEN.
> > PRESERVE.
> > SET ERRORS=NONE RESULTS=NONE.
> > MATRIX.
> > GET obs /VAR=n .
> > COMPUTE a=obs(1).
> > COMPUTE b=obs(2).
> > COMPUTE c=obs(3).
> > COMPUTE d=obs(4).
> > RELEASE obs.
> > COMPUTE chi2=((b-c)&**2)&/(b+c).
> > COMPUTE chi2sig=1-CHICDF(chi2,1).
> > COMPUTE chi2cor=(ABS(b-c)-1)&**2&/(b+c).
> > COMPUTE chi2sigc=1-CHICDF(chi2cor,1).
> > COMPUTE orr=b/c.
> > COMPUTE seorr=SQRT(1/b+1/c).
> > COMPUTE loworr=orr*EXP(-1.96*seorr).
> > COMPUTE upporr=orr*EXP(1.96*seorr).
> > COMPUTE vnames={'Chi2','Sig'}.
> > SAVE {chi2,chi2sig;chi2cor,chi2sigc} /OUTFILE=Resultados1
> > /NAMES=vnames.COMPUTE vnames={'OddsR','Inferior','Superior'}.
> > SAVE {orr,loworr,upporr} /OUTFILE=Resultados2 /NAMES=vnames.
> > END MATRIX.
> > RESTORE.
> > OMS /SELECT TABLES
> > /IF COMMANDS='Summarize' SUBTYPES='Case Processing Summary'
> > /DESTINATION VIEWER=NO.
> > DATASET ACTIVATE Resultados1.
> > FORMAT chi2(F8.3) Sig (F8.4).
> > VAR LABEL chi2 'Chi²'/ Sig 'Sig.'.
> > STRING Test (A12).
> > IF ($casenum EQ 1) Test = 'Uncorrected' .
> > IF ($casenum EQ 2) Test = 'Corrected' .
> > SUMMARIZE
> > /TABLES=Test chi2 Sig
> > /FORMAT=LIST NOCASENUM NOTOTAL
> > /TITLE='Mcnemar Chi-square tests'
> > /CELLS=NONE.
> > DATASET ACTIVATE Resultados2.
> > DATASET CLOSE Resultados1.
> > FORMAT OddsR TO Superior (F8.2).
> > VAR LABEL OddsR 'OR (McNemar)'.
> > SUMMARIZE
> > /TABLES=ALL
> > /FORMAT=LIST NOCASENUM NOTOTAL
> > /TITLE='OR & 95%CI (*)'
> > /CELLS=NONE.
> > OMSEND.
> > DATASET ACTIVATE Duplicado.
> > DATASET CLOSE Resultados2.
> > DATASET ACTIVATE Datos.
> > DATASET CLOSE Duplicado.
> > ECHO '(*) Asymptotic'.
> > !ENDDEFINE.
> >
> > * Sample dataset (aggregated, but the macro works OK with "normal"
> > datasets) *.
> > DATA LIST LIST/LowWeight NormalWeight frequency (3 F8).
> > BEGIN DATA
> > 1 1 8
> > 1 2 22
> > 2 1 8
> > 2 2 18
> > END DATA.
> >
> > VAR LABEL LowWeight 'Low weight baby mother'/
> > NormalWeight 'Normal weight baby mother'.
> > VAL LABEL LowWeight NormalWeight 1'smoker' 2'non smoker'.
> > WEIGHT BY frequency.
> >
> > * Macro call (replace LowWeight&NormalWeight with your variables) *.
> > PAIREDOR LowWeight NormalWeight.
> >
>
--

For miscellaneous statistical stuff, visit:
http://gjyp.nl/marta/

=====================
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