s-news
[Top] [All Lists]

Re: t-test for mixtures

To: Xao Ping <xao_ping@yahoo.com>
Subject: Re: t-test for mixtures
From: Tim Hesterberg <timh@insightful.com>
Date: 13 Oct 2004 12:24:48 -0700
Cc: s-plus user list <s-news@lists.biostat.wustl.edu>
In-reply-to: <20041013185400.10994.qmail@web54008.mail.yahoo.com> (message from Xao Ping on Wed, 13 Oct 2004 11:54:00 -0700 (PDT))
References: <20041013185400.10994.qmail@web54008.mail.yahoo.com>
>I need to perform the two-sample paired t-test where the samples to
>be compared are the mixtures of normals sharing the same mean but
>differing by their variances.
>
>More specifically, suppose that the sample X contains n1 terms drawn
>from N(mu, sigma1), n2 terms drawn from N(mu, sigma2), etc. The
>sample Y has the same structure. I need to test the null hypothesis
>of equality of means, mu.X=mu.Y, and assign a p-value. Obviously, the
>X & Y are not normally distributed, and t-statistic is not
>t-distributed. Is there a general approach for performing something
>like t-test in this setting? Note: it is not a Behrens-Fisher
>problem, it is something different. Any ideas/references/software
>implementations are highly appreciated.

Are n1, n2, ... fixed?
If the null hypothesis is correct, then do the terms in Y have
the same variances as the corresponding terms in X?

If the answer to both questions is yes, then I suggest using a
a stratified permutation test.  This does not require that the
strata sizes in X and Y be identical.

If you have a data frame with variables "values", "treatment", "strata"
where values contains the numerical values, treatment has two levels
indicating sample X or Y, and strata = j for the observations
with variance sigmaj, then
        permutationTestMeans(data, treatment = treatment, group = strata)
would do it.  Example using artificial data is below.

This requires S+Resample; see the bottom of this message.

You could also use a different statistic; rather than a simple
average of the values within each treatment, take a weighted
mean of the strata means, with weights on the strata means
proportional to stratum size / estimated stratum variance.
The permutationTestMeans function doesn't support this, but the
more general permutationTest2 funtion would.


> set.seed(0)
> data _ data.frame(runif(60), treatment=rep(1:2, 30),
+           strata = sample(1:3, size=60, replace=T))
> permutationTestMeans(data, treatment = treatment, group = strata)
Call:
permutationTestMeans(data = data, treatment = treatment, group = strata)

Number of Replications: 999 

Summary Statistics:
   Observed      Mean    SE alternative p.value 
X1  0.04311 0.0004573 0.076   two.sided   0.578

P-values for each variable and stratum:
   alternative    1     2     3 
X1   two.sided 0.08 0.396 0.818

========================================================
| Tim Hesterberg       Research Scientist              |
| timh@insightful.com  Insightful Corp.                |
| (206)802-2319        1700 Westlake Ave. N, Suite 500 |
| (206)802-2500 (fax)  Seattle, WA 98109-3044, U.S.A.  |
|                      www.insightful.com/Hesterberg   |
========================================================
Download the S+Resample library from www.insightful.com/downloads/libraries


<Prev in Thread] Current Thread [Next in Thread>