| simulate_bounded_bm | R Documentation |
Simulates a discretized reflected Brownian motion constrained between bounds, following the methodology of Cavaliere and Xu (2014).
simulate_bounded_bm(n, c_lower, c_upper = Inf)
n |
Integer. Number of time steps for discretization. |
c_lower |
Numeric. Standardized lower bound parameter. |
c_upper |
Numeric or |
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.
A numeric vector of length n + 1 containing the simulated
bounded Brownian motion path, starting at 0.
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")}
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.