simu_barma: Simulate a Beta Autoregressive Moving Average (BARMA) Time...

View source: R/simu_barma.R

simu_barmaR Documentation

Simulate a Beta Autoregressive Moving Average (BARMA) Time Series

Description

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.

Usage

simu_barma(
  n,
  alpha = 0,
  varphi = NA,
  theta = NA,
  phi = 20,
  freq = 12,
  link = "logit"
)

Arguments

n

The desired length of the final time series (after burn-in).

alpha

The intercept term (\alpha) in the linear predictor. Default is '0.0'.

varphi

A numeric vector of autoregressive (AR) parameters (\varphi). Default is 'NA' for models without an AR component.

theta

A numeric vector of moving average (MA) parameters (\theta). Default is 'NA' for models without an MA component.

phi

The precision parameter (\phi > 0) of the Beta distribution. Higher values result in less variance. Default is '20'.

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 \mu_t to the linear predictor. Must be one of '"logit"' (default), '"probit"', '"cloglog"', or '"loglog"'.

Details

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').

Value

A 'ts' object of length 'n' containing the simulated Beta-distributed time series.

Author(s)

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>)

See Also

barma, make_link_structure

Examples

# 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")


betaARMA documentation built on March 29, 2026, 5:08 p.m.