nbkal {repeated}R Documentation

Negative Binomial Models with Kalman Update

Description

nbkal fits a negative binomial regression with Kalman update over time. The variance is proportional to the mean function, whereas, for kalcount with exponential intensity, it is a quadratic function of the mean.

Marginal and individual profiles can be plotted using mprofile and iprofile and residuals with plot.residuals.

Usage

nbkal(response, times, mu, preg, pdepend, kalman=TRUE,
        print.level=0, ndigit=10, gradtol=0.00001, steptol=0.00001,
        fscale=1, iterlim=100, typsiz=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, response (created by restovec) or repeated (created by rmna or lvna).
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.
mu The mean function.
preg The initial parameter estimates for the mean function.
pdepend The estimates for the dependence parameters, either one or three.
kalman If TRUE, fits the kalman update model, otherwise, a standard negative binomial distribution.
others Arguments controlling nlm.

Value

A list of classes nbkal and recursive is returned.

Author(s)

P. Lambert and J.K. Lindsey

References

Lambert, P. (1996) Applied Statistics 45, 31-38.

Lambert, P. (1996) Biometrics 52, 50-55.

See Also

gar, gnlmm, gnlr, iprofile kalcount, mprofile, read.list, rmna, restovec, tcctomat, tvctomat.

Examples

y <- matrix(rnbinom(20,5,0.5), ncol=5)
times <- matrix(rep(seq(10,50,by=10),4), ncol=5, byrow=TRUE)
y0 <- matrix(rep(rnbinom(5,5,0.5),4), ncol=5, byrow=TRUE)
mu <- function(p) p[1]*log(y0)+(times<30)*p[2]*
        (times-30)+(times>30)*p[3]*(times-30)
nbkal(y, preg=c(1.3,0.008,-0.05), times=times, pdep=1.2, mu=mu)

[Package repeated version 1.0 Index]