What codes should I use in R for an ANOVA model when the response is vector valued...i.e. Suppose I have longitudinal data for 20 individuals each having measurements of 10 time points...now I have a factor X having 3 levels,say 0,1,2...I need to test if the levels differ significantly from each other...I have to test for the mean vector (vector since each individual contains 10 time points)..i.e. if the mean vector for level 0, mean vector for level 1 and mean vector for level 2 are significantly different...
My sample data is:
Y
[1,] 9.759608 15.02230 17.70331
[2,] 9.596711 15.50542 18.49343
[3,] 11.298570 17.44781 19.48276
[4,] 8.519376 13.73086 17.05881
[5,] 10.232851 15.85302 19.87476
[6,] 10.888219 16.05568 20.12624
[7,] 9.688724 15.50494 18.82778
[8,] 10.309219 16.78230 18.80428
[9,] 9.620743 15.84582 19.32465
[10,] 10.418802 16.18098 17.94019
>treatment=c(0,1,1,2,0,2,1,1,0,1)
>treatment=factor(treatment)
> result=aov(Y~treatment)
Error in model.frame.default(formula = Y ~ treatment, drop.unused.levels = TRUE) :
object is not a matrix