| simu_barma | R Documentation |
Generates a random time series from a Beta Autoregressive Moving Average (BARMA) model. The function can simulate BARMA(p,q), BAR(p), or BMA(q) processes.
simu_barma(
n,
alpha = 0,
varphi = NA,
theta = NA,
phi = 20,
freq = 12,
link = "logit"
)
n |
The desired length of the final time series (after burn-in). |
alpha |
The intercept term ( |
varphi |
A numeric vector of autoregressive (AR) parameters ( |
theta |
A numeric vector of moving average (MA) parameters ( |
phi |
The precision parameter ( |
freq |
The frequency of the resulting 'ts' object (e.g., 12 for monthly, 4 for quarterly). Default is '12'. |
link |
The link function to connect the mean |
The model type is determined by the 'varphi' and 'theta' parameters:
**BARMA(p,q):** Both 'varphi' and 'theta' are provided.
**BAR(p):** Only 'varphi' is provided ('theta' is 'NA').
**BMA(q):** Only 'theta' is provided ('varphi' is 'NA').
A 'ts' object of length 'n' containing the simulated Beta-distributed time series.
Original R code by: Fabio M. Bayer (Federal University of Santa Maria, <bayer@ufsm.br>) Modified and improved by: Everton da Costa (Federal University of Pernambuco, <everto.cost@gmail.com>)
barma, make_link_structure
# Set seed for reproducibility
# --- Example 1: Simulate a BAR(1) process ---
# y_t depends on y_{t-1}
set.seed(2025)
bar1_series <- simu_barma(n = 250, alpha = 0.0, varphi = 0.5, phi = 20,
link = "logit")
plot(bar1_series, main = "Simulated BAR(1) Process", ylab = "Value")
# --- Example 2: Simulate a BMA(1) process ---
# y_t depends on the previous error term
set.seed(2025)
bma1_series <- simu_barma(n = 250, alpha = 0.0, theta = -0.2, phi = 20)
plot(bma1_series, main = "Simulated BMA(1) Process", ylab = "Value")
# --- Example 3: Simulate a BARMA(2,1) process with a cloglog link ---
set.seed(2025)
barma21_series <- simu_barma(
n = 200,
alpha = 0.0,
varphi = c(0.4, 0.2), # AR(2) components
theta = -0.3, # MA(1) component
phi = 20,
link = "cloglog"
)
plot(barma21_series, main = "Simulated BARMA(2,1) Process", ylab = "Value")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.