BEAST: A Bayesian Ensemble Algorithm for Change-Point Detection and Time Series Decomposition
BEAST (Bayesian Estimator of Abrupt change, Seasonality, and Trend) is a fast, generic Bayesian model averaging algorithm to decompose time series or 1D sequential data into individual components, such as abrupt changes, trends, and periodic/seasonal variations, as described in Zhao et al. (2019). BEAST is useful for changepoint detection (e.g., breakpoints, structural breaks,joinpoints, regime shifts, or anomalies), trend analysis, time series decomposition (e.g., trend vs seasonality), time series segmentation, and interrupted time series analysis. See a list of selected studies using BEAST .
Quick Installation
BEAST was impemented in C/C++ but accessible from R, Python, Matlab, and Octave. Install it as follows:
Python:
pip install Rbeast
Matlab:
eval(webread('http://b.link/rbeast',weboptions('cert','')))
Octave:
eval(webread('http://b.link/rbeast'))
R lang:
install.packages("Rbeast")
Quick Usage
One-liner code for Python, Matlab and R:
# Python example
import Rbeast as rb; (Nile, Year)=rb.load_example('nile'); o=rb.beast(Nile,season='none'); rb.plot(o)
# Matlab/Octave example
load('Nile'); o = beast(Nile, 'season','none'); plotbeast(o)
# R example
library(Rbeast); data(Nile); o = beast(Nile); plot(o)
Installation for R
Rbeast in CRAN-TASK-VIEW: [Time Series Analysis] [Bayesian inference] [Environmetrics]
An R package Rbeast
has been deposited at CRAN. ( On CRAN, there is another Bayesian time-series package named "beast", which has nothing to do with the BEAST algorithim. Our package is Rbeast
. Also, Rbeast
has nothing to do with the famous "Bayesian evolutionary analysis by sampling trees" aglorithm.) Install Rbeast
in R using
install.packages("Rbeast")
Run and test Rbeast in R
The main functions in Rbeast are beast(Y, ...)
, beast.irreg(Y, ...)
, and beast123(Y, metadata, prior, mcmc, extra)
. The code snippet below provides a starting point for the basic usage.
library(Rbeast)
data(Nile) # annual streamflow of the Nile River
out = beast(Nile, season='none') # 'none': trend-only data without seasonlaity
print(out)
plot(out)
?Rbeast # See more details about the usage of `beast`
tetris() # if you dare to waste a few moments of your life
minesweeper() # if you dare to waste a few more moments of your life