[R] MANOVA extension of paired t-test?

Stewart Schultz schultz at fig.cox.miami.edu
Thu Jan 24 01:28:07 CET 2002


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


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list