This repository contains the R package betaARMA, a comprehensive toolkit for fitting, forecasting, and simulating Beta Autoregressive Moving Average models. It provides a unified workflow for modeling time series data bounded on the (0, 1) interval, such as rates, proportions, and indices.
Modeling time series data bounded within the unit interval $(0, 1)$ presents unique challenges. Standard Gaussian methods (like ARIMA) are often inappropriate because they do not respect the natural boundaries of the data, potentially leading to fitted values or forecasts outside the admissible range.
The $\beta\text{ARMA}$ model addresses this by assuming the conditional distribution of the variable follows a Beta law. While the theoretical foundations exist, there has been a need for a modern, robust R package that:
forecast).This project aims to fill that gap, serving as a go-to resource for hydrologists, economists, and data scientists working with bounded data.
This package implements the methodology established in the following key publications. The original code foundation was developed by Fabio M. Bayer and has been substantially optimized and refactored for this package.
This package utilizes modern R development standards (S3 classes, roxygen2 documentation) to provide a seamless user experience.
barma(), handles any combination of AR and MA lags, as well as exogenous regressors (xreg).summary(): Detailed coefficients, standard errors, and significance tests.forecast(): Multi-step-ahead point forecasts.residuals(): Extraction of standardized residuals.fitted(): Extraction of fitted values.The repository is structured as a standard R package for clarity and reproducibility.
.
├── R/ # Source code for all R functions.
├── man/ # R package documentation files (generated by roxygen2).
├── tests/ # Unit tests (using testthat).
├── validation/ # Validation scripts comparing results to literature.
├── DESCRIPTION # Package metadata and dependencies.
├── NAMESPACE # Manages the package's namespace (generated by roxygen2).
├── LICENSE # MIT License file.
└── README.md # This file.
Please note that the betaARMA project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
You can install the development version of betaARMA directly from GitHub.
First, ensure you have the remotes package installed:
if (!require("remotes")) {
install.packages("remotes")
}
Then, install the package:
remotes::install_github("Everton-da-Costa/betaARMA",
dependencies = TRUE)
Here is a quick example of how to simulate data, fit a model, and generate forecasts.
library(betaARMA)
# 1. Simulate data from a BARMA(1,1) process
set.seed(123)
y <- simu_barma(n = 150, ar = 1, ma = 1, varphi = 0.5, theta = 0.3, phi = 20)
# 2. Fit the model
# We assume a fixed precision (phi) and logit link by default
fit <- barma(y, ar = 1, ma = 1)
# 3. Inspect results
summary(fit)
# 4. Forecast the next 6 steps
pred <- forecast(fit, h = 6)
print(pred)
If you use this package in your research, please cite it as follows:
@Manual{,
title = {betaARMA: Beta Autoregressive Moving Average Models},
author = {Everton da Costa, Francisco Cribari-Neto and Vinícius T. Scher},
year = {2026},
note = {R package version 1.0.0},
url = {[https://github.com/Everton-da-Costa/betaARMA](https://github.com/Everton-da-Costa/betaARMA)},
}
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions, suggestions, or issues related to the code, please contact:
Everton da Costa 📧 everto.cost@gmail.com
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.