# [R] simple questions

Chuck Cleland ccleland at optonline.net
Sat Jun 26 11:12:22 CEST 2004

```   If I understand what you are after, here is an example with
two response variables and two factors:

> mydata <- data.frame(Y1 = rnorm(20), Y2 = rnorm(20),
FACT1 = rep(c("A", "B"), 10), FACT2 = rep(c("X", "Y"),
c(10,10)))

> my.aov <- aov(cbind(Y1, Y2) ~ FACT1*FACT2, data = mydata)

> summary(my.aov)

Response Y1 :
Df  Sum Sq Mean Sq F value Pr(>F)
FACT1        1  0.0382  0.0382  0.0292 0.8664
FACT2        1  0.1248  0.1248  0.0954 0.7613
FACT1:FACT2  1  0.0616  0.0616  0.0471 0.8309
Residuals   16 20.9203  1.3075

Response Y2 :
Df  Sum Sq Mean Sq F value Pr(>F)
FACT1        1  0.1634  0.1634  0.1660 0.6891
FACT2        1  0.5685  0.5685  0.5777 0.4583
FACT1:FACT2  1  0.0167  0.0167  0.0170 0.8980
Residuals   16 15.7444  0.9840

The same approach will work with more response variables and more
factors.

Broeckling, Corey wrote:
> I am a new user or R, and am so far very impressed with its capabilities.
> However, I have no programming experience, and am having some issues in
> trying to tell the software what I want done.  There are basically two
> issues which I am currently grappling with.  The first, I have a data
> matrix, with two factors and dozens of response variables.  I am interested
> on conducting ANOVAs on each of the variables individually (in addition to
> doing multivariate analyses).  I have been trying to get the AOV function to
> recognized a list of variables, but always receive error messages.  I am
> sure there is a way to do this, but I haven't been able to figure it out.
> Suggestions as to what I am doing wrong?
> ...

--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894

```