betaNormTable | R Documentation |
This function generates a table of beta-binomial distribution properties (cumulative probabilities, density, percentiles, and z-scores) for a specified group, using alpha ('a') and beta ('b') parameters predicted by a model created with the 'betaContinuous' function.
betaNormTable(model, group, m = NULL)
model |
A list containing the components from a 'betaContinuous' model output, including 'modA' and 'modB' for the polynomial regression models of 'a' and 'b' parameters, respectively, and 'param' containing the original parameters and group identifiers. |
group |
A data frame or vector specifying the group variables for which predictions and subsequent beta-binomial distribution calculations are desired. This should match the format and structure of the group variable used in 'betaContinuous'. |
m |
An optional stop criterion in table generation. Positive integer lower than n |
The function utilizes the 'predict.lm' method to predict 'a' and 'b' values for the specified group using the models stored in 'modell'. It assumes the number of trials ('n') is constant across groups and uses the first 'n' value found in 'modell$param'. This table is useful for comparing the predicted distribution of outcomes across different groups or conditions.
A data frame with columns representing the number of successes ('x'), the probability mass function values ('Px'), cumulative probabilities ('Pcum'), percentiles ('Percentile'), and z-scores ('z') for the specified group based on the predicted 'a' and 'b' parameters.
# Determies beta parameters and models these continuously
param <- betaByGroup(elfe$raw, elfe$group, 26)
beta.model <- betaContinuous(param, 4, 4)
# Calculates table for new group
newGroup <- 3.9
betaNormTable(beta.model, newGroup)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.