Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

nbkal

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.

Usage

nbkal(response, times, mu, preg, pdepend, kalman = TRUE,
  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, 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.

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

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

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.

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)

repeated

Non-Normal Repeated Measurements Models

v1.1.2
GPL-2
Authors
Bruce Swihart [cre, aut], Jim Lindsey [aut] (Jim created this package, Bruce is maintaining the CRAN version), T.R. Ten Have [ctb, cph] (Wrote Logit_bin_nest.f90 (in binnest.f).), Richard Cook [ctb, cph] (Wrote calcs.c, calcs.h, calcs1.c, calcs1.h, calcs2.c, calcs2.h, calcs3.c, calcs3.h, calcs4.c, calcs4.h; defs.h; gaps.c, gaps.h.), Iain MacDonald [ctb, cph] (Wrote chidden.f, cphidden.f, hidden.f.), Walter Zucchini [ctb, cph] (Wrote chidden.f, cphidden.f, hidden.f.), Burton Garbow [ctb, cph] (Wrote eigen.f.), Euginia Zharichenko [ctb, cph] (Wrote logitord.f.)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.