# Re: [R] Test on mu with multivariate normal distribution

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Sun 08 May 2005 - 17:25:04 EST

"Telse Henschel" <telsehenschel@web.de> writes:

> Dear WizaRds,
>
> I am sorry to bother you with a newbie question, but although I tried to solve my problem using the various .pdf files (Introduction, help pages etc.), I have come to a complete stop. Please be so kind as to guide me a little bit along my way of exploring multivariate analysis in R.
>
> I want to test wether the means-vector mu1 of X, consisting of the means per column of that matrix , and mu2, i.e. the means per column of Y, are distributed equally under the assumption of a multivariate normal distribution. I thought “simtest” could be the right function to get the p-value, but I fail to use R correctly. Here is what I tried to do:
>
> f1 <- factor(c("8", "10", "12", "14"))
>
> X <- matrix(1:16, ncol=4)
> colnames(X) <- c("Obj1","Obj2","Obj3","Obj4")
> X.frame <- data.frame(f1,X)
>
> Y <- matrix(1:12, ncol=4)
> colnames(Y) <- c("Obj1","Obj2","Obj3","Obj4")
> Y.frame <- data.frame(f1,Y)
> XY <- data.frame(X.frame, Y.frame) # won’t work, because of different nr of rows
>
> test.stat <- lm(XY ~ f1) # ???

Try this:

```X <- matrix(rnorm(16), ncol=4)
Y <- matrix(rnorm(12), ncol=4)
XY <- rbind(X,Y)
g <- factor(rep(1:2,c(4,3)))
```

fit1 <- lm(XY ~ g)
fit0 <- lm(XY ~ 1)
anova(fit0,fit1)

(using 1:16 and 1:12 for X and Y gives

Error in anova.mlmlist(object = fit0, fit1) :

residuals have rank 1 < 4

)

> # simtest(test.stat, XY, type="Tukey")
>
> creates errors already by just staring at it. I apologize.
>
>
> Thank you so much for your support,
> Telse
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
>

```--
O__  ---- Peter Dalgaard             Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
(*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help