pseudoRes {momentuHMM} | R Documentation |
Pseudo-residuals
Description
The pseudo-residuals of momentuHMM models, as described in Zucchini and McDonad (2009).
Usage
pseudoRes(m, ncores = 1)
Arguments
m |
A |
ncores |
number of cores to use for parallel processing |
Details
If some turning angles in the data are equal to pi, the corresponding pseudo-residuals will not be included. Indeed, given that the turning angles are defined on (-pi,pi], an angle of pi results in a pseudo-residual of +Inf (check Section 6.2 of reference for more information on the computation of pseudo-residuals).
A continuity adjustment (adapted from Harte 2017) is made for discrete probability distributions. When the data are near the boundary (e.g. 0 for “pois”; 0 and 1 for “bern”), then the pseudo residuals can be a poor indicator of lack of fit.
For multiple imputation analyses, if m
is a miHMM
object or a list of momentuHMM
objects, then
the pseudo-residuals are individually calculated for each model fit. Note that pseudo-residuals for miSum
objects (as returned by MIpool
) are based on pooled parameter
estimates and the means of the data values across all imputations (and therefore may not be particularly meaningful).
Value
If m
is a momentuHMM
, miHMM
, or miSum
object, a list of pseudo-residuals for each data stream (e.g., 'stepRes', 'angleRes') is returned.
If m
is a list of momentuHMM
objects, then a list of length length(m)
is returned where each element is a list of pseudo-residuals for each data stream.
References
Harte, D. 2017. HiddenMarkov: Hidden Markov Models. R package version 1.8-8.
Zucchini, W. and MacDonald, I.L. 2009. Hidden Markov Models for Time Series: An Introduction Using R. Chapman & Hall (London).
Examples
# m is a momentuHMM object (as returned by fitHMM), automatically loaded with the package
m <- example$m
res <- pseudoRes(m)
stats::qqnorm(res$stepRes)
stats::qqnorm(res$angleRes)