sample_multinom_reg | R Documentation |
Sample a multinomial regression rate
sample_multinom_reg(
p,
z,
k,
mean,
precision,
method = c("slice", "normal", "uniform", "quadratic taylor", "mv ind quadratic taylor",
"mv truncated exponential"),
ref = c("first", "last"),
...,
diag = all(precision[upper.tri(precision)] == 0),
zmax = NULL,
width = 1,
nexpand = 10,
ncontract = 100,
acceptance = c("MH", "LL only", "regardless")
)
p |
the previous iteration of the logit-probability, as an array of dimension |
z |
a matrix (or array) of zeros and ones. The zeros determine so-called "structural zeros": outcomes
which are not possible. If two-dimensional, it is assumed not to change over the first dimension ( |
k |
the realized value from the binomial distribution; the same size as |
mean |
the prior mean for |
precision |
an array of dimension |
method |
The method to use to propose new values.
Note that |
ref |
One of |
... |
Other arguments (not used) |
diag |
Logical, denoting whether the precision matrix is diagonal, for a small speed boost. |
zmax |
For advanced use: a matrix, usually computed from the last two dimensions of |
width |
For |
nexpand |
The maximum number of expansions (to the right and left each) |
ncontract |
The maximum number of contractions. If this is exceeded, the original value is returned |
acceptance |
What should be the criteria for acceptance? "MH" indicates the usual Metropolis-Hastings update. "LL only" ignores the proposal densities but considers the log-likelihoods. "regardless" accepts no matter what. This is useful for testing, or for when the method is a gamma, beta, or quadratic approximation, which can be hard to accept if the initial starting point is low-density. |
The internals are defined in C++.
In the case that n
is zero or z
is zero, slice sampling is ignored in favor of a
(possibly multivarite) normal draw.
sample_pois_reg
, sample_binom_reg
, https://en.wikipedia.org/wiki/Slice_sampling
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.