betabinmoments: The first four central moments of the Beta-binomial...

View source: R/betabinmoments.R

betabinmomentsR Documentation

The first four central moments of the Beta-binomial distribution

Description

Calculates the first four central moments as well as skewness and kurtosis from two different parametrizations

Usage

betabinmoments(alpha = NULL, beta = NULL, 
               pi = NULL, rho = NULL, 
               size)

Arguments

alpha

numeric > 0. Parameter (see Details).

beta

numeric > 0. Parameter (see Details).

pi

numeric. Parameter between 0 and 1 (see Details and bbm).

rho

numeric. Parameter between 0 and 1 (see Details and bbm).

size

integer. Parameter (number of trials).

Details

The user needs to supply either alpha and beta or pi and rho. In either case n (= size) is the number of trials. In the parametrization using alpha and beta, the mean and variance are given by n\frac{\alpha}{\alpha + \beta} and n\alpha\beta(\alpha+\beta+n)/((\alpha+\beta)^2(\alpha+\beta+1)) respectively. If rho and pi are supplied, the mean and variance of the Beta-binomial distributions are given by the expressions stated in the documentation of bbm.

Value

A list with components

mean

mean

variance

variance

skewness

skewness

kurtosis

kurtosis

mu3

third central moment

mu4

fourth central moment

Note

Both parametrizations are related by the following relations:

\pi = \frac{\alpha}{\alpha + \beta}

and

\rho = \frac{1}{\alpha+\beta+1}.

Author(s)

Philipp Doebler <philipp.doebler@googlemail.com>

See Also

bbm

Examples

# Example 1: alpha and beta as parameters
alpha <- 4.5
beta <- 4.5
betabinmoments(alpha, beta, size = 12)

# Example 2: calculte pi and rho:
pi <- alpha/(alpha + beta) # 0.5
rho <- 1/(alpha + beta + 1) # 0.1
betabinmoments(pi = pi, rho = rho, size = 12)
# the same moments result

maid documentation built on March 31, 2023, 3:07 p.m.