MCMCcopies {EntropyMCMC} | R Documentation |
Simulates iid copies of a MCMC algorithm
Description
Simulates nmc
iid copies of a MCMC algorithm mcmc_algo
for n
(time) iterations and returns an object of class plMCMC
(for parallel MCMC) holding an array of the trajectories and running information.
Usage
MCMCcopies(mcmc_algo, n = 100, nmc = 10, Ptheta0, target, f_param, q_param, verb = TRUE)
Arguments
mcmc_algo |
a list defining an MCMC algorithm in terms of the
functions it uses, such as |
n |
The number of (time) iterations of each single chain to run. |
nmc |
The number of iid copies of each single chain. |
Ptheta0 |
A (nmc x d) matrix, with the ith row giving a d-dimensional initial theta values for the ith chain. |
target |
The target density for which the MCMC algorithm is defined;
may be given only up to a multiplicative constant for most MCMC.
Target must be a function such as the multidimensional gaussian
|
f_param |
A list holding all the necessary target parameters, consistent with the target definition. |
q_param |
A list holding all the necessary parameters
for the proposal density of the MCMC algorithm |
verb |
Verbose mode for summarizing output during the simulation. |
Details
MCMCcopies
sequentially simulates nmc
iid copies of the
MCMC algorithm passed in the list mcmc_algo
,
for n
(time) iterations, and returns an object of class plMCMC
holding an array of the trajectories and running information.
The list mcmc_algo
must contain the named elements:
-
name
, the name of the MCMC, such as "RWHM" -
chain
, the function for simulation of n steps of a single chain -
step
, the function for simulation of 1 step of that algorithm -
q_pdf
, the density of the proposal -
q_proposal
, the function that simulates a proposal
For examples, see the algorithms currently implemented:
RWHM
, the Random Walk Hasting-Metropolis with gaussian proposal;
HMIS_norm
, an Independence Sampler HM with gaussian proposal;
AMHaario
, the Adaptive-Metropolis (AM) from Haario (2001);
IID_norm
, a gaussian iid sampler which is merely
a "fake" MCMC for testing purposes.
Value
MCMCcopies
returns a list of class plMCMC
with items:
Ptheta |
The |
prob.accept |
The estimated rate of acceptation over all simulations. |
algo |
The MCMC algorithm name i.e. |
target |
The target density. |
f_param |
The list holding all the target parameters. |
q_param |
The list holding all the proposal density parameters. |
Author(s)
Didier Chauveau.
References
Chauveau, D. and Vandekerkhove, P. (2013), Smoothness of Metropolis-Hastings algorithm and application to entropy estimation. ESAIM: Probability and Statistics, 17, 419–431. DOI: http://dx.doi.org/10.1051/ps/2012004
Chauveau D. and Vandekerkhove, P. (2014), Simulation Based Nearest Neighbor Entropy Estimation for (Adaptive) MCMC Evaluation, In JSM Proceedings, Statistical Computing Section. Alexandria, VA: American Statistical Association. 2816–2827.
See Also
Two multicore and cluster version
MCMCcopies.mc
and
MCMCcopies.cl
,
and functions doing simulation and entropy and Kullback estimation simultaneously:
EntropyParallel
and EntropyParallel.cl
Examples
## Toy example using the bivariate gaussian target
## with default parameters value, see target_norm_param
n = 150; nmc = 20; d=2 # bivariate example
varq=0.1 # variance of the proposal (chosen too small)
q_param=list(mean=rep(0,d),v=varq*diag(d))
## initial distribution, located in (2,2), "far" from target center (0,0)
Ptheta0 <- DrawInit(nmc, d, initpdf = "rnorm", mean = 2, sd = 1)
# simulation
s1 <- MCMCcopies(RWHM, n, nmc, Ptheta0, target_norm,
target_norm_param, q_param, verb = FALSE)
summary(s1) # method for "plMCMC" object
par(mfrow=c(1,2))
plot(s1) # just a path of the iid chains, method for "plMCMC" object
hist(s1$Ptheta[,1,], col=8) # marginal 1