delta_coin_intervals: Delta coin flipper for intervals (used for Algorithm 33 in...

View source: R/RcppExports.R

delta_coin_intervalsR Documentation

Delta coin flipper for intervals (used for Algorithm 33 in ST329)

Description

Flips 'Delta coin' for intervals; takes the product of the Cauchy sequence S^delta_k to determine whether or not the Brownian bridge with minimum, min, remains in the interval [l,v]

Usage

delta_coin_intervals(u, k, X, times, min, v)

Arguments

u

simulated value from random U[0,1]

k

integer value starting index for calculating the intervals

X

vector of values of Brownian bridge

times

vector of times

min

minimum of Brownian bridge

v

upper bound of Brownian bridge

Value

boolean value: if T, accept probability that Brownian bridge with minimum, min, remains in [min,v], otherwise reject

Examples

# setting up Brownian bridge variable
brownian_bridge <- matrix(c(0, 0, -0.2, 0.4, 0.3, 0.5, 1, 1),
                          ncol = 4, nrow = 2)

# flip delta coin whether or not Brownian bridge remains in [-0.2, 1.5]
d <- abs(1.5 - -0.2)
k <- ceiling(sqrt(1 + d^2)/(2*d))
delta_coin_intervals(u = runif(1, 0, 1),
                     k = k,
                     X = brownian_bridge[1,],
                     times = brownian_bridge[2,],
                     min = -0.2,
                     v = 1.5)


rchan26/layeredBB documentation built on March 25, 2022, 3:44 a.m.