|
Hi All,
I am not very familiar with matrix commands, and I need to modify the following output to include more significant digits. Run MATRIX procedure: White's (Large Sample) Corrected Standard Errors CONSTANT 3.E-001 Age 7.E-004 LnTotalE 1.E-002 SIC_AB 2.E-001 SIC_C 2.E-001 SIC_D 2.E-001 SIC_E 2.E-001 SIC_F 2.E-001 SIC_G 2.E-001 SIC_H 2.E-001 SIC_I 2.E-001 o3 3.E-002 RKnow 5.E-002 Formal_D 2.E-002 Rn14 6.E-002 SubDM 4.E-002 TempDM 4.E-002 The code I ran is from Pryce's (2002) correction for heteroscedasticity (the document that's posted on Raynald's web site). I did not type it, I copied and pasted it directly from his document. I don't know why I'm getting output that looks like this. I've looked at the code, but I don't see anything that might cause this. For convenience, I'll paste the code after the sig. block. Also, I checked my SPSS draft viewer options, but I didn't see anything that's obviously wrong. Can someone please help? Thanks in advance. Best, Lisa Lisa T. Stickney Ph.D. Candidate Fox School of Business Temple University [hidden email] MATRIX. GET Y / VARIABLES = PerfOrg . GET X / VARIABLES = CONSTANT, Age LnTotalEEs SIC_AB SIC_C SIC_D SIC_E SIC_F SIC_G SIC_H SIC_I o3 RKnow Formal_Doc Rn14 SubDM TempDM / NAMES = XTITLES. GET RESIDUAL / VARIABLES = RES_1. GET ESQ / VARIABLES = ESQ. COMPUTE XRTITLES = TRANSPOS(XTITLES). COMPUTE N = NROW(ESQ). COMPUTE K = NCOL(X). COMPUTE O = MDIAG(ESQ). COMPUTE WHITEV = (INV(TRANSPOS(X) * X)) *TRANSPOS(X)* O * X*INV(TRANSPOS(X) * X). COMPUTE WDIAG = DIAG(WHITEV). COMPUTE WHITE_SE = SQRT(WDIAG). PRINT WHITE_SE / FORMAT = "E13" / TITLE = "White's (Large Sample) Corrected Standard Errors" / RNAMES = XRTITLES. COMPUTE B = (INV(TRANSPOS(X) * X)) * (TRANSPOS(X) * Y). PRINT B / FORMAT = "E13" /TITLE = "OLS Coefficients" / RNAMES = XRTITLES. COMPUTE WT_VAL = B / WHITE_SE. PRINT WT_VAL / FORMAT = "E13" / TITLE = "t-values based on Whites (large sample) corrected SEs" / RNAMES = XRTITLES. COMPUTE SIG_WT = 2*(1- TCDF(ABS(WT_VAL), N)) . PRINT SIG_WT / FORMAT = "E13" / TITLE = "Prob(t < tc) based on Whites (large n) SEs" / RNAMES = XRTITLES. COMPUTE SIGMASQ = (TRANSPOS(RESIDUAL)*RESIDUAL)/(N-K). COMPUTE SE_SQ = SIGMASQ*INV(TRANSPOS(X)*X). COMPUTE SESQ_ABS = ABS(SE_SQ). COMPUTE SE = SQRT(DIAG(SESQ_ABS)). PRINT SE / FORMAT = "E13" / TITLE = "OLS Standard Errors" / RNAMES = XRTITLES. COMPUTE OLST_VAL = B / SE. PRINT OLST_VAL / FORMAT = "E13" / TITLE = "OLS t-values" / RNAMES = XRTITLES. COMPUTE SIG_OLST = 2*(1- TCDF(ABS(OLST_VAL), N)) . PRINT SIG_OLST / FORMAT = "E13" / TITLE = "Prob(t < tc) based on OLS SEs" / RNAMES = XRTITLES. COMPUTE WESTIM = {B, SE, WHITE_SE, WT_VAL, SIG_WT}. PRINT WESTIM / FORMAT = "E13" / RNAMES = XRTITLES / CLABELS = B, SE, WHITE_SE, WT_VAL, SIG_WT. END MATRIX. ====================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 |
|
Hi Lisa
Replace every / FORMAT = "E13" By a more convenient format. For instance, by: / FORMAT = "F8.4" If you want 4 significant digits, and by: / FORMAT = "F10.6" If you want 6 digits. You can also turn the code into a macro and pass the format as an argument. I have some macros that could be used as an example, if you are interested. Regards, Marta García-Granero Lisa Stickney escribió: > Hi All, > > I am not very familiar with matrix commands, and I need to modify the following output to include more significant digits. > > Run MATRIX procedure: > > > > White's (Large Sample) Corrected Standard Errors > > CONSTANT 3.E-001 > > Age 7.E-004 > > LnTotalE 1.E-002 > > SIC_AB 2.E-001 > > SIC_C 2.E-001 > > SIC_D 2.E-001 > > SIC_E 2.E-001 > > SIC_F 2.E-001 > > SIC_G 2.E-001 > > SIC_H 2.E-001 > > SIC_I 2.E-001 > > o3 3.E-002 > > RKnow 5.E-002 > > Formal_D 2.E-002 > > Rn14 6.E-002 > > SubDM 4.E-002 > > TempDM 4.E-002 > > > > > > The code I ran is from Pryce's (2002) correction for heteroscedasticity (the document that's posted on Raynald's web site). I did not type it, I copied and pasted it directly from his document. I don't know why I'm getting output that looks like this. I've looked at the code, but I don't see anything that might cause this. For convenience, I'll paste the code after the sig. block. > > > > Also, I checked my SPSS draft viewer options, but I didn't see anything that's obviously wrong. Can someone please help? Thanks in advance. > > > > Best, > > Lisa > > > > Lisa T. Stickney > > Ph.D. Candidate > > Fox School of Business > > Temple University > > [hidden email] > > > > > > > > MATRIX. > > GET Y / VARIABLES = PerfOrg . > > GET X / VARIABLES = CONSTANT, Age LnTotalEEs SIC_AB SIC_C SIC_D SIC_E SIC_F SIC_G SIC_H SIC_I > > o3 RKnow Formal_Doc Rn14 SubDM TempDM > > / NAMES = XTITLES. > > GET RESIDUAL / VARIABLES = RES_1. > > GET ESQ / VARIABLES = ESQ. > > COMPUTE XRTITLES = TRANSPOS(XTITLES). > > COMPUTE N = NROW(ESQ). > > COMPUTE K = NCOL(X). > > COMPUTE O = MDIAG(ESQ). > > COMPUTE WHITEV = (INV(TRANSPOS(X) * X)) *TRANSPOS(X)* O * > > X*INV(TRANSPOS(X) * X). > > COMPUTE WDIAG = DIAG(WHITEV). > > COMPUTE WHITE_SE = SQRT(WDIAG). > > PRINT WHITE_SE > > / FORMAT = "E13" > > / TITLE = "White's (Large Sample) Corrected Standard Errors" > > / RNAMES = XRTITLES. > > COMPUTE B = (INV(TRANSPOS(X) * X)) * (TRANSPOS(X) * Y). > > PRINT B > > / FORMAT = "E13" > > /TITLE = "OLS Coefficients" > > / RNAMES = XRTITLES. > > COMPUTE WT_VAL = B / WHITE_SE. > > PRINT WT_VAL > > / FORMAT = "E13" > > / TITLE = "t-values based on Whites (large sample) corrected SEs" > > / RNAMES = XRTITLES. > > COMPUTE SIG_WT = 2*(1- TCDF(ABS(WT_VAL), N)) . > > PRINT SIG_WT > > / FORMAT = "E13" > > / TITLE = "Prob(t < tc) based on Whites (large n) SEs" > > / RNAMES = XRTITLES. > > COMPUTE SIGMASQ = (TRANSPOS(RESIDUAL)*RESIDUAL)/(N-K). > > COMPUTE SE_SQ = SIGMASQ*INV(TRANSPOS(X)*X). > > COMPUTE SESQ_ABS = ABS(SE_SQ). > > COMPUTE SE = SQRT(DIAG(SESQ_ABS)). > > PRINT SE > > / FORMAT = "E13" > > / TITLE = "OLS Standard Errors" > > / RNAMES = XRTITLES. > > COMPUTE OLST_VAL = B / SE. > > PRINT OLST_VAL > > / FORMAT = "E13" > > / TITLE = "OLS t-values" > > / RNAMES = XRTITLES. > > COMPUTE SIG_OLST = 2*(1- TCDF(ABS(OLST_VAL), N)) . > > PRINT SIG_OLST > > / FORMAT = "E13" > > / TITLE = "Prob(t < tc) based on OLS SEs" > > / RNAMES = XRTITLES. > > > > COMPUTE WESTIM = {B, SE, WHITE_SE, WT_VAL, SIG_WT}. > > PRINT WESTIM > > / FORMAT = "E13" > > / RNAMES = XRTITLES > > / CLABELS = B, SE, WHITE_SE, WT_VAL, SIG_WT. > > END MATRIX. > > > > =================== > 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 |
|
Perfect! My thanks to all who replied.
And yes, Marta, I would be interested in a macro to use as an exemplar. Best, Lisa ----- Original Message ----- From: "Marta García-Granero" <[hidden email]> To: <[hidden email]> Sent: Monday, January 21, 2008 3:40 AM Subject: Re: Help with Matrix output > Hi Lisa > > Replace every > > / FORMAT = "E13" > > > By a more convenient format. For instance, by: > > / FORMAT = "F8.4" > > > If you want 4 significant digits, and by: > > / FORMAT = "F10.6" > > > If you want 6 digits. > > You can also turn the code into a macro and pass the format as an > argument. I have some macros that could be used as an example, if you > are interested. > > Regards, > Marta García-Granero > > > Lisa Stickney escribió: >> Hi All, >> >> I am not very familiar with matrix commands, and I need to modify the >> following output to include more significant digits. >> >> Run MATRIX procedure: >> >> >> >> White's (Large Sample) Corrected Standard Errors >> >> CONSTANT 3.E-001 >> >> Age 7.E-004 >> >> LnTotalE 1.E-002 >> >> SIC_AB 2.E-001 >> >> SIC_C 2.E-001 >> >> SIC_D 2.E-001 >> >> SIC_E 2.E-001 >> >> SIC_F 2.E-001 >> >> SIC_G 2.E-001 >> >> SIC_H 2.E-001 >> >> SIC_I 2.E-001 >> >> o3 3.E-002 >> >> RKnow 5.E-002 >> >> Formal_D 2.E-002 >> >> Rn14 6.E-002 >> >> SubDM 4.E-002 >> >> TempDM 4.E-002 >> >> >> >> >> >> The code I ran is from Pryce's (2002) correction for heteroscedasticity >> (the document that's posted on Raynald's web site). I did not type it, I >> copied and pasted it directly from his document. I don't know why I'm >> getting output that looks like this. I've looked at the code, but I don't >> see anything that might cause this. For convenience, I'll paste the code >> after the sig. block. >> >> >> >> Also, I checked my SPSS draft viewer options, but I didn't see anything >> that's obviously wrong. Can someone please help? Thanks in advance. >> >> >> >> Best, >> >> Lisa >> >> >> >> Lisa T. Stickney >> >> Ph.D. Candidate >> >> Fox School of Business >> >> Temple University >> >> [hidden email] >> >> >> >> >> >> >> >> MATRIX. >> >> GET Y / VARIABLES = PerfOrg . >> >> GET X / VARIABLES = CONSTANT, Age LnTotalEEs SIC_AB SIC_C SIC_D SIC_E >> SIC_F SIC_G SIC_H SIC_I >> >> o3 RKnow Formal_Doc Rn14 SubDM TempDM >> >> / NAMES = XTITLES. >> >> GET RESIDUAL / VARIABLES = RES_1. >> >> GET ESQ / VARIABLES = ESQ. >> >> COMPUTE XRTITLES = TRANSPOS(XTITLES). >> >> COMPUTE N = NROW(ESQ). >> >> COMPUTE K = NCOL(X). >> >> COMPUTE O = MDIAG(ESQ). >> >> COMPUTE WHITEV = (INV(TRANSPOS(X) * X)) *TRANSPOS(X)* O * >> >> X*INV(TRANSPOS(X) * X). >> >> COMPUTE WDIAG = DIAG(WHITEV). >> >> COMPUTE WHITE_SE = SQRT(WDIAG). >> >> PRINT WHITE_SE >> >> / FORMAT = "E13" >> >> / TITLE = "White's (Large Sample) Corrected Standard Errors" >> >> / RNAMES = XRTITLES. >> >> COMPUTE B = (INV(TRANSPOS(X) * X)) * (TRANSPOS(X) * Y). >> >> PRINT B >> >> / FORMAT = "E13" >> >> /TITLE = "OLS Coefficients" >> >> / RNAMES = XRTITLES. >> >> COMPUTE WT_VAL = B / WHITE_SE. >> >> PRINT WT_VAL >> >> / FORMAT = "E13" >> >> / TITLE = "t-values based on Whites (large sample) corrected SEs" >> >> / RNAMES = XRTITLES. >> >> COMPUTE SIG_WT = 2*(1- TCDF(ABS(WT_VAL), N)) . >> >> PRINT SIG_WT >> >> / FORMAT = "E13" >> >> / TITLE = "Prob(t < tc) based on Whites (large n) SEs" >> >> / RNAMES = XRTITLES. >> >> COMPUTE SIGMASQ = (TRANSPOS(RESIDUAL)*RESIDUAL)/(N-K). >> >> COMPUTE SE_SQ = SIGMASQ*INV(TRANSPOS(X)*X). >> >> COMPUTE SESQ_ABS = ABS(SE_SQ). >> >> COMPUTE SE = SQRT(DIAG(SESQ_ABS)). >> >> PRINT SE >> >> / FORMAT = "E13" >> >> / TITLE = "OLS Standard Errors" >> >> / RNAMES = XRTITLES. >> >> COMPUTE OLST_VAL = B / SE. >> >> PRINT OLST_VAL >> >> / FORMAT = "E13" >> >> / TITLE = "OLS t-values" >> >> / RNAMES = XRTITLES. >> >> COMPUTE SIG_OLST = 2*(1- TCDF(ABS(OLST_VAL), N)) . >> >> PRINT SIG_OLST >> >> / FORMAT = "E13" >> >> / TITLE = "Prob(t < tc) based on OLS SEs" >> >> / RNAMES = XRTITLES. >> >> >> >> COMPUTE WESTIM = {B, SE, WHITE_SE, WT_VAL, SIG_WT}. >> >> PRINT WESTIM >> >> / FORMAT = "E13" >> >> / RNAMES = XRTITLES >> >> / CLABELS = B, SE, WHITE_SE, WT_VAL, SIG_WT. >> >> END MATRIX. >> >> >> >> =================== >> 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 |
|
Lisa Stickney escribió:
> Perfect! My thanks to all who replied. > > And yes, Marta, I would be interested in a macro to use as an exemplar. Sorry for the delay, I dind't remember I had updated all my macros to SPSS 15, and eliminated direct MATRIX output in all of them (replaced it by an exported secondary file printed with REPORT, it looks nicer, and yes, I can send you another example macro): * Sample dataset *. DATA LIST LIST/a1 TO a5. BEGIN DATA 1.1 2.1 3.5 4.3 5.8 6.8 7.5 9.0 5.3 1.8 7.7 8.5 6.9 4.1 3.3 END DATA. * Short macro showing how to pass the output format to MATRIX as an argument *. DEFINE MyCode(f=!DEFAULT('F8.1') !CMDEND). MATRIX. GET Mat_A /VAR=a1 TO a5. PRINT !f /FORMAT='A8' /TITLE='Format used to display data'. PRINT Mat_A /FORMAT=!f /TITLE='Input data'. END MATRIX. !ENDDEFINE. * Some macro calls *. MyCode f='F8.3'. MyCode f='E10.3'. MyCode f='F8.2'. HTH, Marta García-Granero ===================== 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 |
|
This is great, thanks! And yes, I'm interested in the other one too, but
let me play with this first. Best, Lisa ----- Original Message ----- From: "Marta García-Granero" <[hidden email]> To: <[hidden email]> Sent: Friday, January 25, 2008 5:29 AM Subject: Re: Help with Matrix output > Lisa Stickney escribió: >> Perfect! My thanks to all who replied. >> >> And yes, Marta, I would be interested in a macro to use as an exemplar. > > Sorry for the delay, I dind't remember I had updated all my macros to > SPSS 15, and eliminated direct MATRIX output in all of them (replaced it > by an exported secondary file printed with REPORT, it looks nicer, and > yes, I can send you another example macro): > > * Sample dataset *. > DATA LIST LIST/a1 TO a5. > BEGIN DATA > 1.1 2.1 3.5 4.3 5.8 > 6.8 7.5 9.0 5.3 1.8 > 7.7 8.5 6.9 4.1 3.3 > END DATA. > > * Short macro showing how to pass the output format to MATRIX as an > argument *. > DEFINE MyCode(f=!DEFAULT('F8.1') !CMDEND). > MATRIX. > GET Mat_A /VAR=a1 TO a5. > PRINT !f > /FORMAT='A8' > /TITLE='Format used to display data'. > PRINT Mat_A > /FORMAT=!f > /TITLE='Input data'. > END MATRIX. > !ENDDEFINE. > > * Some macro calls *. > MyCode f='F8.3'. > MyCode f='E10.3'. > MyCode f='F8.2'. > > HTH, > Marta García-Granero > > ===================== > 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 |
|
Hi Lisa
This is an example of how to use multiple datasets to export output from MATRIX and present it in pivot tables (using SUMMARIZE). The macro used computes McNmear's OR, and it will reply H's question concerning how to compute OR for paired data. DEFINE PAIREDOR (!POSITIONAL !TOKENS(1)/!POSITIONAL !TOKENS(1)). DATASET NAME OriginalData. * Preserve original data *. DATASET COPY DuplicateData WINDOW=FRONT. SORT CASES BY !1(A) !2(A). AGGREGATE /OUTFILE=* /BREAK=!1 !2 /N=n. * Initialize empty dataset to dump MATRIX output later *. DATASET DECLARE Results1 WINDOW=HIDDEN. DATASET DECLARE Results2 WINDOW=HIDDEN. PRESERVE. * Shut down all output (MATRIX code is invisible) *. 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=Results1 /NAMES=vnames. COMPUTE vnames={'OddsR','Inferior','Superior'}. SAVE {orr,loworr,upporr} /OUTFILE=Results2 /NAMES=vnames. END MATRIX. * Output starts again *. RESTORE. * This is just some output cleaning *. OMS /SELECT TABLES /IF COMMANDS='Summarize' SUBTYPES='Case Processing Summary' /DESTINATION VIEWER=NO. OMS /SELECT ALL /IF LABELS='Active Dataset' /DESTINATION VIEWER=NO. * Print report for chi-square tests *. DATASET ACTIVATE Results1. 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. * Getting rid of the now useless dataset *. DATASET ACTIVATE Results2. DATASET CLOSE Results1. * Prin report for OR & 95%CI *. FORMAT OddsR TO Superior (F8.2). VAR LABEL OddsR 'OR (McNemar)' Inferior 'Lower' Superior 'Upper'. SUMMARIZE /TABLES=ALL /FORMAT=LIST NOCASENUM NOTOTAL /TITLE='OR & 95%CI (*)' /CELLS=NONE. OMSEND. * Getting rid of the now useless datasets *. DATASET ACTIVATE DuplicateData. DATASET CLOSE Results2. DATASET ACTIVATE OriginalData. DATASET CLOSE DuplicateData. ECHO '(*) Asymptotic'. !ENDDEFINE. * Sample dataset (1:1 matched binary data, lower value means exposed in both groups) *. DATA LIST FREE/Case Control (2 F8). BEGIN DATA 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 END DATA. VALUE LABEL Case Control 1'Exposed to Risk' 2 'Non exposed'. LIST /CASES=FROM 1 TO 10. * MACRO call *. PAIREDOR Case Control. ===================== 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 |
|
Thanks! This is great. Lisa
----- Original Message ----- From: "Marta García-Granero" <[hidden email]> To: <[hidden email]> Sent: Monday, January 28, 2008 11:34 AM Subject: Re: Help with Matrix output (& Paired data OR macro too, for H) > Hi Lisa > > This is an example of how to use multiple datasets to export output from > MATRIX and present it in pivot tables (using SUMMARIZE). The macro used > computes McNmear's OR, and it will reply H's question concerning how to > compute OR for paired data. > > DEFINE PAIREDOR (!POSITIONAL !TOKENS(1)/!POSITIONAL !TOKENS(1)). > DATASET NAME OriginalData. > * Preserve original data *. > DATASET COPY DuplicateData WINDOW=FRONT. > SORT CASES BY !1(A) !2(A). > AGGREGATE > /OUTFILE=* > /BREAK=!1 !2 > /N=n. > * Initialize empty dataset to dump MATRIX output later *. > DATASET DECLARE Results1 WINDOW=HIDDEN. > DATASET DECLARE Results2 WINDOW=HIDDEN. > PRESERVE. > * Shut down all output (MATRIX code is invisible) *. > 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=Results1 /NAMES=vnames. > COMPUTE vnames={'OddsR','Inferior','Superior'}. > SAVE {orr,loworr,upporr} /OUTFILE=Results2 /NAMES=vnames. > END MATRIX. > * Output starts again *. > RESTORE. > * This is just some output cleaning *. > OMS /SELECT TABLES > /IF COMMANDS='Summarize' SUBTYPES='Case Processing Summary' > /DESTINATION VIEWER=NO. > OMS /SELECT ALL > /IF LABELS='Active Dataset' > /DESTINATION VIEWER=NO. > * Print report for chi-square tests *. > DATASET ACTIVATE Results1. > 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. > * Getting rid of the now useless dataset *. > DATASET ACTIVATE Results2. > DATASET CLOSE Results1. > * Prin report for OR & 95%CI *. > FORMAT OddsR TO Superior (F8.2). > VAR LABEL OddsR 'OR (McNemar)' Inferior 'Lower' Superior 'Upper'. > SUMMARIZE > /TABLES=ALL > /FORMAT=LIST NOCASENUM NOTOTAL > /TITLE='OR & 95%CI (*)' > /CELLS=NONE. > OMSEND. > * Getting rid of the now useless datasets *. > DATASET ACTIVATE DuplicateData. > DATASET CLOSE Results2. > DATASET ACTIVATE OriginalData. > DATASET CLOSE DuplicateData. > ECHO '(*) Asymptotic'. > !ENDDEFINE. > > * Sample dataset (1:1 matched binary data, lower value means exposed in > both groups) *. > DATA LIST FREE/Case Control (2 F8). > BEGIN DATA > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 > 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 > 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 1 2 1 2 1 > 2 1 2 1 2 1 2 1 2 1 2 2 2 2 2 2 2 2 2 2 2 2 > 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 > 2 2 > END DATA. > VALUE LABEL Case Control 1'Exposed to Risk' 2 'Non exposed'. > LIST /CASES=FROM 1 TO 10. > > * MACRO call *. > PAIREDOR Case Control. > > ===================== > 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 |
| Free forum by Nabble | Edit this page |
