simulate_bounded_bm: Simulate Bounded Brownian Motion

View source: R/simulate.R

simulate_bounded_bmR Documentation

Simulate Bounded Brownian Motion

Description

Simulates a discretized reflected Brownian motion constrained between bounds, following the methodology of Cavaliere and Xu (2014).

Usage

simulate_bounded_bm(n, c_lower, c_upper = Inf)

Arguments

n

Integer. Number of time steps for discretization.

c_lower

Numeric. Standardized lower bound parameter.

c_upper

Numeric or Inf. Standardized upper bound parameter. Use Inf for one-sided (lower) bound only.

Details

The function simulates a standard Brownian motion and applies reflection at the boundaries. For two-sided bounds, both upper and lower reflections are applied. For one-sided bounds (c_upper = Inf), only lower reflection is used.

The standardized bound parameters c_lower and c_upper are computed from the original bounds as:

c = (b - X_0) / (\sigma \sqrt{T})

where b is the bound, X_0 is the initial value, \sigma is the long-run standard deviation, and T is the sample size.

Value

A numeric vector of length n + 1 containing the simulated bounded Brownian motion path, starting at 0.

References

Cavaliere, G., & Xu, F. (2014). Testing for unit roots in bounded time series. Journal of Econometrics, 178(2), 259-272. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.jeconom.2013.08.012")}

Examples

# Simulate bounded Brownian motion with two-sided bounds
set.seed(123)
bm <- simulate_bounded_bm(n = 1000, c_lower = -2, c_upper = 2)
plot(bm, type = "l", main = "Bounded Brownian Motion")
abline(h = c(-2, 2), col = "red", lty = 2)

# One-sided bound (lower only)
bm_lower <- simulate_bounded_bm(n = 1000, c_lower = -1, c_upper = Inf)


boundedur documentation built on March 16, 2026, 5:08 p.m.