[R] Z-test
Rolf Turner
rolf.turner at xtra.co.nz
Sat Jul 16 09:05:52 CEST 2011
On 16/07/11 17:49, Joshua Wiley wrote:
> Hi,
>
> The Z is basically:
>
> (mean(x) - mean(y))/sqrt(var(x)/length(x) + var(y)/length(y))
>
> and pnorm will give you a p-value, if you desire it.
>
> If the n - 1 divisior used in var() is a problem for you, it is
> trivial to work around:
<SNIP>
(1) Why on earth should the n - 1 divisor be a problem? This divisor
yields an unbiased estimator of sigma^2. Generally speaking,
unbiasedness is a Good Thing.
(2) If a Z-test (rather than a t-test) is being done then this issue simply
does not arise. In the context of a Z-test, the variances are ***known***
quantities and so do not get estimated. So there is no divisor to *be* a
problem.
cheers,
Rolf
More information about the R-help
mailing list