acfresid | R Documentation |
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.
acfresid(object, maxLag, resLevel = "marginal", resType = "normalized",
calcCI = FALSE, levelCI, MCiter, seed)
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. |
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.
Fernanda L. Schumacher, Larissa A. Matos and Victor H. Lachos
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.
smn.lmm
, smsn.lmm
, plot.acfresid
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.