Re: No chi-square value in McNemar test output?
Posted by
Kirill Orlov on
Jun 08, 2016; 10:05am
URL: http://spssx-discussion.165.s1.nabble.com/No-chi-square-value-in-McNemar-test-output-tp1080750p5732342.html
Hi, Marta.
What are you saying? Are you saying WRITE or SAVE statements of
MATRIX session are not working on Windows 8/10?! Or something else?
08.06.2016 12:50, Marta Garcia-Granero
пишет:
Hi:
Since WIndows 7, SPSS can't write files from MATRIX. Either try to
run SPSS with administrator permissions, or use this simplified
version of the macro.
Best regards,
Marta GG
DEFINE MyMcNemar(!POSITIONAL !TOKENS(1) /!POSITIONAL
!TOKENS(1)/!POSITIONAL !TOKENS(1)/!POSITIONAL !TOKENS(1)).
MATRIX.
COMPUTE nanb=!1 .
COMPUTE napb=!2 .
COMPUTE panb=!3 .
COMPUTE papb=!4 .
COMPUTE a=nanb.
COMPUTE b=napb.
COMPUTE c=panb.
COMPUTE d=papb.
COMPUTE perc={(c+d)/(a+b+c+d);(b+d)/(a+b+c+d)}.
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 z = 1.959964.
COMPUTE zsq = 1.959964*1.959964.
COMPUTE x5=papb+panb.
COMPUTE x6=napb+nanb.
COMPUTE x7=papb+napb.
COMPUTE x8=panb+nanb.
COMPUTE x9=x7+x8.
COMPUTE x10=(panb-napb)/x9.
COMPUTE x11=2*x5+zsq.
COMPUTE x12=z&*(zsq+4*x5&*x6/x9)&**0.5.
COMPUTE x13=2*(x9+zsq).
COMPUTE x14=(x11+x12)/x13.
COMPUTE x15=(x11-x12)/x13.
COMPUTE x16=x5/x9-x15.
COMPUTE x17=x14-x5/x9.
COMPUTE x21=2*x7+zsq.
COMPUTE x22=z&*(zsq+4*x7&*x8/x9)&**0.5.
COMPUTE x24=(x21+x22)/x13.
COMPUTE x25=(x21-x22)/x13.
COMPUTE x26=x7/x9-x25.
COMPUTE x27=x24-x7/x9.
COMPUTE x29=x5&*x6&*x7&*x8.
COMPUTE x30=1.
DO IF x29 EQ 0.
- COMPUTE x30=0.
END IF.
COMPUTE x31=papb&*nanb-panb&*napb.
COMPUTE x32=0.
DO IF (x31 GT 0).
- COMPUTE x32=1.
END IF.
COMPUTE x33=x31-x9/2.
COMPUTE x35=0.
DO IF (x33 GT 0).
- COMPUTE x35=x33.
END IF.
COMPUTE x36=x32&*x35+(1-x32)&*x31.
COMPUTE x37=x30&*x36.
COMPUTE x38=x30&*x29&**0.5+(1-x30).
COMPUTE x39=x37/x38. /* phi hat.
COMPUTE x40=x16&*x16-2*x39&*x16&*x27+x27&*x27.
COMPUTE x41=x17&*x17-2*x39&*x17&*x26+x26&*x26.
COMPUTE x42=x10-SQRT(x40).
COMPUTE x43=x10+SQRT(x41).
COMPUTE orr=panb/napb.
COMPUTE se_orr=SQRT(1/panb+1/napb).
COMPUTE low_orr=orr*EXP(-z*se_orr).
COMPUTE upp_orr=orr*EXP(z*se_orr).
PRINT /TITLE="MCNEMAR CHI-SQUARE TESTS AND RELATED STATISTICS".
PRINT {chi2,chi2sig;chi2cor,chi2sigc}
/TITLE="CHI-SQUARE TESTS (ASYMPTOTIC)"
/FORMAT="F8.3"
/RLABELS="Uncorr.","Corr."
/CLABELS="Stat.","Sig.".
PRINT {100*T(perc),100*x10,100*x42,100*x43}
/TITLE="PERCENTAGES, DIFFERENCE & 95%CI FOR DIFFERENCE
(NEWCOMBE'S METHOD #10)"
/FORMAT="F8.2"
/CLABELS="p(A)","p(B)","Diff.","Lower","Upper".
PRIINT{orr,low_orr,upp_orr}
/TITLE="MCNEMAR'S ODDS-RATIO & 95CI (ASYMPTOTIC)"
/FORMAT="F8.2"
/CLABELS="OR","Lower","Upper".
END MATRIX.
!ENDDEFINE.
MyMcNemar 20 12 2 15.
El 08/06/2016 a las 10:47, Mieke escribió:
Hi all
I'm trying the McNemar Macro of Marta in SPSS 22 but get an
error every
time.. (in command name, is not recognized and in end of command
of Define)
Does anyone know how to solve this problem?
<http://spssx-discussion.1045642.n5.nabble.com/file/n5732339/Mcnemar_macro_error.jpg>
Thanks in advance!
Mieke (student)
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/No-chi-square-value-in-McNemar-test-output-tp1080750p5732339.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
=====================
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
=====================
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