Description Usage Arguments Value See Also Examples
Function designed to extract the standard deviation of
the random effects from an MCMCglmm
model object.
Note that this is not the same as the posterior
distribution of (co)variance matrices. It is based on the
posterior distribution of the random effects. This also
means it requires pr=TRUE
to be set in the model
for the information to be saved. Can optionally return
standard deviation of random effects after back
transforming to the response metric. Currently
probabilities, but only for ordinal family models
(family="ordinal"
).
1 |
object |
An |
which |
A list of random effects to extract or their numeric positions If there are two numbers in a list, effects are simulataneous. |
type |
A chacter string indicating whether to calculate the standard deviation on the linear predictor metric, ‘lp’ or response, ‘response’. |
... |
Not currently used. |
A list of class postMCMCglmmRE with means (M
) and
individual estimates (Data
)
print.postMCMCglmmRE
,
predict2.MCMCglmm
,
ranef.MCMCglmm
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ## Not run:
# a simple MCMCglmm model
data(PlodiaPO)
PlodiaPO <- within(PlodiaPO, {
PO2 <- cut(PO, quantile(PO, c(0, .33, .66, 1)))
plate <- factor(plate)
})
m <- MCMCglmm(PO2 ~ 1, random = ~ FSfamily + plate,
family = "ordinal", data = PlodiaPO,
prior = list(
R = list(V = 1, fix = 1),
G = list(
G1 = list(V = 1, nu = .002),
G2 = list(V = 1, nu = .002)
)
), verbose=FALSE, thin=1, pr=TRUE)
# summary of the model
summary(m)
# examples of extracting standard deviations of
# different random effects on the linear predictor metric
# or after transformation to probabilities (only for ordinal)
stdranef(m, which = list(1), type = "lp")
stdranef(m, which = list(2), type = "lp")
stdranef(m, which = list(1, 2, c(1, 2)), type = "lp")
stdranef(m, type = "lp")
## error because no 3rd random effect
#stdranef(m, which = list(1, 2, 3), type = "lp")
stdranef(m, which = list("FSfamily", "plate"), type = "lp")
# mean standard deviations on the probability metric
# also the full distributions, if desired in the Data slot.
res <- stdranef(m, type = "response")
res$M # means
hist(res$Data$FSfamily[, 1]) # histogram
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.