Date: Tue, 8 Nov 2005 18:36:22 +0100
Reply-To: Marta García-Granero
<biostatistics@terra.es>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Marta García-Granero
<biostatistics@terra.es>
Organization: Asesoría Bioestadística
Subject: Re: Z test for proportion-Juan Albertorio
In-Reply-To: <DF8D74DEC0769E4CBE4CF58D2AA3EA130336D676@m-nchs-1.nchs.cdc.gov>
Content-Type: text/plain; charset=ISO-8859-1
Hi Juan,
AJR> I have a question. I need to run a Z test for seek the
AJR> exact P value -significance of the proportions' difference.
If it is a Z test, then the p-value is asymptotic. Are you talking about
getting the actual p-value, instead of just saying it's "significant'
or 'non-significant'? Given the sampe sizes, I don't think you need an
exact test.
AJR> I already have the n's, value and standard error. My
AJR> question is; Did someone knows a SPSS Syntax available were I can
AJR> enter the values (show below) and calculate the exact P value?
AJR> Example:
AJR> N Proportion Standard Error
AJR> Male 42947 15.35 0.08
AJR> Female 41294 14.36 0.07
You don't need the standard errors (they can be computed as
SQRT(prop*(100-prop)/n).
Try this code (tested with COMPARE2.EXE, from WinPepi statistical
package):
* With your data *.
DATA LIST LIST/group(A6) n(F8.0) perc(F8.3).
BEGIN DATA
Male 42947 15.35
Female 41294 14.36
END DATA.
* Method described in Chapter 6 of 'Statistic at Square One'
(http://bmj.bmjjournals.com/collections/statsbk/6.shtml) *.
MATRIX.
PRINT /TITLE='95%CI for a difference in percentages & Z test'.
GET gnames/VAR=group.
GET n /VAR=n.
GET perc /VAR=perc.
COMPUTE sediff1=SQRT(MSUM(perc&*(100-perc)/n)).
COMPUTE lower=perc(1)-perc(2)-1.96*sediff1.
COMPUTE upper=perc(1)-perc(2)+1.96*sediff1.
COMPUTE commonp=MSUM(n&*perc)/MSUM(n).
COMPUTE sediff2=SQRT(commonp*(100-commonp)*MSUM(1/n)).
COMPUTE zvalue=(perc(1)-perc(2))/sediff2.
COMPUTE zsig=1-CDFNORM(ABS(zvalue)).
COMPUTE labels={gnames;'Diff'}.
PRINT {T(perc),perc(1)-perc(2)}
/FORMAT='F8.2'
/CNAMES=labels
/TITLE='Percentages & Difference'.
PRINT sediff1
/FORMAT='F8.2'
/TITLE='SE for difference in percentages'.
PRINT {lower,upper}
/FORMAT='F8.2'
/CLABEL='Lower','Upper'
/TITLE='95% CI for the difference in percentages'.
PRINT sediff2
/FORMAT='F8.2'
/TITLE='SE for difference in percentages (asumming H0)'.
PRINT {zvalue,zsig,2*zsig}
/FORMAT='F8.3'
/CLABEL='Z-value','One-tailed','2-tailed'
/TITLE='Z test and significance for difference in proportions'.
END MATRIX.
Regards,
Marta mailto:biostatistics@terra.es