# [S] Re: Flaw in power program

Steve Allan (sallan@statsci.com)
Tue, 21 Jul 1998 16:33:49 -0700

Dr. Bellin,

The formula used to compute sample sizes is based on the quantiles of the
Normal distribution. So sample sizes less than about 10 should be looked
at askew when using the t test.

If you run the simulation using the Z statistic, you get about 95% power.
The exact sample size (check the 'Options' page in the dialog for exact N)
returns 1.28, so with n=2 the power is actually higher than 80% using a
Z statistic.

ztest <- function()
{
x <- rnorm(2, 66, 4)
y <- rnorm(2, 80, 4)
z <- (mean(x) - mean(y)) / 4
1 - pnorm(abs(z))
}

> z <- numeric(1000)
> for(i in 1:1000) z[i] <- ztest()
> sum(z < 0.05)
[1] 969

Conversly, if you select 'Min. Difference' in the dialog and enter
sample sizes of 10, you get an alternative of 85.012.

> boys <- rnorm(1000, 80, 4)
> girls <- rnorm(1000, 85.012, 4)
> for(i in 1:1000) z[i] <- t.test(sample(girls, 10, rep=T),
sample(boys, 10, rep=T))\$p.value
> sum(z < 0.05)
[1] 801

At a minimum, we should print a warning when the calculated sample
size is less than 10. I'll file a report on this.

Thank you for raising this point.

Steve

**************************************
*
* Data Analysis Products Division
* MathSoft, Incorporated
*
* Email: sallan@statsci.com
* Phone: 206-283-8802
*
**************************************
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news