On Thu, 20 Jul 2006, Jacob van Wyk wrote:

> Hallo
>
> Is there an elegant way to do the following:
>
> Dataset consists of 2 variables: var1: some measurements, and var2: a 
> grouping variable with two values, 1 and 2.
> There are (say) 10 measurements from group 1 and 15 measurements from group 2.
> The idea is to study the permutation distribution of mean(group 1) * 
> mean(group2).
> One way would be to permute 1s and 2s and select the corresponding 
> measurements; calculate the difference in means.
> Redo this 1000 times, say. Etc.



There are only choose(25,10) == 3268760 values.

You can enumerate all the sums of the values in one group following:

        http://finzi.psych.upenn.edu/R/Rhelp02a/archive/76450.html

from which the products of the means are easily obtained.

Takes about 5 seconds on my 2GHz AMD running Windows XP.


HTH,

Chuck

Charles C. Berry                        (858) 534-2098
                                          Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]               UC San Diego
http://biostat.ucsd.edu/~cberry/         La Jolla, San Diego 92093-0717

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to