| MC_error {JointAI} | R Documentation |
Calculate and plot the Monte Carlo error
Description
Calculate, print and plot the Monte Carlo error of the samples from a 'JointAI' model, combining the samples from all MCMC chains.
Usage
MC_error(x, subset = NULL, exclude_chains = NULL, start = NULL,
end = NULL, thin = NULL, digits = 2, warn = TRUE, mess = TRUE, ...)
## S3 method for class 'MCElist'
plot(x, data_scale = TRUE, plotpars = NULL,
ablinepars = list(v = 0.05), minlength = 20, ...)
Arguments
x |
object inheriting from class 'JointAI' |
subset |
subset of parameters/variables/nodes (columns in the MCMC
sample). Follows the same principle as the argument
|
exclude_chains |
optional vector of the index numbers of chains that should be excluded |
start |
the first iteration of interest
(see |
end |
the last iteration of interest
(see |
thin |
thinning interval (integer; see |
digits |
number of digits for the printed output |
warn |
logical; should warnings be given? Default is
|
mess |
logical; should messages be given? Default is
|
... |
Arguments passed on to
|
data_scale |
logical; show the Monte Carlo error of the sample
transformed back to the scale of the data ( |
plotpars |
optional; list of parameters passed to
|
ablinepars |
optional; list of parameters passed to
|
minlength |
number of characters the variable names are abbreviated to |
Value
An object of class MCElist with elements unscaled,
scaled and digits. The first two are matrices with
columns est (posterior mean), MCSE (Monte Carlo error),
SD (posterior standard deviation) and MCSE/SD
(Monte Carlo error divided by post. standard deviation.)
Functions
-
plot(MCElist): plot Monte Carlo error
Note
Lesaffre & Lawson (2012; p. 195) suggest the Monte Carlo error of a
parameter should not be more than 5% of the posterior standard
deviation of this parameter (i.e., MCSE/SD \le 0.05).
Long variable names:
The default plot margins may not be wide enough when variable names are
longer than a few characters. The plot margin can be adjusted (globally)
using the argument "mar" in par.
References
Lesaffre, E., & Lawson, A. B. (2012). Bayesian Biostatistics. John Wiley & Sons.
See Also
The vignette
Parameter Selection
provides some examples how to specify the argument subset.
Examples
## Not run:
mod <- lm_imp(y ~ C1 + C2 + M2, data = wideDF, n.iter = 100)
MC_error(mod)
plot(MC_error(mod), ablinepars = list(lty = 2),
plotpars = list(pch = 19, col = 'blue'))
## End(Not run)