kalcount {repeated} | R Documentation |
Repeated Measurements Models for Counts with Frailty or Serial Dependence
Description
kalcount
is designed to handle repeated measurements models with
time-varying covariates. The distributions have two extra parameters as
compared to the functions specified by intensity
and are generally
longer tailed than those distributions. Dependence among observations on a
unit can be through gamma or power variance family frailties (a type of
random effect), with or without autoregression, or serial dependence over
time.
Usage
kalcount(
response = NULL,
times = NULL,
origin = 0,
intensity = "exponential",
depend = "independence",
update = "Markov",
mu = NULL,
shape = NULL,
density = FALSE,
ccov = NULL,
tvcov = NULL,
preg = NULL,
ptvc = NULL,
pbirth = NULL,
pintercept = NULL,
pshape = NULL,
pinitial = 1,
pdepend = NULL,
pfamily = NULL,
envir = parent.frame(),
print.level = 0,
ndigit = 10,
gradtol = 1e-05,
steptol = 1e-05,
fscale = 1,
iterlim = 100,
typsize = abs(p),
stepmax = 10 * sqrt(p %*% p)
)
Arguments
response |
A list of two column matrices with counts and corresponding
times for each individual, one matrix or dataframe of counts, 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,
|
origin |
If the time origin is to be before the start of observations, a positive constant to be added to all times. |
intensity |
The form of function to be put in the Pareto distribution. Choices are exponential, Weibull, gamma, log normal, log logistic, log Cauchy, log Student, and gen(eralized) logistic. |
depend |
Type of dependence. Choices are |
update |
Type of for serial dependence. Choices are |
mu |
A regression function for the location parameter or a formula
beginning with ~, specifying either a linear regression function in the
Wilkinson and Rogers notation (a log link is assumed) or a general function
with named unknown parameters. Give the initial estimates in |
shape |
A regression function for the shape parameter or a formula beginning with ~, specifying either a linear regression function in the Wilkinson and Rogers notation or a general function with named unknown parameters. It must yield one value per observation. |
density |
If TRUE, the density of the function specified in
|
ccov |
A vector or matrix containing time-constant baseline covariates
with one row per individual, a model formula using vectors of the same
size, or an object of class, |
tvcov |
A list of matrices with time-varying covariate values,
observed in the time periods in |
preg |
Initial parameter estimates for the regression model: intercept
plus one for each covariate in |
ptvc |
Initial parameter estimates for the coefficients of the
time-varying covariates, as many as in |
pbirth |
If supplied, this is the initial estimate for the coefficient of the birth model. |
pintercept |
The initial estimate of the intercept for the generalized logistic intensity. |
pshape |
An initial estimate for the shape parameter of the intensity
function (except exponential intensity). If |
pinitial |
An initial estimate for the initial parameter. With
|
pdepend |
An initial estimate for the serial dependence parameter. For
|
pfamily |
An optional initial estimate for the second parameter of a
two-parameter power variance family mixture instead of the default gamma
mixture. This yields a gamma mixture as |
envir |
Environment in which model formulae are to be interpreted or a
data object of class, |
print.level |
Arguments for nlm. |
ndigit |
Arguments for nlm. |
gradtol |
Arguments for nlm. |
steptol |
Arguments for nlm. |
fscale |
Arguments for nlm. |
iterlim |
Arguments for nlm. |
typsize |
Arguments for nlm. |
stepmax |
Arguments for nlm. |
Details
By default, a gamma mixture of the distribution specified in
intensity
is used, as the conditional distribution in the
serial
dependence models, and as a symmetric multivariate (random
effect) model for frailty
dependence.
Unless specified otherwise, the time origin is taken to be zero. The given times are the ends of the periods in which the counts occurred.
Here, the variance, with exponential intensity, is a quadratic function of
the mean, whereas, for nbkal
, it is proportional to
the mean function.
If the counts on a unit are clustered, not longitudinal, use the failty dependence with the default exponential intensity, yielding a multivariate negative binomial distribution.
Nonlinear regression models can be supplied as formulae where parameters
are unknowns in which case factor variables cannot be used and parameters
must be scalars. (See finterp
.)
Marginal and individual profiles can be plotted using
mprofile
and iprofile
and
residuals with plot.residuals
.
Value
A list of classes kalcount
and recursive
is returned.
Author(s)
J.K. Lindsey
Examples
treat <- c(0,0,1,1)
tr <- tcctomat(treat)
dose <-
matrix(c(9,13,16,7,12,6,9,10,11,9,10,10,7,9,9,9,8,10,15,4),
ncol=5,byrow=TRUE)
dd <- tvctomat(dose)
y <- restovec(structure(c(6, 4, 0, 0, 3, 6, 1, 1, 1, 5, 0, 0, 0, 4, 0, 1, 0,
13, 0, 3), dim = 4:5))
reps <- rmna(y, ccov=tr, tvcov=dd)
kalcount(y, intensity="log normal", dep="independence",
preg=0.3, pshape=0.1)
kalcount(y, intensity="log normal", dep="frailty", pinitial=0.1,
preg=1, psh=0.1)
kalcount(y, intensity="log normal", dep="serial", pinitial=0.1,
preg=1, pdep=0.75, psh=0.1)
# random effect and autoregression (commented out: AR difficult to estimate)
#kalcount(y, intensity="log normal", dep="frailty", pinitial=0.1,
# pdep=0.5, preg=1, psh=0.1)
# add time-constant variable
kalcount(y, intensity="log normal", pinitial=1, psh=1,
preg=c(0.8,0.11), ccov=treat)
# or
kalcount(y, intensity="log normal", mu=~b0+b1*treat,
pinitial=1, psh=.1, preg=c(0.4,-0.04), envir=reps)
# add time-varying variable
kalcount(y, intensity="log normal", pinitial=1, psh=1,
preg=c(-1,2), ccov=treat, ptvc=0, tvc=dose)
# or equivalently, from the environment
dosev <- as.vector(t(dose))
kalcount(y, intensity="log normal", mu=~b0+b1*rep(treat,rep(5,4))+b2*dosev,
pinitial=1, psh=1, ptvc=c(-1,2,0))
# or from the reps data object
kalcount(y, intensity="log normal", mu=~b0+b1*treat+b2*dose,
pinitial=1, psh=1, ptvc=c(-1,2,0), envir=reps)
# try power variance family
kalcount(y, intensity="log normal", mu=~b0+b1*treat+b2*dose,
pinitial=1, psh=1, ptvc=c(-1,2,0.1), envir=reps,
pfamily=0.8)