seq2binomial              package:VGAM              R Documentation

_T_h_e _T_w_o-_s_t_a_g_e _S_e_q_u_e_n_t_i_a_l _B_i_n_o_m_i_a_l _D_i_s_t_r_i_b_u_t_i_o_n _F_a_m_i_l_y _F_u_n_c_t_i_o_n

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

     Estimation of the probabilities of a two-stage binomial
     distribution.

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

     seq2binomial(lprob1 = "logit", lprob2 = "logit", eprob1 = list(),
                  eprob2 = list(), iprob1 = NULL, iprob2 = NULL, zero = NULL)

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

lprob1, lprob2: Parameter link functions applied to the two
          probabilities, called p and q below. See 'Links' for more
          choices.

eprob1, eprob2: Lists. Extra arguments for the links. See 'earg' in
          'Links' for general information.

iprob1, iprob2: Optional initial value for the first and second
          probabilities respectively. A 'NULL' means a value is
          obtained in the 'initialize' slot.

    zero: An integer-valued vector specifying which linear/additive
          predictors are modelled as intercepts only. If used, the
          value must be from the set {1,2} which correspond to the
          first and second probabilities respectively. A 'NULL' value
          means none.

_D_e_t_a_i_l_s:

     This 'VGAM' family function fits the model described by Crowder
     and Sweeting (1989) which is described as follows. Each of m
     spores has a probability p of germinating. Of the y1 spores that
     germinate, each has a probability q of bending in a particular
     direction. Let y2 be the number that bend in the specified
     direction. The probability model for this data is P(y1,y2) =

 {choose(m,y1)} p^{y1} (1-p)^{m-y1} {choose(y1,y2)} q^{y2} (1-q)^{y1-y2}

     for 0 < p < 1, 0 < q < 1, y1=1,...,m and y2=1,...,y1. Here, p is
     'prob1', q is 'prob2'.

     Although the Authors refer to this as the _bivariate binomial_
     model, I have named it the _(two-stage) sequential binomial_
     model. Fisher scoring is used.

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

     An object of class '"vglmff"' (see 'vglmff-class'). The object is
     used by modelling functions such as 'vglm' and 'vgam'.

_N_o_t_e:

     The response must be a two-column matrix of sample proportions
     corresponding to y1 and y2. The m values should be inputted with
     the 'weights' argument of 'vglm' and 'vgam'. The fitted value is a
     two-column matrix of estimated probabilities p and q.

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

     Thomas W. Yee

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

     Crowder, M. and Sweeting, T. (1989). Bayesian inference for a
     bivariate binomial distribution. _Biometrika_, *76*, 599-603.

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

     'binomialff'.

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

     mvector = round(rnorm(n <- 100, m=10, sd=2))
     x = runif(n)
     prob1 = logit(+2-x, inverse=TRUE)
     prob2 = logit(-2+x, inverse=TRUE)
     successes1 = rbinom(n=n, size=mvector, prob=prob1)
     successes2 = rbinom(n=n, size=successes1, prob=prob2)
     y1 = successes1 / mvector
     y2 = successes2 / successes1
     fit = vglm(cbind(y1,y2) ~ x, seq2binomial, trace=TRUE, weight=mvector)
     coef(fit)
     coef(fit, mat=TRUE)
     fitted(fit)[1:5,]

