Hello, 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? Secondly, I am trying to convert the raw dataset into a normalized dataset, with each data point normalized to its column mean. I have tried dividing the dataset by the list generated using the colMeans function, but the results of this procedure generate the correct values for some columns and not others. I am sure that these are very basic questions which arise from my poor understanding of the language. Any insight is appreciated. Corey [[alternative HTML version deleted]]
On 06/25/04 17:38, Broeckling, Corey wrote:>Secondly, I am trying to convert the raw dataset into a normalized dataset, >with each data point normalized to its column mean. I have tried dividing >the dataset by the list generated using the colMeans function, but the >results of this procedure generate the correct values for some columns and >not others.For this question, look at scale. That is: ?scale I don't understand the other questions. -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron R search page: http://finzi.psych.upenn.edu/
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