[R] small sample techniques

Nordlund, Dan (DSHS/RDA) NordlDJ at dshs.wa.gov
Thu Aug 9 20:26:31 CEST 2007


> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Nair, 
> Murlidharan T
> Sent: Thursday, August 09, 2007 9:19 AM
> To: Moshe Olshansky; Rolf Turner; r-help at stat.math.ethz.ch
> Subject: Re: [R] small sample techniques
> 
> Thanks, that discussion was helpful. Well, I have another question 
> I am comparing two proportions for its deviation from the hypothesized
> difference of zero. My manually calculated z ratio is 1.94. 
> But, when I calculate it using prop.test, it uses Pearson's 
> chi-squared
> test and the X-squared value that it gives it 0.74. Is there 
> a function
> in R where I can calculate the z ratio? Which is 
> 
> 
>    ('p1-'p2)-(p1-p2)
>  Z= ----------------
> 	     S
> 		('p1-'p2)
> 
> Where S is the standard error estimate of the difference between two
> independent proportions
> 
> Dummy example 
> This is how I use it 
> prop.test(c(30,23),c(300,300))
> 
> 
> Cheers../Murli
> 
> 

Murli,

I think you need to recheck you computations.  You can run a t-test on your data in a variety of ways.  Here is one: 

> x<-c(rep(1,30),rep(0,270))
> y<-c(rep(1,23),rep(0,277))
> t.test(x,y)

        Welch Two Sample t-test

data:  x and y 
t = 1.0062, df = 589.583, p-value = 0.3147
alternative hypothesis: true difference in means is not equal to 0 
95 percent confidence interval:
 -0.02221086  0.06887752 
sample estimates:
 mean of x  mean of y 
0.10000000 0.07666667 

Hope this is helpful,

Dan

Daniel J. Nordlund
Research and Data Analysis
Washington State Department of Social and Health Services
Olympia, WA  98504-5204



More information about the R-help mailing list