rmna                 package:rmutil                 R Documentation

_C_r_e_a_t_e _a _r_e_p_e_a_t_e_d _o_b_j_e_c_t, _r_e_m_o_v_i_n_g _N_A_s

_D_e_s_c_r_i_p_t_i_o_n:

     `rmna' forms an object of class, repeated, from a response object
     and possibly time-varying covariate (tvcov), and time-constant
     covariate (tccov) objects, removing any response and covariate
     values that have NAs.

     Such objects can be printed and plotted.

_U_s_a_g_e:

     rmna(response, tvcov=NULL, ccov=NULL)

_A_r_g_u_m_e_n_t_s:

response: An object of class, response (created by `restovec'),
          containing the response variable information.

   tvcov: An object of class, tvcov (created by `tvctomat'), containing
          the time-varying covariate information.

   tccov: An object of class, tccov (created by `tcctomat'), containing
          the time-constant covariate information.

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

     Returns an object of class, repeated, containing a list of the
     response object (z$response, so that, for example, the response
     vector is z$response$y; see `restovec'), and possibly the two
     classes of covariate objects (z$ccov and z$tvcov).

     Methods are available for extracting the response, the numbers of
     observations per individual, the times, the weights, the nesting
     variable, and the covariates or their names: `response', `nobs',
     `times', `weights', `nesting', `covariates', and `names'.

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

     J.K. Lindsey

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

     `carma', `elliptic', `gettvc', `kalcount', `kalseries', `nbkal',
     `read.list', `restovec', `tcctomat', `tvctomat'.

_E_x_a_m_p_l_e_s:

     y <- matrix(rnorm(20),ncol=5)
     tt <- c(1,3,6,10,15)
     print(resp <- restovec(y,times=tt))
     x <- c(0,0,1,1)
     tcc <- tcctomat(x)
     z <- matrix(rpois(20,5),ncol=5)
     tvc <- tvctomat(z)
     print(reps <- rmna(resp, tvcov=tvc, ccov=tcc))
     response(reps)
     response(reps, nind=2:3)
     times(reps)
     nobs(reps)
     weights(reps)
     covariates(reps)
     covariates(reps,names="x")
     covariates(reps,names="z")
     names(reps)
     nesting(reps)
     # because individuals are the only nesting, this is the same as
     covind(reps)
     # binomial
     y <- matrix(rpois(20,5),ncol=5)
     print(respb <- restovec(y,totals=y+matrix(rpois(20,5),ncol=5),times=tt))
     print(repsb <- rmna(respb, tvcov=tvc, ccov=tcc))
     response(repsb)
     # censored data
     y <- matrix(rweibull(20,2,5),ncol=5)
     print(respc <- restovec(y,censor=matrix(rbinom(20,1,0.9),ncol=5),times=tt))
     print(repsc <- rmna(respc, tvcov=tvc, ccov=tcc))
     # if there is no censoring, censor indicator is not printed
     response(repsc)
     # nesting clustered within individuals
     nest <- c(1,1,2,2,2)
     print(respn <- restovec(y,censor=matrix(rbinom(20,1,0.9),ncol=5),
             times=tt,nest=nest))
     print(repsn <- rmna(respn, tvcov=tvc, ccov=tcc))
     response(respn)
     times(respn)
     nesting(respn)

