| d_cmb_sample | R Documentation |
Compute individual density contributions for
X_i \sim \textrm{CMB}(m_i, p_i, ν_i), \quad i = 1, …, n.
d_cmb_sample(x, m, p, nu, take_log = FALSE)
x |
An n-dimensional vector of outcomes |
m |
An n-dimensional vector m_1, …, m_n |
p |
An n-dimensional vector of probability parameters p_1, …, p_n |
nu |
An n-dimensional vector of dispersion parameters ν_1, …, ν_n |
take_log |
|
A vector of density values f(x_1 \mid m_1, p_1, ν_1), …, f(x_n \mid m_n, p_n, ν_n), which may be on the log-scale and/or unnormalized according to input arguments. See cmb.
set.seed(1234)
n = 20
m = rep(10, n)
x = rnorm(n)
X = model.matrix(~ x)
beta = c(-1, 1)
p = plogis(X %*% beta)
w = rnorm(n)
W = model.matrix(~ w)
gamma = c(0.1, -0.1)
nu = X %*% gamma
y = numeric(n)
for (i in 1:n) {
y[i] = r_cmb(1, m[i], p[i], nu[i])
}
d_cmb_sample(y, m, p, nu, take_log = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.