I have a dataframe made up of three continuous response variables, two categorical variables and a subject ID
library(MANOVA.RM)
y1<-sample(1:150, 100, replace=T)
y2<-sample(1:150, 100, replace=T)
y3<-sample(1:150, 100, replace=T)
x1<-sample(x=c("S1", "S2"), size=100, replace=T, prob=rep(1/2,2))
x2<-sample(x=c("T1", "T2"), size=100, replace=T, prob=rep(1/2,2))
id <- seq (from=1, to=100, by=1)
data <- data.frame(y1, y2, y3, x1, x2, id)
I am trying to run a MANOVA but am having issues with the syntax around assigning response variables.
The help file for MANOVA.RM uses the following syntax as an example
EEG_MANOVA <- MANOVA(resp ~ sex * diagnosis,
data = EEG, subject = "id", resampling = "paramBS",
iter = 1000, alpha = 0.05)
However the left hand side of the formula (i.e. 'resp') is only referring to a single response variable, whereas I want to refer to a matrix of variables (in this case y1, y2, and y3
)
How can I alter the syntax to include three response variables?
It should work if you bind the response columns like (this works in package manova):
test <- manova(cbind(y1,y2,y3) ~ x1, data = data, subject = "id")