Creates a likelihood object from a binary categorical variable, grouped by a secondary categorical variable if provided.
Value
Returns an object of class "inz_lbinom".
An object of class "inz_lbinom" is a list which contains the following:
- x
the number of successes.
- N
the total number of observations.
- levels
the levels of the primary variable (the binary outcomes).
- groups
the levels of the secondary variable, or "none" if not grouped.
Details
Both primary and secondary must be categorical variables.
They can be passed as a string (e.g. "Gender") or as a non-string (e.g. Gender).
The primary variable must be binary (i.e. a two-level categorical variable).
The first level of the variable is treated as the 'success' (x).
For grouped data, the function calculates the Binomial parameters, x and N,
for each level of the secondary variable.