
Linear mixed model with serial correlation and measurement error
Source:R/SerialCorrelationLmm.R
SerialCorrelation.RdSerialCorrelation: exponential, Gaussian or discrete AR(1) serial
correlation. LmmSerialCovariance: marginal covariance of one subject
(random intercept, serial process and measurement error).
LmmSerialLoglik: profile log-likelihood (ML or REML) with the fixed
effects and total scale profiled out. LmmSerialFit: Nelder-Mead fit of
the Diggle (1988) model, as nlme::lme with a random intercept and
corExp or corGaus with a nugget. Identical to the Python arm
morie.fn.serlmm.
Usage
SerialCorrelation(u, phi, kind = "exponential")
LmmSerialCovariance(times, sigma_b2, tau2, phi, nu2, kind = "exponential")
LmmSerialLoglik(
y,
X,
subject,
times,
sigma_b2,
tau2,
phi,
nu2,
kind = "exponential",
reml = FALSE
)
LmmSerialFit(
y,
X,
subject,
times,
kind = "exponential",
reml = FALSE,
start = NULL
)Arguments
- u
Time lags.
- phi
Correlation parameter.
- kind
"exponential","gaussian"or"ar1".- times
Observation times.
- sigma_b2
Random-intercept variance.
- tau2
Serial process variance.
- nu2
Measurement-error variance.
- y
Response.
- X
Design matrix including the intercept.
- subject
Subject identifiers (rows grouped in any order).
- reml
Use restricted maximum likelihood.
- start
Starting values of the square-root variance ratio, log phi and the nugget parameter r with share r^2 / (1 + r^2).
References
Diggle, P. J. (1988). An approach to the analysis of repeated measurements. Biometrics 44, 959-971.
Diggle, P. J., Heagerty, P., Liang, K.-Y. and Zeger, S. L. (2002). Analysis of Longitudinal Data, 2nd edn. Oxford University Press.
Examples
SerialCorrelation(0:2, 0.5)
#> [1] 1.0000000 0.6065307 0.3678794
LmmSerialCovariance(c(0, 1), 1, 2, 0.5, 0.25)
#> [,1] [,2]
#> [1,] 3.250000 2.213061
#> [2,] 2.213061 3.250000