Simulation
Simulation of a Markov-switching present-value bubble
sim_msbubble sim_msbubble(
n,
p11 = 0.98,
p22 = 0.9,
lambda1 = 0.98,
lambda2 = 1.03,
sigma_b = 0.05,
b0 = 0,
s0 = 1L,
seed = NULL
) Simulation of Chan & Santi (2021)'s bubble component of a present-value state-space model: an AR(1) whose persistence switches between a "surviving" (explosive) and a "collapsing" (mean-reverting) regime under a first-order Markov chain, rather than at deterministic dates (sim_psy1) or a fixed-probability mixture (sim_blan).
Arguments
| n | A positive integer specifying the length of the simulated output series. |
| p11, p22 | Regime-1-to-1 and regime-2-to-2 transition probabilities, in (0, 1). |
| lambda1, lambda2 | Regime persistence parameters (lambda1 < 1 explosive, lambda2 > 1 mean-reverting). |
| sigma_b | A positive scalar, the bubble-innovation standard deviation. |
| b0 | Starting value. |
| s0 | Starting regime, 1L or 2L. |
| seed | An object specifying if and how the random number generator (rng)
should be initialized. It is either NULL or an integer, which is passed to
set.seed before the simulation. If you set it, the value is saved as the
"seed" attribute of the returned value. The default, NULL, leaves the state of
the rng unchanged and returns .Random.seed as the "seed" attribute. Results are
reproducible across the parallel and the non-parallel option when you use the
same seed. |
Value
A numeric vector of length n, with a "regime" attribute (the simulated S_t path).
Details
with a Markov chain with transition probabilities p11 = P(S[t]=1|S[t-1]=1), p22 =
P(S[t]=2|S[t-1]=2). Regime 1 ("surviving") uses lambda1 < 1 (so 1/lambda1 > 1, explosive); regime 2 ("collapsing") uses lambda2 > 1 (mean-reverting). Note: the source's own eq. 16 indexes the coefficient by ; this implementation uses the contemporaneous instead (an indexing-convention simplification, not a change to the qualitative Markov-switching mechanism).
Examples
These examples are copied from the package's own documentation and are run by R CMD check on every release.
The printed output (after #>) and the plots were produced by running them against the current package source.
sim_msbubble(200, seed = 123) %>%
autoplot() See also
References
Chan, J.C.C. & Santi, C. (2021). "Speculative Bubbles in Present-Value Models: A Bayesian Markov-Switching State Space Approach." Journal of Economic Dynamics and Control, 127, 104101.
exuber