cmb: Conway Maxwell Binomial distribution

cmbR Documentation

Conway Maxwell Binomial distribution

Description

Functions for \textrm{CMB}(m, p, ν) distribution.

Usage

r_cmb(n, m, p, nu)

d_cmb(x, m, p, nu, take_log = FALSE, normalize = TRUE)

normconst_cmb(m, p, nu, take_log = FALSE)

e_cmb(m, p, nu)

v_cmb(m, p, nu)

Arguments

n

Number of draws to produce.

m

Number of trials in the CMB cluster.

p

Probability parameter

nu

Dispersion parameter

x

A scalar representing the outcome.

take_log

TRUE or FALSE; if TRUE, return the value on the log-scale.

normalize

TRUE or FALSE; if FALSE, do not compute or apply the normalizing constant to each density value.

Details

A random variable X \sim \textrm{CMB}(m, p, ν) has probability mass function

f(x \mid m, p, ν) = C(m, p, ν)^{-1} {m \choose x}^ν p^{x} (1-p)^{m-x}, \quad x \in \{0, 1, …, m\}

with

C(m, p, ν) = ∑_{x = 0}^m {m \choose x}^ν p^{x} (1-p)^{m-x}

as the normalizing constant.

CMB can be considered a two-dimensional case of CMM. Furthermore, CMB is useful in drawing from the general CMM distribution; see Morris, Raim, and Sellers (2020+).

Value

The values returned by each function are:

  • d_cmb: a number representing the CMB density f(x \mid m, p, ν).

  • r_cmb: an n-dimensional vector of draws.

  • normconst_cmb: a number representing the normalizing constant C(m, p, ν).

  • e_cmb: a number representing \textrm{E}(X).

  • v_cmb: a number representing \textrm{Var}(X)

Examples

set.seed(1234)
m = 10
p = 0.7
nu = 0.8

x = r_cmb(100, m, p, nu)
d_cmb(x[1], m, p, nu, take_log = TRUE)
normconst_cmb(m, p, nu, take_log = TRUE)
e_cmb(m, p, nu)
v_cmb(m, p, nu)


andrewraim/COMMultReg documentation built on April 2, 2022, 11:04 p.m.