TMBoneStepPredict: Calculate one-step-ahead (OSA) residuals for a latent...

View source: R/TMBoneStepPredict.R

TMBoneStepPredictR Documentation

Calculate one-step-ahead (OSA) residuals for a latent variable model.

Description

Calculate one-step-ahead (OSA) residuals for a latent variable model. (Modified from TMB version to allow easier parallel computations)

Usage

TMBoneStepPredict(
  obj,
  observation.name = NULL,
  data.term.indicator = NULL,
  method = c("oneStepGaussianOffMode", "fullGaussian", "oneStepGeneric",
    "oneStepGaussian", "cdf"),
  subset = NULL,
  conditional = NULL,
  discrete = NULL,
  discreteSupport = NULL,
  range = c(-Inf, Inf),
  seed = 123,
  parallel = FALSE,
  ncores = 2,
  trace = TRUE,
  reverse = (method == "oneStepGaussianOffMode"),
  ...
)

Arguments

obj

Output from MakeADFun.

observation.name

Character naming the observation in the template.

data.term.indicator

Character naming an indicator data variable in the template (not required by all methods - see details).

method

Method to calculate OSA (see details).

subset

Index vector of observations that will be added one by one during OSA. By default 1:length(observations) (with conditional subtracted).

conditional

Index vector of observations that are fixed during OSA. By default the empty set.

discrete

Are observations discrete? (assumed FALSE by default)

discreteSupport

Possible outcomes of discrete distribution (method="oneStepGeneric" only).

range

Possible range of the observations.

seed

Randomization seed (discrete case only). If NULL the RNG seed is untouched by this routine.

parallel

Run in parallel using the parallel package?

ncores

number of threads to run in parallel. Ignored if parallel = FALSE

trace

Trace progress?

reverse

Do calculations in opposite order to improve stability ? (currently enabled by default for oneStepGaussianOffMode method only)

...

Control parameters for OSA method

Value

data.frame with OSA standardized residuals in column residual. Depending on the method the output may also include OSA expected observation in column mean.


ianjonsen/mpmm documentation built on Dec. 7, 2022, 4:27 a.m.