diagnostics {RoBMA} | R Documentation |
Checks a fitted RoBMA object
Description
diagnostics
creates visual
checks of individual models convergence. Numerical
overview of individual models can be obtained by
summary(object, type = "models", diagnostics = TRUE)
,
or even more detailed information by
summary(object, type = "individual")
.
Usage
diagnostics(
fit,
parameter,
type,
plot_type = "base",
show_models = NULL,
lags = 30,
title = is.null(show_models) | length(show_models) > 1,
...
)
diagnostics_autocorrelation(
fit,
parameter = NULL,
plot_type = "base",
show_models = NULL,
lags = 30,
title = is.null(show_models) | length(show_models) > 1,
...
)
diagnostics_trace(
fit,
parameter = NULL,
plot_type = "base",
show_models = NULL,
title = is.null(show_models) | length(show_models) > 1,
...
)
diagnostics_density(
fit,
parameter = NULL,
plot_type = "base",
show_models = NULL,
title = is.null(show_models) | length(show_models) > 1,
...
)
Arguments
fit |
a fitted RoBMA object |
parameter |
a parameter to be plotted. Either
|
type |
type of MCMC diagnostic to be plotted.
Options are |
plot_type |
whether to use a base plot |
show_models |
MCMC diagnostics of which models should be
plotted. Defaults to |
lags |
number of lags to be shown for
|
title |
whether the model number should be displayed in title.
Defaults to |
... |
additional arguments to be passed to
par if |
Details
The visualization functions are based on stan_plot function and its color schemes.
Value
diagnostics
returns either NULL
if plot_type = "base"
or an object/list of objects (depending on the number of parameters to be plotted)
of class 'ggplot2' if plot_type = "ggplot2"
.
See Also
Examples
## Not run:
# using the example data from Anderson et al. 2010 and fitting the default model
# (note that the model can take a while to fit)
fit <- RoBMA(r = Anderson2010$r, n = Anderson2010$n, study_names = Anderson2010$labels)
### ggplot2 version of all of the plots can be obtained by adding 'model_type = "ggplot"
# diagnostics function allows to visualize diagnostics of a fitted RoBMA object, for example,
# the trace plot for the mean parameter in each model model
diagnostics(fit, parameter = "mu", type = "chain")
# in order to show the trace plot only for the 11th model, add show_models parameter
diagnostics(fit, parameter = "mu", type = "chain", show_models = 11)
# furthermore, the autocorrelations
diagnostics(fit, parameter = "mu", type = "autocorrelation")
# and overlying densities for each plot can also be visualize
diagnostics(fit, parameter = "mu", type = "densities")
## End(Not run)