cmb | R Documentation |
Functions for \textrm{CMB}(m, p, ν) distribution.
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)
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 |
|
normalize |
|
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+).
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)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.