Learn R Programming

MCMCprecision (version 0.4.2)

stationary_mle: MLE for stationary distribution of discrete MCMC variables

Description

Maximum-likelihood estimation of stationary distribution \(\pi\) based on (a) a sampled trajectory \(z\) of a model-indicator variable or (b) a sampled transition count matrix \(N\).

Usage

stationary_mle(z, N, labels, method = "rev", abstol = 1e-05, maxit = 1e+05)

Value

a vector with posterior model probability estimates

Arguments

z

MCMC output for the discrete indicator variable with numerical, character, or factor labels (can also be a mcmc.list or a matrix with one MCMC chain per column).

N

the observed transitions matrix (if supplied, z is ignored). A quadratic matrix with sampled transition frequencies (N[i,j] = number of switches from z[t]=i to z[t+1]=j).

labels

optional: vector of labels for complete set of models (e.g., models not sampled in the chain z). If epsilon=0, this does not affect inferences due to the improper Dirichlet(0,..,0) prior.

method

Different types of MLEs:

  • "iid": Assumes i.i.d. sampling of the model indicator variable z and estimates \(\pi\) as the relative frequencies each model was sampled.

  • "rev": Estimate stationary distribution under the constraint that the transition matrix is reversible (i.e., fulfills detailed balance) based on the iterative fixed-point algorithm proposed by Trendelkamp-Schroer et al. (2015)

  • "eigen": Computes the first left-eigenvector (normalized to sum to 1) of the sampled transition matrix

abstol

absolute convergence tolerance (only for method = "rev")

maxit

maximum number of iterations (only for method = "rev")

Details

The estimates are implemented mainly for comparison with the Bayesian sampling approach implemented in stationary, which quantify estimation uncertainty (i.e., posterior SD) of the posterior model probability estimates.

References

Trendelkamp-Schroer, B., Wu, H., Paul, F., & Noé, F. (2015). Estimation and uncertainty of reversible Markov models. The Journal of Chemical Physics, 143(17), 174101. tools:::Rd_expr_doi("10.1063/1.4934536")

See Also

stationary

Examples

Run this code
P <- matrix(c(.1,.5,.4,
              0,.5,.5,
              .9,.1,0), ncol = 3, byrow=TRUE)
z <- rmarkov(1000, P)
stationary_mle(z)

# input: transition frequency
tab <- transitions(z)
stationary_mle(N = tab)

Run the code above in your browser using DataLab