stationary | R Documentation |
Transdimensional MCMC methods include a discrete model-indicator variable z
with a fixed but unknown stationary distribution with probabilities \pi
(i.e., the model posterior probabiltiies). The function stationary
draws posterior samples to assess the estimation uncertainty of \pi
.
stationary(
z,
N,
labels,
sample = 1000,
epsilon = "1/M",
cpu = 1,
method = "arma",
digits = 6,
progress = TRUE,
summary = TRUE
)
z |
MCMC output for the discrete indicator variable with numerical,
character, or factor labels (can also be a |
N |
the observed |
labels |
optional: vector of labels for complete set of models
(e.g., models not sampled in the chain |
sample |
number of posterior samples to be drawn for the stationary distribution |
epsilon |
prior parameter for the rows of the estimated transition matrix |
cpu |
number of CPUs used for parallel sampling. Will only speed up computations for large numbers of models (i.e., for large transition matrices). |
method |
how to compute eigenvectors:
|
digits |
number of digits that are used for checking whether the first eigenvalue is equal to 1 (any difference must be due to low numerical precision) |
progress |
whether to show a progress bar (not functional for |
summary |
whether the output should be summarized.
If |
The method draws independent posterior samples of the transition matrix P
for the discrete-valued indicator variable z
(usually, a sequence of sampled models).
For each row of the transition matrix, a Dirichlet(\epsilon,...,\epsilon)
prior is assumed, resulting in a conjugate Dirichlet posterior.
For each sample, the eigenvector with eigenvalue 1 is computed and normalized.
These (independent) posterior samples can be used to assess the estimation
uncertainty in the stationary distribution pi
of interest
(e.g., the model posterior probabilities) and to estimate the effective sample size
(see summary.stationary
).
default: a summary for the posterior distribution of the model
posterior probabilities (i.e., the fixed but unknown stationary distribution of z
).
If summary=FALSE
, posterior samples for pi
are returned.
best_models
, summary.stationary
# data-generating transition matrix
P <- matrix(c(.1,.5,.4,
0, .5,.5,
.9,.1,0), ncol = 3, byrow=TRUE)
# input: sequence of sampled models
z <- rmarkov(500, P)
stationary(z)
# input: transition frequencies
N <- transitions(z)
samples <- stationary(N = N, summary = FALSE)
# summaries:
best_models(samples, k = 3)
summary(samples)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.