Learn R Programming

BCT (version 1.2)

Bayesian Context Trees for Discrete Time Series

Description

An implementation of a collection of tools for exact Bayesian inference with discrete times series. This package contains functions that can be used for prediction, model selection, estimation, segmentation/change-point detection and other statistical tasks. Specifically, the functions provided can be used for the exact computation of the prior predictive likelihood of the data, for the identification of the a posteriori most likely (MAP) variable-memory Markov models, for calculating the exact posterior probabilities and the AIC and BIC scores of these models, for prediction with respect to log-loss and 0-1 loss and segmentation/change-point detection. Example data sets from finance, genetics, animal communication and meteorology are also provided. Detailed descriptions of the underlying theory and algorithms can be found in [Kontoyiannis et al. 'Bayesian Context Trees: Modelling and exact inference for discrete time series.' Journal of the Royal Statistical Society: Series B (Statistical Methodology), April 2022. Available at: [stat.ME], July 2020] and [Lungu et al. 'Change-point Detection and Segmentation of Discrete Data using Bayesian Context Trees' [stat.ME], March 2022].

Copy Link

Version

Install

install.packages('BCT')

Monthly Downloads

83

Version

1.2

License

GPL (>= 2)

Maintainer

Valentinian Lungu

Last Published

May 12th, 2022

Functions in BCT (1.2)

kBCT

k-Bayesian Context Trees (kBCT) algorithm
gene_s

SARS-CoV-2 gene S
generate_data

Sequence generator
CTW

Context Tree Weighting (CTW) algorithm
prediction

Prediction
plot_individual_changepoint_posterior

Plot empirical conditional posterior of the number of change-points.
simian_40

simian_40
infer_fixed_changepoints

Inferring the change-points locations when the number of change-points is fixed.
infer_unknown_changepoints

Inferring the number of change-points and their locations.
pewee

Pewee birdsong
three_changes

three_changes
log_loss

Calculating the log-loss incurred in prediction
zero_one_loss

Calculating the 0-1 loss incurred in prediction
plot_changepoint_posterior

Plot the empirical posterior distribution of the change-points.
sars_cov_2

SARS-CoV-2 genome
show_tree

Plot tree with given contexts
enterophage

Enterobacteria_phage_lambda
calculate_exact_changepoint_posterior

Calculates the exact posterior for a sequence with a single change-point.
compute_counts

Compute empirical frequencies of all contexts
BCT

Bayesian Context Trees (BCT) algorithm
draw_models

Plot the results of the BCT and kBCT functions
MAP_parameters

Parameters of the MAP model
SP500

Daily changes in the S&P 500 index
el_nino

El Nino
ML

Maximum Likelihood