In total there are 730 observations with 4 variables rownames, T, X1 and X2.; T is numerical variable;X1 and X2 are integers.
I have provided a few observations.
X1 has five levels: 1,2,3,4 and 5.
I am finding the contrast for the mean of factor X1= 1 vs means of all the levels of X1 (including the 1)
I installed the multcomp library without any problem. Please find below my code. I received an error mesage below the summary code
install.packages("multcomp")
library(multcomp)
mod <- aov(T~A, data = res)
k <- rbind ("L"=c(1,-0.25,-0.25,-0.25,-0.25))#L Ho:mean of group X1 vs.mean of other groups of X
summary(glht(mod, linfct = mcp(X1=k), alternative="two.sided"), test=adjusted("none"))
Error in mcp2matrix(model, linfct = linfct) :
Variable(s) ‘X1’ of class ‘integer’ is/are not contained as a factor in ‘model’.
Can someone help me solve the above-mentioned problem. Thanks in advance.
Could you please turn this into a self-contained reprex (short for minimal reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.