% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/extract.R
\name{extract_alpha}
\alias{extract_alpha}
\title{Extract the estimates of the filtered probability (alpha).}
\usage{
extract_alpha(fit, reduce = NULL, combine = NULL, chain = "all", ...)
}
\arguments{
\item{fit}{An object returned by either \code{\link{draw_samples}} or \code{\link{optimizing}}.}

\item{reduce}{A function to be applied to all the samples generated by one chain for each parameters (i.e. "within chain"). Useful if only one or more summary measures of the generated samples is needed (e.g. the median of the generated sample). The function may return one of more elements. In the former case, the dimension is dropped in the returned object (read the \emph{Value} section below). Note that the user needs to supply a function as an argument, and not a character string with the name of the function.}

\item{combine}{A function applied to all the extracted quantities as an ensemble. In other words, instead of returning a named list where each element is one quantity, it returns the value returned by the function applied to the whole list (\code{\link{do.call}}). Useful when all the elements of the list have the same dimension, possibly because it is used in conjunction with the \emph{chain} and \emph{reduce} arguments.}

\item{chain}{Either "all" or any integer number between 1 and the number of chains M.}

\item{...}{Arguments to be passed to rstan's \code{\link[rstan]{extract}} if the object \emph{fit} was returned by \code{\link{fit}} or \code{\link{draw_samples}}.}
}
\value{
A numeric array with four dimensions [N, M, K, T]: number of iterations \emph{N}, number of chains \emph{M}, number of hidden states \emph{K}, length of the time series {T}. If the argument \emph{chain} was set, the chain dimension is dropped and the function returns a three-dimensional numeric array [N, K, T]. If the argument \emph{reduce} was set to a function returning a vector of size \emph{n}, the returned array has dimension [n, M, K, T]. When \emph{n} is simply one (e.g. \code{\link{median}}), the number-of-iterations dimension is dropped and the function returns a three-dimensional numeric array [M, K, T].
}
\description{
Extract the estimates of the filtered probability (alpha).
}
\seealso{
Other extract: \code{\link{extract_K}},
  \code{\link{extract_R}}, \code{\link{extract_T}},
  \code{\link{extract_data}},
  \code{\link{extract_filename}},
  \code{\link{extract_gamma}}, \code{\link{extract_model}},
  \code{\link{extract_obs_parameters}},
  \code{\link{extract_parameters}},
  \code{\link{extract_spec}}, \code{\link{extract_ypred}},
  \code{\link{extract_ysim}}, \code{\link{extract_y}},
  \code{\link{extract_zpred}}, \code{\link{extract_zsim}},
  \code{\link{extract_zstar}}, \code{\link{extract}}
}
\concept{extract}
