betaNormTable: Generate norm table from parametric continuous norming with...

View source: R/betaBinomial.R

betaNormTableR Documentation

Generate norm table from parametric continuous norming with Beta-Binomial Parameters

Description

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.

Usage

betaNormTable(model, group, m = NULL)

Arguments

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

Details

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.

Value

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.

Examples

# 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)

WLenhard/cNORM documentation built on April 1, 2024, 5:41 p.m.