View source: R/zigzagMarkovian.R
| markovianZigzag | R Documentation |
Sample from a truncated multivariate normal distribution using the Markovian Zigzag process, a continuous-time, non-reversible Markov chain Monte Carlo method based on piecewise deterministic Markov processes (PDMPs).
markovianZigzag(
nSample,
burnin = 0,
mean,
prec,
lowerBounds,
upperBounds,
init = NULL,
stepSize = NULL,
seed = 1,
numThreads = 1,
diagnosticMode = FALSE,
nStatusUpdate = 0L
)
nSample |
Number of samples after burn-in. |
burnin |
Number of burn-in samples (default = 0). |
mean |
A d-dimensional mean vector. |
prec |
A d-by-d precision matrix of the Gaussian distribution. |
lowerBounds |
A d-dimensional vector specifying the lower bounds.
|
upperBounds |
A d-dimensional vector specifying the upper bounds.
|
init |
A d-dimensional vector of the initial value. |
stepSize |
Step size for the Markovian Zigzag sampler. Default value
is the empirically optimal choice: |
seed |
Random seed (default = 1). |
numThreads |
number of threads for parallel execution (default = 1). Set to 0 for automatic detection of available cores. |
diagnosticMode |
Logical. |
nStatusUpdate |
Number of status updates to print during sampling. If 0 (default), no updates are printed. |
An nSample-by-d matrix of samples. If diagnosticMode is TRUE,
a list with additional diagnostic information is returned.
Bierkens, J., Roberts, G. O., and Zitt, P.-A. (2019). Ergodicity of the zigzag process. The Annals of Applied Probability, 29(4): 2266-2301.
getMarkovianZigzagSample(), createEngine()
set.seed(1)
d <- 5
A <- matrix(runif(d^2)*2-1, ncol=d)
precMat <- t(A) %*% A
initial <- rep(1, d)
results <- markovianZigzag(
nSample = 1000,
burnin = 1000,
mean = rep(0, d),
prec = precMat,
lowerBounds = rep(0, d),
upperBounds = rep(Inf, d)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.