splitbin: Splits Binomial Data into Bernoulli Data
Description
Splits binomial data (n, y) and optional covariates into Bernoulli data (0 or 1) and the corresponding covariates.
Usage
splitbin(formula, data, id = "id")
Arguments
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.
Value
A data frame with response and covariates as indicated in the formula, plus the identifier.
Details
Any variable of mode character is converted into a factor before data processing.
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.