carma {growth} | R Documentation |
Continuous ARMA for Unequally Spaced Repeated Measurements
Description
carma
is designed to handle a polynomial within subject design matrix
with unequally spaced observations which can be at different times for
different subjects. The origin of time is taken as the mean time of all the
subjects. The within subject errors are assumed to be independent Gaussian
or have a continuous time ARMA(p,q) Gaussian structure with the option to
include measurement error. The between subject random coefficients are
assumed to have an arbitrary covariance matrix. The fixed effect design
matrix is a polynomial of equal or higher order than the within subject
design matrix. This matrix can be augmented by covariates multiplied by
polynomial design matrices of any order up to the order of the first
partition of the design matrix. The method is based on exact maximum
likelihood using the Kalman filter to calculate the likelihood.
Usage
carma(response = NULL, ccov = NULL, times = NULL, torder = 0,
interaction, arma = c(0, 0, 0), parma = NULL, pre = NULL,
position = NULL, iopt = TRUE, resid = TRUE,
transform = "identity", delta = NULL, envir = parent.frame(),
print.level = 0, typsize = abs(p), ndigit = 10, gradtol = 1e-05,
steptol = 1e-05, iterlim = 100, fscale = 1, stepmax = 10 * sqrt(p
%*% p))
## S3 method for class 'carma'
coef(object, ...)
## S3 method for class 'carma'
deviance(object, ...)
## S3 method for class 'carma'
residuals(object, recursive = TRUE, ...)
## S3 method for class 'carma'
print(x, digits = max(3, .Options$digits - 3),
correlation = TRUE, ...)
## S3 method for class 'carma'
mprofile(z, times = NULL, ccov, plotse = TRUE, ...)
Arguments
response |
A list of two column matrices with response values and times
for each individual, one matrix or dataframe of response values, or an
object of either class, |
ccov |
A matrix of columns of baseline covariates with one row per
individual, a model formula using vectors of the same size, or an object of
class, |
times |
When response is a matrix, a vector of possibly unequally
spaced times when they are the same for all individuals or a matrix of
times. Not necessary if equally spaced. Ignored if response has class,
|
torder |
Order of the polynomial in time to be fitted. |
interaction |
Vector indicating order of interactions of covariates with time. |
arma |
Vector of three values: order of AR, order of MA, binary indicator for presence of measurement error. Not required for an AR(1) if an initial estimate is supplied. If only one value is supplied, it is assumed to be the order of the AR. |
parma |
Initial estimates of ARMA parameters. For example, with
|
pre |
Initial estimates of random effect parameters. |
position |
Two column matrix with rows giving index positions of random effects in the covariance matrix. |
iopt |
TRUE if optimization should be performed. |
resid |
TRUE if residuals to be calculated. |
transform |
Transformation of the response variable: |
delta |
Scalar or vector giving the unit of measurement for each
response value, set to unity by default. For example, if a response is
measured to two decimals, |
envir |
Environment in which model formulae are to be interpreted or a
data object of class, |
print.level |
Arguments for nlm. |
typsize |
Arguments for nlm. |
ndigit |
Arguments for nlm. |
gradtol |
Arguments for nlm. |
steptol |
Arguments for nlm. |
iterlim |
Arguments for nlm. |
fscale |
Arguments for nlm. |
stepmax |
Arguments for nlm. |
object |
An object of class, |
... |
additional arguments. |
recursive |
If TRUE, recursive residuals or fitted values are given; otherwise, marginal ones. |
x |
An object of class, |
digits |
number of digits to print. |
correlation |
logical; print correlations. |
z |
An object of class, |
plotse |
Plot the standard errors around the marginal profile curve. |
Details
For clustered (non-longitudinal) data, where only random effects will be
fitted, times
are not necessary.
Marginal and individual profiles can be plotted using
mprofile
and iprofile
and
residuals with plot.residuals
.
For any ARMA of order superior to an AR(1), the (complex) roots of the characteristic equation are printed out; see Jones and Ackerson (1991) for their use in calculation of the covariance function.
Value
A list of class carma
is returned that contains all of the
relevant information calculated, including error codes.
Methods (by generic)
-
coef
: Coefficients -
deviance
: Deviance -
residuals
: Residuals -
print
: Print method -
mprofile
: Special marginal profiles with SEs
Author(s)
R.H. Jones and J.K. Lindsey
References
Jones, R. H. and Ackerson, L. M. (1991) Serial correlation in unequally spaced longitudinal data. Biometrika, 77, 721-731.
Jones, R.H. (1993) Longitudinal Data Analysis with Serial Correlation: A State-space Approach. Chapman and Hall
See Also
elliptic
, gar
,
gnlmix
, glmm
,
gnlmm
, iprofile
,
kalseries
, mprofile
,
plot.residuals
, potthoff
,
read.list
, restovec
,
rmna
, tcctomat
,
tvctomat
.
Examples
y <- matrix(rnorm(40),ncol=5)
x1 <- gl(2,4)
x2 <- gl(2,1,8)
# independence with time trend
carma(y, ccov=~x1, torder=2)
# AR(1)
carma(y, ccov=~x1, torder=2, arma=c(1,0,0), parma=-0.5)
carma(y, ccov=~x1, torder=3, interact=3, arma=c(1,0,0), parma=-1)
# ARMA(2,1)
carma(y, ccov=~x1+x2, interact=c(2,0), torder=3,arma=c(2,1,0),
parma=c(0.3,2,0.7))
# random intercept
carma(y, ccov=~x1+x2, interact=c(2,0), torder=3, pre=-0.4,
position=c(1,1))
# random coefficients
carma(y, ccov=~x1+x2, interact=c(2,0), torder=3, pre=c(-0.4,0.1),
position=rbind(c(1,1),c(2,2)))