Date: Tue, 20 Apr 2004 11:23:50 0400
ReplyTo: Doc Muhlbaier <lawrence.muhlbaier@DUKE.EDU>
Sender: "SAS(r) Discussion" <SASL@LISTSERV.UGA.EDU>
From: Doc Muhlbaier <lawrence.muhlbaier@DUKE.EDU>
Organization: Duke University, Durham, NC, USA
Subject: Re: ttest proportions
Jim,
If your dichotomous variables are coded 0 and 1, you can use PROC TTEST to
get the results that you are looking for. Note that the PAIRED statement
was added to the PROCedure in 8.2, so it's easier to do the paired version
than it used to be.
The Zscores that you refer to below are for the ztest (square root of the
chisquared test). The t is the analogous tapproximation similar to
continuous data; it relies more on the central limit theorem here than for
data that are on a rational scale.
It's an approximation, for sure, but I've found it to be a pretty good one
and it has a much more succinct display than PROC FREQ.
Doc Muhlbaier
Duke
"Groeneveld, Jim" <jim.groeneveld@VITATRON.COM> wrote in message
news:81BFA8F7807F1349AD6C16AD00A1AB9BD3A8C0@AMSM1BMSGM01.ent.core.medtronic.com...
> Hi friends,
>
> I am looking for an implantation in SAS of the hypothesis tests described
below.
> My design is either two dependent (paired) or two independent samples
(groups).
> A single dichotome variable has to be tested for differences between both
groups.
> The difference can be described in terms of proportions (of one of the two
values)
> and group sizes only.
>
> In the book <<Introduction to Statistical Analysis and Inference for
Psychology and Education, by Sidney J. Armore, 1970>> a ttest for
proportions between independent groups is outlined. Based on that I wrote a
simple Fortran (Fortran 4 or Fortran 66 as it was called on an already
extinct mainframe computer) program some 25 years ago, which calculated
zscores from both proportions (or percentages) and group sizes. The partial
code, from which the used formula may be evident, is:
> POOLED=(PROP1*N1+PROP2*N2)/(N1+N2)
> ZSCORE=(PROP1PROP2)/SQRT(POOLED*(1.POOLED)*(1./N1+1./N2))
> I have used this program quite some time with the aggregated data.
>
> While searching the internet I came across a.o. the following sites:
> http://courses.smsu.edu/nkk661f/QBA337/handout4.htm
> http://www.stat.sc.edu/curricula/courses/515/515SAS.html#9p3
> Both pages give formulas for proportions, which actually are the same in
both of them. Their formula is:
> z = (p1  p2) / sqrt ( (P x (1P) / n1 ) + (P x (1P) / n2 ) )
> where P = pooled proportion: (p1n1 + p2n2) / (n1 + n2)
> This is the same formula I used to use.
>
> The web page
> http://www.ocair.org/files/KnowledgeBase/Statistics/Proportion.htm
> mentiones a similar formula for t, where the pooled proportion is replaced
by the group proportions:
> t = (p1  p2) / sqrt ( (p1 x (1p1) / n1 ) + (p2 x (1p2) / n2 ) )
>
> These sites apparently give code to calculate the pvalues using data step
code, but now I would like to know how I can calculate the same from the
individual data using a standard SAS PROCedure. So I would like to avoid
writing some algorithm in a data step, because that would have to be
validated. I know I also could apply a Chisquare.
>
> And additional to that I also would like to know how to do it with a
standard SAS PROCedure with dependent (paired) groups (repeated measures),
i.e. comparing the proportions of two different dichotome variables within
one sample.
>
> Regards  Jim.
> 
> . . . . . . . . . . . . . . . .
>
> Jim Groeneveld, MSc.
> Biostatistician
> Science Team
> Vitatron B.V.
> Meander 1051
> 6825 MJ Arnhem
> Tel: +31/0 26 376 7365
> Fax: +31/0 26 376 7305
> Jim.Groeneveld@Vitatron.com
> www.vitatron.com
>
> My computer remains home, but I will attend SUGI 2004.
>
> [common disclaimer]
