# [R] MANOVA / Hotelling's Test

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Nov 11 15:58:14 CET 1998

```"Uli Flenker; Raum 704" <uli at biochem.dshs-koeln.de> writes:

> I have to perform Hotteling's T^2 Test - more generally a MANOVA - on a
> set of data.  Is there a (simple?) possibility to do it in R?
>
>
> The somewhat obvious way to do it would be
>
> > summary(aov(Y ~ x1 + x2 ... + xn))
>
> where Y would be a two-column matrix.
>
>
> But this does not work in any possible combination of matrix or factor
> dimensions! Is it principally not possible to perform modelling of
> multivariate data using the "~"-operator?
>
> I'm using R 0.62.2 on Linux 2.0.25.

Let's put it this way: It isn't, but it should be...

0.63 will contain some of the pieces, but not all. There's an extended
aov() and objects of class "maov", and in general you can use
matrix-responses. However, all you get from summary and friends are
lists of univariate results. Splus has manova(), which is essentially
just a wrapper for aov() which attaches class "manova" to the result,
but also summary.manova() computing the relevant test statistics. R
doesn't have this yet.

Probably the most practical way to proceed is to calculate generalised
sums of squares and products with

> r<-resid(lm(y~x))
> t(r)%*%r

and then put TW Anderson's book in your lap and calculate Wilk's
lambda and asymptotic approximations of it's distibution. (Hotelling's
T^2 is some trivial transformation of W's lambda and can be converted
to an exact F distributed variable)

--
O__  ---- Peter Dalgaard             Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
(*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```