nbkal                package:repeated                R Documentation

_N_e_g_a_t_i_v_e _B_i_n_o_m_i_a_l _M_o_d_e_l _w_i_t_h _K_a_l_m_a_n _U_p_d_a_t_e

_D_e_s_c_r_i_p_t_i_o_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'.

_U_s_a_g_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_r_g_u_m_e_n_t_s:

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

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

_V_a_l_u_e:

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

_A_u_t_h_o_r(_s):

     J.K. Lindsey

_R_e_f_e_r_e_n_c_e_s:

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

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

_S_e_e _A_l_s_o:

     `gar', `gnlmm', `gnlr', `iprofile' `kalcount', `profile'
     `read.list', `rmna', `restovec', `tcctomat', `tvctomat'.

_E_x_a_m_p_l_e_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)

