% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ctKalman.R
\name{ctKalmanArray}
\alias{ctKalmanArray}
\alias{ctStanKalman}
\title{Get Kalman filter estimates from a ctStanFit object}
\usage{
ctKalmanArray(
  fit,
  nsamples = NA,
  pointest = TRUE,
  collapsefunc = NA,
  cores = 1,
  subjects = 1:max(fit$standata$subject),
  timestep = "asdata",
  maxtime = "asdata",
  standardisederrors = FALSE,
  subjectpars = TRUE,
  tformsubjectpars = TRUE,
  indvarstates = FALSE,
  removeObs = F,
  ...
)
}
\arguments{
\item{fit}{fit object from \code{\link{ctFit}}.}

\item{nsamples}{either NA (to extract all) or a positive integer from 1 to maximum samples in the fit.}

\item{pointest}{If TRUE, uses the posterior mode as the single sample.}

\item{collapsefunc}{function to apply over samples, such as \code{mean}}

\item{cores}{Integer number of cpu cores to use. Only needed if savescores was set to FALSE when fitting.}

\item{subjects}{integer vector of subjects to compute for.}

\item{timestep}{Either a positive numeric value, 'asdata' to use the times in the dataset, or 'auto' to select 
a timestep automatically (resulting in some interpolation but not excessive computation).}

\item{maxtime}{only relevant if timestep is not 'asdata'. Positive numeric denoting max time for computations.}

\item{standardisederrors}{If TRUE, computes standardised errors for prior, upd, smooth conditions.}

\item{subjectpars}{if TRUE, state estimates are not returned, instead, predictions of each subjects parameters
are returned, for parameters that had random effects specified.}

\item{tformsubjectpars}{if FALSE, subject level parameters are returned in raw, pre transformation form.}

\item{indvarstates}{if TRUE, do not remove indvarying states from output}

\item{removeObs}{Logical or integer. If TRUE, observations (but not covariates)
are set to NA, so only expectations based on parameters and covariates are returned. If a positive integer N, 
every N observations are retained while others are set NA for computing model expectations -- useful for observing prediction performance
forward further in time than one observation.}

\item{...}{additional arguments to collpsefunc.}
}
\value{
list containing Kalman filter elements, each element in array of
iterations, data row, variables. llrow is the log likelihood for each row of data.
}
\description{
Get Kalman filter estimates from a ctStanFit object
}
\examples{
k=ctKalmanArray(ctstantestfit,subjectpars=TRUE,collapsefunc=mean)
}
