% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/stanfit.R
\name{extract_diagnostics.stanfit}
\alias{extract_diagnostics.stanfit}
\title{Extract MCMC convergence and posterior predictive diagnostics.}
\usage{
\method{extract_diagnostics}{stanfit}(stanfit,
  pars = select_obs_parameters(stanfit), trueParameters = NULL)
}
\arguments{
\item{stanfit}{An object returned by either \code{\link{fit}} or \code{\link{draw_samples}}.}

\item{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: \emph{?} matches a single character, while \emph{*} matches any character string including an empty one. For example, \emph{?pred} will match both ypred and zpred, and \emph{z*} will match zstar and zpred. It defaults to all the observation model parameters.}

\item{trueParameters}{An optional numeric vector with the true value of the parameter vector.}
}
\value{
A named list with two elements. The first element \emph{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, \emph{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).
}
\description{
Extract MCMC convergence and posterior predictive diagnostics.
}
\keyword{internal}
