CSV file is attached.
I am doing a manova test. Followed by a summary.aov to determine which of the 12 dependent variables are significant and warrant further testing. There is only one independent variable which is categorical with 4 factors.
R Code:
data1<- read.csv(file link, header=TRUE)
as.matrix(data1)
X<-data1[,1]
Dep1<-data1[,2]
Dep2<-data1[,3]
Dep3<-data1[,4]
Dep4<-data1[,5]
Dep5<-data1[,6]
Dep6<-data1[,7]
Dep7<-data1[,8]
Dep8<-data1[,9]
Dep9<-data1[,10]
Dep10<-data1[,11]
Dep11<-data1[,12]
Dep12<-data1[,13]
Y<-cbind(Dep1, Dep2, Dep3, Dep4, Dep5, Dep6, Dep7, Dep8, Dep9, Dep10, Dep11, Dep12)
M<- manova(Y ~ as.factor(X), data=data1)
S<-summary(M, test="Pillai")
S1<-as.vector(S$stats[1,])
L<-mat.or.vec(12,3)
SA<-summary.aov(M)
#Stops working here. I want to save the numbers from each Dep"i" test as a matrix or vector. S1 above works for the manova test, but I don't know how to reference my values for summary.aov
SA1<-SA[" Response Dep1"]
Thank you so much for any help you can give,
William
-----Original Message-----
From: Ivan Calandra [mailto:ivan.calandra at uni-hamburg.de]
Sent: Wednesday, May 04, 2011 4:38 PM
To: Reith, William [USA]
Cc: r-help at r-project.org
Subject: Re: Str info. Thanks for helping
It looks from str(SA) that Response IPS1 is a data.frame of class "anova", which probably cannot be coerced to vector.
Maybe you can use unlist() instead of as.vector()
Or something like
SA[["Response IPS1"]]["as.factor(WSD)",] ## to select the first row only, even maybe with unlist()
Without a better REPRODUCIBLE example, I cannot tell more (maybe some others can, that's why I reply to the list)
HTH,
Ivan
Le 4 mai 2011 ? 20:17, reith_william at bah.com a ?crit :
I am still waiting for this to get posted so I thought I would email it to you.
SA gives the output:
Response IPS1 :
Df Sum Sq Mean Sq F value Pr(>F)
as.factor(WSD) 3 3.3136 1.10455 23.047 5.19e-12 ***
Residuals 129 6.1823 0.04793
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
.
.
.
There are 11 more just like this output. Just increment IPS1 to IPS2, etc.
Goal: save "3 3.3136 1.10455 23.047 5.19e-12" as a vector.
Str(SA) gives the output:
str(SA)
List of 12
" $ Response IPS1 :Classes 'anova' and 'data.frame': 2 obs. of 5 variables:"
..$ Df : num [1:2] 3 129
..$ Sum Sq : num [1:2] 3.31 6.18
..$ Mean Sq: num [1:2] 1.1045 0.0479
..$ F value: num [1:2] 23 NA
..$ Pr(>F) : num [1:2] 5.19e-12 NA
There are several more but they are just repeats of this one only with IPS2, IPS3,...
The command:
SA1<-as.vector(SA$"Reponse IPS1")
As do several variations I have tried. Any ideas.