

   NNeeggaattiivvee BBiinnoommiiaall MMooddeell wwiitthh KKaallmmaann UUppddaattee

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

   AArrgguummeennttss::

   response: A list of two column matrices with counts and cor-
             responding times for each individual, one matrix
             or dataframe of counts, or an object of class,
             response (created by `restovec') or repeated (cre-
             ated by `rmna').

      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 neces-
             sary if equally spaced. Ignored if response has
             class, response or repeated.

         mu: The mean function.

       preg: The initial parameter estimates for the mean func-
             tion.

    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'.

   DDeessccrriippttiioonn::

        `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
        `profile' and `iprofile' and residuals with
        `plot.residuals'.

   VVaalluuee::

        A list of classes `nbkal' and `recursive' is returned.

   AAuutthhoorr((ss))::

        J.K. Lindsey

   RReeffeerreenncceess::

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

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

   SSeeee AAllssoo::

        `gar', `gnlmm', `gnlr', `iprofile' `kalcount', `pro-
        file' `read.list', `rmna', `restovec', `tcctomat',
        `tvctomat'.

   EExxaammpplleess::

        y <- matrix(rnbinom(20,5,0.5), ncol=5)
        times <- matrix(rep(seq(10,50,by=10),4), ncol=5, byrow=T)
        y0 <- matrix(rep(rnbinom(5,5,0.5),4), ncol=5, byrow=T)
        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)

