binnest               package:repeated               R Documentation

_B_i_n_a_r_y _R_a_n_d_o_m _E_f_f_e_c_t_s _M_o_d_e_l_s _w_i_t_h _T_w_o _L_e_v_e_l_s _o_f _N_e_s_t_i_n_g

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

     'binnest' is designed to handle binary and binomial data with two
     levels of nesting. The first level is the individual and the
     second will consist of clusters within individuals.

     The variance components at the two levels can only depend on the
     covariates if 'response' has class, 'repeated'.

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

     binnest(response, totals=NULL, nest=NULL, ccov=NULL, tvcov=NULL,
             mu=~1, re1=~1, re2=~1, preg=NULL, pre1=NULL, pre2=NULL,
             binom.mix=c(10,10), binom.prob=c(0.5,0.5), fcalls=900,
             eps=0.01, print.level=0)

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

response: A list of three column matrices with counts, corresponding
          totals (not necessary if the response is binary), and
          (second-level) nesting indicator for each individual, one
          matrix or dataframe of such counts, or an object of class,
          response (created by 'restovec') or repeated (created by
          'rmna').

  totals: If 'response' is a matrix or dataframe, a corresponding
          matrix or dataframe of totals (not necessary if the response
          is binary). Ignored otherwise.

    nest: If 'response' is a matrix or dataframe, a corresponding
          matrix or dataframe of nesting indicators. Ignored otherwise.

    ccov: If 'response' is a matrix, dataframe, list, or object of
          class, 'response', a matrix of time-constant covariates or an
          object of class, 'tccov' (created by 'tcctomat'). All of
          these covariates are used in the fixed effects part of the
          model. Ignored if response has class, 'repeated'.

   tvcov: If 'response' is a matrix, dataframe, list, or object of
          class, 'response', an object of class, 'tvcov' (created by
          'tvctomat'). All of these covariates are used in the fixed
          effects part of the model. Ignored if response has class,
          'repeated'.

      mu: If 'response' has class, 'repeated', a formula beginning with
          ~, specifying a linear regression function for the fixed
          effects, in the Wilkinson and Rogers notation, containing
          selected covariates in the response object. (A logit link is
          assumed.)

     re1: If 'response' has class, 'repeated', a formula beginning with
          ~, specifying a linear regression function for the variance
          of the first level of nesting, in the Wilkinson and Rogers
          notation, containing selected covariates in the response
          object. If NULL, a random effect is not fitted at this level.
          (A log link is assumed.)

     re2: If 'response' has class, 'repeated', a formula beginning with
          ~, specifying a linear regression function for the variance
          of the second level of nesting, in the Wilkinson and Rogers
          notation, containing selected covariates in the response
          object. If NULL, a random effect is not fitted at this level.
          (A log link is assumed.)

    preg: Initial parameter estimates for the fixed effect regression
          model: either the model specified by 'mu' or else the
          intercept plus one for each covariate in 'ccov' and 'tvcov'.

    pre1: Initial parameter estimates for the first level of nesting
          variance model: either the model specified by 're1' or just
          the intercept. If NULL, a random effect is not fitted at this
          level.

    pre2: Initial parameter estimates for the second level of nesting
          variance model: either the model specified by 're1' or just
          the intercept. If NULL, a random effect is not fitted at this
          level.

binom.mix: A vector of two values giving the totals for the binomial
          distributions used as the mixing distributions at the two
          levels of nesting.

binom.prob: A vector of two values giving the probabilities in the
          binomial distributions used as the mixing distributions at
          the two levels of nesting. If they are 0.5, the mixing
          distributions approximate normal mixing distributions;
          otherwise, they are skewed.

  fcalls: Number of function calls allowed.

     eps: Convergence criterion.

print.level: If 1, the iterations are printed out.

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

     A list of classes 'binnest' is returned.

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

     T.R. Ten Have and J.K. Lindsey

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

     Ten Have, T.R., Kunselman, A.R., and Tran, L. (1999) Statistics in
     Medicine 18, 947-960.

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

     'gar', 'read.list', 'restovec', 'rmna', 'tcctomat', 'tvctomat'.

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

     #y <- rbind(matrix(rbinom(20,1,0.6), ncol=4),
     #       matrix(rbinom(20,1,0.4), ncol=4))
     y <- matrix(c(1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,0,0,1,0,1,1,0,1,0,
             1,1,1,1,1,1,1,1,0,1,1,0),nrow=10,ncol=4,byrow=TRUE)
     resp <- restovec(y, nest=1:4, times=FALSE)
     ccov <- tcctomat(c(rep(0,5),rep(1,5)), name="treatment")
     reps <- rmna(resp, ccov=ccov)
     # two random effects
     binnest(reps, mu=~treatment, preg=c(1,0), pre1=1, pre2=1)
     # first level random effect only
     binnest(reps, mu=~treatment, preg=c(1,-1), pre1=1)
     # second level random effect only
     binnest(reps, mu=~treatment, preg=c(1,-1), pre2=1)

