splitbin {aod} | R Documentation |
Splits binomial data (n, y) and optional covariates into Bernoulli data (0 or 1) and the corresponding covariates.
splitbin(formula, data, id = "id")
formula |
A formula: its left-hand side must be of the form cbind(y, n - y) where the modelled
probability is y/n . The right-hand side indicates the covariates which are considered in the ungrouped
data set. |
data |
A data frame where all the variables described in n , y and formula are found. |
id |
An optional character string naming the identifier (= grouping factor). Default to “id”. |
Each line (with n > 0) of the initial data set generates n lines in the final data set with the same covariate pattern, plus an identifier (named “id”, by default). The value of this identifier is the row name from which it was expanded in the initial data set.
A data frame with response and covariates as indicated in the formula, plus the identifier.
data(orob1) splitbin(cbind(y, n - y) ~ 1, orob1) splitbin(cbind(y, n - y) ~ dilution, orob1)