View source: R/mcmc.diagnostics.ergm.R
mcmc.diagnostics | R Documentation |
This function prints diagnistic information and creates simple diagnostic plots for MCMC sampled statistics produced from a fit.
mcmc.diagnostics(object, ...)
## S3 method for class 'ergm'
mcmc.diagnostics(
object,
center = TRUE,
esteq = TRUE,
vars.per.page = 3,
which = c("plots", "texts", "summary", "autocorrelation", "crosscorrelation", "burnin"),
compact = FALSE,
...
)
object |
A model fit object to be diagnosed. |
... |
Additional arguments, to be passed to plotting functions. |
center |
Logical: If |
esteq |
Logical: If |
vars.per.page |
Number of rows (one variable per row) per plotting page. Ignored if latticeExtra package is not installed. |
which |
A character vector specifying which diagnostics to plot and/or print. Defaults to all of the below if meaningful:
Partial matching is supported. (E.g., |
compact |
Numeric: For diagnostics that print variables in
columns (e.g. correlations, hypothesis test p-values), try to
abbreviate variable names to this many characters and round the
numbers to |
A pair of plots are produced for each statistic:a trace of the sampled output statistic values on the left and density estimate for each variable in the MCMC chain on the right. Diagnostics printed to the console include correlations and convergence diagnostics.
For ergm()
specifically, recent changes in the
estimation algorithm mean that these plots can no longer be used
to ensure that the mean statistics from the model match the
observed network statistics. For that functionality, please use
the GOF command: gof(object, GOF=~model)
.
In fact, an ergm()
output object contains the sample of
statistics from the last MCMC run as element $sample
. If
missing data MLE is fit, the corresponding element is named
$sample.obs
. These are objects of mcmc
and can be used
directly in the coda package to assess MCMC
convergence.
More information can be found by looking at the documentation of
ergm()
.
mcmc.diagnostics(ergm)
:
Raftery, A.E. and Lewis, S.M. (1995). The number of iterations, convergence diagnostics and generic Metropolis algorithms. In Practical Markov Chain Monte Carlo (W.R. Gilks, D.J. Spiegelhalter and S. Richardson, eds.). London, U.K.: Chapman and Hall.
ergm()
, network package, coda package,
summary.ergm()
## Not run:
#
data(florentine)
#
# test the mcmc.diagnostics function
#
gest <- ergm(flomarriage ~ edges + kstar(2))
summary(gest)
#
# Plot the probabilities first
#
mcmc.diagnostics(gest)
#
# Use coda directly
#
library(coda)
#
plot(gest$sample, ask=FALSE)
#
# A full range of diagnostics is available
# using codamenu()
#
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.