Simulate, estimate and forecast a wide range of regression based dynamic models for bounded time series, covering the most commonly applied models in the literature. The main calculations are done in FORTRAN, which translates into very fast algorithms.
BTSR provides a unified R framework to simulate, extract components from, fit, and forecast a wide range of observation-driven regression models for bounded (and positive) time series. Core numerical routines (conditional likelihood evaluation, exact recursion, optimization via L-BFGS-B and Nelder-Mead, and residual diagnostics) are implemented in Fortran, combining high computational speed with a clean S3 interface in R.
The package covers i.i.d. samples, regression models, short-memory (*ARMA), long-memory (*ARFIMA), tempered fractional (*ARTFIMA), and chaotic (BARC) dynamics across six distributions. Appending V to a model name indicates a time-varying dispersion/precision parameter ($\nu_t$).
| Distribution | i.i.d. | Regression | Short Memory | Long Memory | Tempered | Chaotic |
|---|---|---|---|---|---|---|
| Beta | BETA |
BREG, BREGV |
BARMA, BARMAV |
BARFIMA, BARFIMAV |
BARTFIMA, BARTFIMAV |
BARC |
| Gamma | GAMMA |
GREG, GREGV |
GARMA, GARMAV |
GARFIMA, GARFIMAV |
GARTFIMA, GARTFIMAV |
— |
| Kumaraswamy | KUMA |
KREG, KREGV |
KARMA, KARMAV |
KARFIMA, KARFIMAV |
KARTFIMA, KARTFIMAV |
— |
| Matsuoka | MATSU |
MREG |
MARMA |
MARFIMA |
MARTFIMA |
— |
| Unit-Lindley | UL |
ULREG |
ULARMA |
ULARFIMA |
ULARTFIMA |
— |
| Unit-Weibull | UW |
UWREG, UWREGV |
UWARMA, UWARMAV |
UWARFIMA, UWARFIMAV |
UWARTFIMA, UWARTFIMAV |
— |
Run BTSR.models() in R to display the full list of supported models.
btsr.sim(), btsr.extract(), and btsr.fit() with any supported model string, alongside standard S3 methods (print(), summary(), predict()).link.btsr()), fixed parameter values (fixed.values), fixed lags (fixed.lags), and parameter bounds (lower, upper).*V models): Jointly models both location ($\mu_t$) and dispersion/precision ($\nu_t$) dynamics.dl.test()).Install the released version from CRAN:
install.packages("BTSR")
Or install the development version from GitHub:
# install.packages("remotes")
remotes::install_github("tsprass/BTSR")
library(BTSR)
# Simulate a BARMA(1, 1) time series
set.seed(1234)
y <- btsr.sim(
model = "BARMA",
n = 300,
burn = 100,
coefs = list(alpha = 0.2, phi = 0.4, theta = -0.3, nu = 20)
)
# Fit the model via conditional maximum likelihood
fit <- btsr.fit(model = "BARMA", yt = y, p = 1, q = 1, report = FALSE)
summary(fit)
# Out-of-sample forecasting (5 steps ahead)
pred <- predict(fit, nnew = 5)
pred$forecast
# Martingale difference diagnostic test on residuals
dl.test(fit$error, B = 300, p = 1)
| Function | Description |
|---|---|
btsr.sim() |
Simulate time series from any supported BTSR model |
btsr.fit() |
Estimate parameters via conditional maximum likelihood |
btsr.extract() |
Extract fitted values, residuals, log-likelihood, score, and forecasts for given parameters |
predict() |
Compute out-of-sample forecasts for a fitted btsr object |
BTSR.models() |
Print the summary table of supported distributions and model classes |
BTSR.model.defaults() |
Inspect default settings (links, bounds, flags) for a given model |
fit.control() |
Configure optimizer (L-BFGS-B or Nelder-Mead) and convergence settings |
link.btsr() |
Evaluate supported link functions, their inverses, and derivatives |
coefs.start() |
Compute starting parameter values for estimation |
dl.test() |
Perform the Dominguez-Lobato (2003) martingale difference test |
To cite BTSR in publications, run citation("BTSR") in R.
GPL (>= 3)