“特质”的含义在MCMCglmm中 [英] Meaning of "trait" in MCMCglmm
问题描述
就像这篇文章我正在为 MCMCglmm
的符号而苦苦挣扎,尤其是 trait $ c的含义是什么$ c>。我的代码如下
Like in this post I'm struggling with the notation of MCMCglmm
, especially what is meant by trait
. My code ist the following
library("MCMCglmm")
set.seed(123)
y <- sample(letters[1:3], size = 100, replace = TRUE)
x <- rnorm(100)
id <- rep(1:10, each = 10)
dat <- data.frame(y, x, id)
mod <- MCMCglmm(fixed = y ~ x, random = ~us(x):id,
data = dat,
family = "categorical")
这给了我错误消息对于涉及超过2类类别的分类数据的错误结构,请使用trait:units或variance.function(trait):units。
(!sic)。如果我通过 letters [1:2]
生成二分数据,那么一切都会很好。那么,此错误消息的一般含义是什么,尤其是特征是什么意思?
Which gives me the error message For error structures involving catgeorical data with more than 2 categories pleasue use trait:units or variance.function(trait):units.
(!sic). If I would generate dichotomous data by letters[1:2]
, everything would work fine. So what is meant by this error message in general and "trait" in particular?
编辑2016-09 -29:
来自链接的问题我将 rcov =〜us(trait):units
复制到了 MCMCglmm
。并且来自 https://stat.ethz.ch/ pipermail / r-sig-mixed-models / 2010q3 / 004006.html 我取了(并稍加修改了)先前的
list(R = list(V = diag(2 ),fix = 1),G = list(G1 = list(V = diag(2),nu = 1,alpha.mu = c(0,0),alpha.V = diag(2)* 100))))
。现在我的模型实际上给出了结果:
Edit 2016-09-29:
From the linked question I copied rcov = ~ us(trait):units
into my call of MCMCglmm
. And from https://stat.ethz.ch/pipermail/r-sig-mixed-models/2010q3/004006.html I took (and slightly modified it) the prior
list(R = list(V = diag(2), fix = 1), G = list(G1 = list(V = diag(2), nu = 1, alpha.mu = c(0, 0), alpha.V = diag(2) * 100)))
. Now my model actually gives results:
MCMCglmm(fixed = y ~ 1 + x, random = ~us(1 + x):id,
rcov = ~ us(trait):units, prior = prior, data = dat,
family = "categorical")
但是我仍然缺乏对特征
的含义(以及<$ c $的含义)的理解c>单位和先前的表示法, us()
与 idh()
和...)。
But still I've got a lack of understanding what is meant by trait
(and what by units
and the notation of the prior, and what is us()
compared to idh()
and ...).
编辑2016-11-17:
我认为 trait
通常等同于目标变量或响应,在本例中为 y
。在随机
的公式中,〜
的左侧没有任何内容>因为从固定效果规范中知道了响应。 后面说明 rcov
需要 trait:units
可能是因为它已经由固定
公式,特征
是什么(在这种情况下为 y
)。
Edit 2016-11-17:
I think trait
is synoym to "target variable" or "response" in general or y
in this case. In the formula for random
there is nothing on the left side of ~
"because the response is known from the fixed effect specification." So the rational behind specifiying that rcov
needs trait:units
could be that it is alread defined by the fixed
formula, what trait
is (y
in this case).
推荐答案
单位
是响应变量值和特征
是响应变量名称,与类别相对应。通过指定 rcov =〜us(trait):units
,您可以使剩余方差在特征(响应类别)之间是异构的,以便所有剩余方差的元素-协方差矩阵将被估计。
units
is the response variable value, and trait
is the response variable name, which corresponds to the categories. By specifying rcov = ~us(trait):units
, you are allowing the residual variance to be heterogeneous across "traits" (response categories) so that all elements of the residual variance-covariance matrix will be estimated.
在哈德菲尔德(Hadfield)MCMCglmm课程笔记( vignette( CourseNotes, MCMCglmm)
)的5.1节中,您可以阅读有关保留变量 trait
和 units
的说明。
In Section 5.1 of Hadfield's MCMCglmm Course Notes (vignette("CourseNotes", "MCMCglmm")
) you can read an explanation for the reserved variables trait
and units
.
这篇关于“特质”的含义在MCMCglmm中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!