像this post我在努力處理MCMCglmm
的符號,尤其是trait
的含義。我的代碼IST以下MCMCglmm中「特質」的含義
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")
這給我的錯誤消息For error structures involving catgeorical data with more than 2 categories pleasue use trait:units or variance.function(trait):units.
(!原文如此)。如果我通過letters[1:2]
生成二分數據,一切都會正常工作。那麼一般來說這個錯誤信息是什麼意思,特別是「特質」呢?
編輯2016年9月29日: 從the linked question我複製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)))
。現在我的模型實際上給出了結果:
MCMCglmm(fixed = y ~ 1 + x, random = ~us(1 + x):id,
rcov = ~ us(trait):units, prior = prior, data = dat,
family = "categorical")
但我仍得缺乏瞭解是什麼意思trait
(什麼由units
和之前的符號,並與idh()
,什麼是us()
。 ..)。
編輯二〇一六年十一月十七日: 我覺得trait
是synoym爲「目標變量」,或在這種情況下「響應」一般或y
。在配方random
存在(在這種情況下y
)沒有對~
"because the response is known from the fixed effect specification."所以,理性的左側後面specifiying是rcov
需求trait:units
可能是因爲它是alread由fixed
公式定義,什麼是trait
。