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.

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.

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, typsiz=abs(p), ndigit=10, gradtol=0.00001,
        steptol=0.00001, iterlim=100, fscale=1, stepmax=10*sqrt(p%*%p))
fitted.carma(z, recursive=TRUE)
mprofile.carma(z, times=NULL, ccov, plotse=TRUE)
residuals.carma(z, recursive=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, response (created by restovec) or repeated (created by rmna or lvna). If the repeated data object contains more than one response variable, give that object in envir and give the name of the response variable to be used here.
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, tccov (created by tcctomat). If response has class, repeated, the covariates must be specified as a Wilkinson and Rogers formula unless none are to be used.
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, response or repeated.
torder Order of the polynomial in time to be fitted.
interaction Vector indicating order of interactions of covariates with time.
transform Transformation of the response variable: identity, exp, square, sqrt, or log.
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 arma=c(1,0,0), an AR(1), the parameter is parma[1]=log(theta), where theta is the positive, continuous time autoregressive coefficient. The finite step autoregression coefficient for a step of length delta is then alpha=exp(-delta*theta) i.e. alpha=exp(-delta*exp(parma[1])).
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.
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, delta=0.01. Ignored if response has class, response or repeated.
envir Environment in which model formulae are to be interpreted or a data object of class, repeated, tccov, or tvcov; the name of the response variable should be given in response. If response has class repeated, it is used as the environment.
others Arguments controlling nlm.
z An object of class, carma.
plotse Plot the standard errors around the marginal profile curve.
recursive If TRUE, recursive residuals or fitted values are given; otherwise, marginal ones.

Value

A list of class carma is returned that contains all of the relevant information calculated, including error codes.

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)))

[Package growth version 1.0 Index]