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 SMN or SMSN, representing a fitted scale mixture of (skew) normal linear mixed model.

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

"marginal" (default) or "conditional". An optional character string specifying which residual should be used. For details see residuals.SMN.

resType

"response", "normalized" (default), or "modified". An optional character string specifying which type of residual should be used. For details see residuals.SMN.

calcCI

TRUE or FALSE (default). A logical value indicating if Monte Carlo confidence intervals should be computed for the conditionally independent model, which can be used for testing if the autocorrelations are zero.

levelCI

An optional numeric value in (0,1) indicating the confidence level that should be used in the Monte Carlo confidence intervals. Default is 0.95.

MCiter

An optional discrete value indicating the number of Monte Carlo samples that should be used to compute the confidence intervals. Default is 300.

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)
  

[Package skewlmm version 1.1.0 Index]