我已经构建了一个解释协变量的模型。有两个因变量(“A”、“B”)和两个自变量(“C”、“D”)和一个连续协变量(“E”)。我按如下方式运行了MANCOVA:
x<-cbind(A,B) #combining dependent variables
y<-cbind(C,D) #combining independent variables
fit<-manova(x~y+E)
summary(fit, test="Pillai")
这一切都很完美,我发现协变量对因变量有影响。因此,我想使用 emmeans 包来解释具有估计边际均值的协方差。但是,当我尝试运行以下代码时,我收到此错误:
library(emmeans)
emmeans(fit,~y+E)
>Error in eval(expr, envir, enclos) : object 'spc.l$Ghopper.Start..g.' not
found
>Error in ref_grid(object, ...) : Perhaps a 'data' or 'params' argument is
needed
这是我的数据:
structure(list(ï..insect = c(105L, 106L, 107L, 108L, 110L, 112L,
113L, 114L, 115L, 116L, 117L, 118L, 119L, 120L, 121L, 122L, 123L,
125L, 126L, 127L, 128L), C = structure(c(1L, 2L, 1L, 2L, 2L,
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 2L
), .Label = c("Pair A 7p:35c-35p:7c", "Pair B 7p:35c-28p:14c"
), class = "factor"), D = structure(c(1L, 1L, 2L, 2L, 1L, 2L,
1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L), .Label = c("F",
"M"), class = "factor"), E = c(0.357, 0.259, 0.128, 0.104, 0.248,
0.111, 0.218, 0.213, 0.13, 0.123, 0.335, 0.22, 0.247, 0.295,
0.297, 0.219, 0.132, 0.194, 0.207, 0.266, 0.234), A = c(0.025333333,
0.041666665, 0.043833332, 0.046333331, 0.108499995, 0.051999997,
0.101833329, 0.06083333, 0.059499998, 0.056166664, 0.017833333,
0.053666664, 0.066333331, 0.025499998, 0.073666664, 0.149333324,
0.044666665, 0.047499998, 0.051833331, 0.020499999, 0.062499997
), B = c(0.050666667, 0.020333321, 0.023166668, 0.029666645,
0.032499992, 0.028999981, 0.029166671, 0.024166656, 0.025500002,
0.020833325, 0.021166667, 0.038333304, 0.023666669, 0.022499981,
0.040333336, 0.121666569, 0.023333335, 0.017500002, 0.01816666,
0.018500001, 0.024499989)), .Names = c("ï..insect", "C", "D",
"E", "A", "B"), class = "data.frame", row.names = c(NA, -21L))
我确信这个问题有一个简单的解决方法,但我有点迷茫,stackexchange 上几乎没有关于 emmeans 的问题!