R/stanfit.R
extract_diagnostics.Rd
Extract MCMC convergence and posterior predictive diagnostics.
extract_diagnostics(stanfit, pars = select_obs_parameters(stanfit), trueParameters = NULL)
stanfit | An object returned by either |
---|---|
pars | A vector of characters with the name of the quantities to be extracted. The characters strings may include regular expressions. Further, wildcards are automatically translated into regex: ? matches a single character, while * matches any character string including an empty one. For example, ?pred will match both ypred and zpred, and z* will match zstar and zpred. It defaults to all the observation model parameters. |
trueParameters | An optional numeric vector with the true value of the parameter vector. |
A named list with two elements. The first element chains is a data.frame with Markov-chain Monte Carlo convergence diagnostics (number of divergences, number of times max tree depth is reached, maximum leapfrogs, warm up and sampling times) and posterior predictive checks (observation ranks, Kolmogorov-Smirnov statistic for observed sample vs posterior predictive samples). The second element, parameters, compare true versus estimated values for the unknown quantities (mean, sd, quantiles and other posterior measures, Monte Carlo standard error, estimated sample size, R Hat, and rank).