betaTable {cNORM}R Documentation

Calculate Cumulative Probabilities, Density, Percentiles, and Z-Scores for Beta-Binomial Distribution

Description

This function computes the cumulative probabilities, the density (probability mass function values), the percentiles, and the corresponding z-scores based on the specified parameters of a beta-binomial distribution. The beta-binomial distribution is used to model the number of successes in a fixed number of trials with success probability varying from trial to trial, described by beta distribution parameters \alpha (alpha) and \beta (beta).

Usage

betaTable(a, b, n, m = NULL)

Arguments

a

The \alpha parameter of the beta distribution, indicating the shape parameter associated with successes.

b

The \beta parameter of the beta distribution, indicating the shape parameter associated with failures.

n

The number of trials in the beta-binomial distribution.

m

An optional stop criterion in table generation. Positive integer lower than n.

Details

The function utilizes the gamma function to calculate factorial terms needed for the probability mass function (PMF) and cumulative distribution function (CDF) calculations of the beta-binomial distribution. It iterates over the range of possible successes (0 to n) to compute the PMF values (Px), cumulative probabilities (Pcum), and mid-percentiles. These percentiles are then used to calculate the corresponding z-scores, which indicate how many standard deviations an element is from the mean.

Value

A data frame with columns:

x

The number of successes (0 to n).

Px

The density (probability mass function value) for each number of successes.

Pcum

The cumulative probability up to each number of successes.

Percentile

The percentile corresponding to each number of successes.

z

The z-score corresponding to each percentile.

Examples

betaTable(2, 2, 45, 20)

[Package cNORM version 3.1.0 Index]