hybrid.sample {MCMChybridGP} | R Documentation |
Sampling phase in hybrid MCMC, which takes the output from
hybrid.explore
to samples from the target
distribution supplied. The number of chains,
Leapfrog moves and Gaussian process parameters are the
same as used in hybrid.explore
,
or the values may be updated here. For a target distribution
time consuming to evaluate, the target can be replaced
completely by the Gaussian process approximation in some
or all of the chains.
hybrid.sample(Explore = NULL, n = 1000, L = NULL, delta = NULL, nchains = NULL, T.mult = NULL, cor.max=0.9, r=5, nswaps = NULL, replace.target = c(0, 1, 2), graph = FALSE, graph.template = NULL, key.vars = NULL, delta.increase = NULL, nrefresh.graph = NULL)
Explore |
The ouput from hybrid.explore .
|
n |
The number of sampling iterations. |
L |
An optional integer argument. The number of steps used in Leapfrog moves.
(Defaults to the same value used in hybrid.explore .)
|
delta |
An optional numerical argument. The size of steps used in Leapfrog moves.
(Defaults to the same value used in hybrid.explore .)
|
nchains |
An optional integer argument. The number of MCMC parallel chains to be used.
(Defaults to the same value used in hybrid.explore .)
|
T.mult |
An optional integer argument. The number of Parallel Tempering chains to be used.
(Defaults to the same value used in hybrid.explore .)
|
cor.max |
An optional numerical argument between 0 and 1 (default 0.9). Gives
the maximum amount a point can vary from points in Gaussian process fit.
Gauge this by sd_y output from hybrid.explore .
|
r |
An optional numerical argument (default 5). A penalty factor on points varying from points in Gaussian process fit, when replacing the target distribution. |
nswaps |
An optional integer argument. The number of repititions in swaps proposed
between MCMC chains (defaulting to value in hybrid.explore ).
|
replace.target |
The sampling scheme to be used (0, 1 or 2) in acceptance of MCMC proposals. Where 0 represents using the true target distribution in all chains. 1 (default) represents using the true target distribution only in the primary chain (with temperature 1). 2 represents replacing the target distribution in all chains by the Gaussian process approximation. |
graph |
An optional boolean argument (default is FALSE). To request a graphical progress display during the Sampling phase. |
graph.template |
An optional function argument.
A template on which to draw points generated during the Sampling phase.
By default a graph would be produced scaled appropriately for points sampled.
Its form can be seen by .hybrid.template .
|
key.vars |
An optional integer argument. A column denoting any variables of particular interest to be graphed. |
delta.increase |
An optional boolean argument for a proportionally larger Leapfrog step size with larger temperatures. |
nrefresh.graph |
An optional integer argument. The number of cycles through the MCMC chains after which the graphical display should be refreshed. |
The method used in hybrid.sample
is fully described in Fielding, Mark, Nott, David J. and Liong Shie-Yui (2009).
A list is returned consisting of the following.
SAMP |
A matrix with rows corresponding to sampled points generated from the target distribution. |
y |
A column of the corrresponding values of the log-density of the target distribution. |
Ey |
Corresponding values of the (zero-mean) Gaussian process fit. |
fcalls |
The number of function calls to evaluate the true log-density. |
acceptance |
A column of 0's (for proposals not accepted) and 1's (for proposals accepted) for outcomes of Leapfrog proposals. |
swap.acceptance |
A list of outcomes of swaps proposed,
consisting of Primary , swaps with the primary chain,
and Others , swaps amongst remaining chains.
Each gives a column of 0's (for proposals not accepted) and
1's (for proposals accepted). |
The method used in hybrid.sample
gives extensions
to the work of Rasmussen (2003), as described in
Fielding, Mark, Nott, David J. and Liong Shie-Yui (2009).
Mark J. Fielding <stafmj@nus.edu.sg>
"Efficient MCMC schemes for Bayesian calibration of computer models", Fielding, Mark, Nott, David J. and Liong Shie-Yui (2009), in preparation.
## Not run: mu1 <- c(-1, -1) mu2 <- c(+1, +1) sigma.sq <- 0.16 X0 <- matrix(c(-2,-1,0,-2,0,2,0,1,2, -2,-1,-2,0,0,0,2,1,2), ncol = 2) f <- function(x) { px <- 1/4/pi/sqrt(sigma.sq) * exp(-1/2/sigma.sq * sum((x - mu1)^2)) + 1/4/pi/sqrt(sigma.sq) * exp(-1/2/sigma.sq * sum((x - mu2)^2)) return(log(px)) } explore.out <- hybrid.explore(f, X0, n=100, graph=TRUE) sample.out <- hybrid.sample(explore.out, n=500, graph=TRUE) opar <- par(mfrow=c(2,1)) plot(density(sample.out$SAMP[,1]), xlab="x1", ylab="f(x)") plot(density(sample.out$SAMP[,2]), xlab="x2", ylab="f(x)") par(opar) ## End(Not run)