max_sampler: Brownian Bridge maximum point sampler

View source: R/RcppExports.R

max_samplerR Documentation

Brownian Bridge maximum point sampler

Description

Simulation of a maximum point of a Brownian bridge

Usage

max_sampler(x, y, s, t, low_bound, up_bound, checks = TRUE)

Arguments

x

start value of Brownian bridge

y

end value of Brownian bridge

s

start time of Brownian bridge

t

end time of Brownian bridge

low_bound

Lower bound of maximum point (max(x,y) <= low_bound < up_bound)

up_bound

Upper bound of maximum point (max(x,y) <= low_bound < up_bound)

checks

logical value to determine if arguments that are passed into the function are checked. Things that are checked include that max(x,y) <= low_bound < up_bound and that s < t

Value

vector: the simulated maximum, 'max', and time where maximum occurs, 'tau'

Examples

# simulate a maximum between 0 and 1 of a Brownian bridge starting at 
# 0 and ending at 0 in time [0,1]
max_sampler(x = 0, y = 0, s = 0, t = 1, low_bound = 0, up_bound = 1)

# plotting multiple simulated maximums and their times
maximums <- sapply(1:5000, function(i) {
  max_sampler(x = 0, y = 0, s = 0, t = 1, low_bound = 0 , up_bound = 10)
})
plot(x = maximums[2,], y = maximums[1,], pch = 20, lwd = 0.1,
     xlab = 'Time', ylab = 'X')

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