Re: [R] test for equality of two data sets with multidimensional variables

From: Petr Pikal <petr.pikal_at_precheza.cz>
Date: Tue 21 Jun 2005 - 22:29:34 EST


Hi

searching in CRAN homepage for hotelling gave me this response

Thanks everyone for your help on this question. I solved the problem by
writing a procedure to calculate Hotelling's T^2 for a one-sample, multivariate t-test. Here's how it looks, perhaps it will be useful to others.

data <- cbind(rnorm(50, 0.1, .01), rnorm(50,.1,.01), rnorm(50,.1,.01))
k <- ncol(data)
n <- nrow(data)
xbar <- apply(data, 2, mean)
mubar <- rep(0,k) #hypothesized means are zero dbar <- xbar - mubar
v <- var(data)
t2 <- n*dbar%*%solve(v)%*%dbar
F <- (n-k)*t2/((n-1)*k)
P <- 1-pf(F,k,n-k)

A previous post by Peter B. Mandeville was very helpful, as well as the
Johnson/Wichern book on multivariate stats. -S. Schultz

and this

cran.r-project.org/doc/packages/agce.pdf - Podobné stránky

CRAN - Package SharedHT2
SharedHT2: Shared Hotelling T2 test for small sample microarray experiments ...
Derives a Hotelling T2 statistic having an F-distribution using an empirical ...

Maybe this is what you want.

HTH
Petr

On 21 Jun 2005 at 13:00, wu sz wrote:

> Hello there,
>
> I have two data sets with 14 variables each, and wish to do the test
> for equality of their covariance matrices and mean vectors. Normally
> these tests should be done by chi square test (box provided) and
> Hotelling's T square test respectively. Which R functions could do
> this kind of test? I just find some functions could do for one
> dimension, but no for multidimension. Some one suggests bartlett.test,
> but it seems just works for one dimension. Do you know which ones
> could do that, or I have to do R programming by myself?
>
> Thank you,
> Shengzhe
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal@precheza.cz



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jun 21 22:33:55 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:55 EST