BPSGaussian: BPSGaussian

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Applies the BPS Sampler to a Gaussian target distribution, as detailed in Bouchard-Côté et al, 2017. Assume potential of the form

U(x) = (x - mu)^T V (x - mu)/2,

i.e. a Gaussian with mean vector mu and covariance matrix inv(V)

Usage

1
2
BPSGaussian(V, mu, n_iter = -1L, finalTime = -1, x0 = numeric(0),
  v0 = numeric(0), refresh_rate = 1, unit_velocity = FALSE)

Arguments

V

the inverse covariance matrix (or precision matrix) of the Gaussian target distribution.

mu

mean of the Gaussian target distribution

n_iter

Number of algorithm iterations; will result in the equivalent amount of skeleton points in Gaussian case because no rejections are needed.

finalTime

If provided and nonnegative, run the BPS sampler until a trajectory of continuous time length finalTime is obtained (ignoring the value of n_iterations)

x0

starting point (optional, if not specified taken to be the origin)

v0

starting direction (optional, if not specified taken to be a random vector)

refresh_rate

lambda_refresh

unit_velocity

TRUE indicates velocities uniform on unit sphere, FALSE (default) indicates standard normal velocities

Value

Returns a list with the following objects:

Times: Vector of switching times

Positions: Matrix whose columns are locations of switches. The number of columns is identical to the length of skeletonTimes. Be aware that the skeleton points themselves are NOT samples from the target distribution.

Velocities: Matrix whose columns are velocities just after switches. The number of columns is identical to the length of skeletonTimes.

Examples

1
2
3
4
5
V <- matrix(c(3,1,1,3),nrow=2)
mu <- c(2,2)
x0 <- c(0,0)
result <- BPSGaussian(V, mu, n_iter = 100, x0 = x0)
plot(result$Positions[1,], result$Positions[2,],type='l',asp=1)

RZigZag documentation built on July 20, 2019, 9:03 a.m.

Related to BPSGaussian in RZigZag...