acfresid {skewlmm} | R Documentation |
Autocorrelation function for smn.lmm or smsn.lmm residuals
Description
This function calculates the empirical autocorrelation function for the within-subject residuals from a smn.lmm or smsn.lmm fit. The autocorrelation values are calculated using pairs of residuals within-subjects. The autocorrelation function is useful for investigating serial correlation models for discrete-time data, preferably equally spaced.
Usage
acfresid(object, maxLag, resLevel = "marginal", resType = "normalized",
calcCI = FALSE, levelCI, MCiter, seed)
Arguments
object |
An object inheriting from class |
maxLag |
An optional integer giving the maximum lag for which the autocorrelation should be calculated. Defaults to maximum lag in the within-subject residuals. |
resLevel |
|
resType |
|
calcCI |
|
levelCI |
An optional numeric value in |
MCiter |
An optional discrete value indicating the number of Monte Carlo samples that should be used to compute the confidence intervals. Default is |
seed |
An optional value used to specify seeds inside the function. Default is to use a random seed. |
Value
A data frame with columns lag, ACF, and n.used representing, respectively, the lag between residuals within a pair, the corresponding empirical autocorrelation, and the number of pairs used. If calcCI=TRUE
, the data frame has two extra columns containing the confidence intervals for the conditionally independent model. The returned value inherits from class acfresid.
Author(s)
Fernanda L. Schumacher, Larissa A. Matos and Victor H. Lachos
References
Pinheiro, J. C. & Bates, D. M. (2000). Mixed-Effects Models in S and S-PLUS. Springer, New York, NY.
Schumacher, F. L., Lachos, V. H., and Matos, L. A. (2021). Scale mixture of skew-normal linear mixed models with within-subject serial dependence. Statistics in Medicine 40(7), 1790-1810.
See Also
smn.lmm
, smsn.lmm
, plot.acfresid
Examples
fm1 = smn.lmm(distance ~ age+Sex, data=nlme::Orthodont, groupVar="Subject")
acf1 = acfresid(fm1)
acf1
plot(acf1)
## computing simulated bands
acfCI = acfresid(fm1, calcCI=TRUE)
plot(acfCI)