Learn R Programming

VGAM (version 0.7-6)

seq2binomial: The Two-stage Sequential Binomial Distribution Family Function

Description

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

Usage

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

Arguments

Value

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

Details

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 $y_1$ spores that germinate, each has a probability $q$ of bending in a particular direction. Let $y_2$ be the number that bend in the specified direction. The probability model for this data is $P(y_1,y_2) =$ $${m \choose y_1} p^{y_1} (1-p)^{m-y_1} {y_1 \choose y_2} q^{y_2} (1-q)^{y_1-y_2}$$ for $0 < p < 1$, $0 < q < 1$, $y_1=1,\ldots,m$ and $y_2=1,\ldots,y_1$. 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.

References

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

See Also

binomialff.

Examples

Run this code
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,]

Run the code above in your browser using DataLab