Learn R Programming

brms (version 1.10.2)

cor_bsts: Basic Bayesian Structural Time Series

Description

Add a basic Bayesian structural time series component to a brms model

Usage

cor_bsts(formula = ~1)

Arguments

formula

A one sided formula of the form ~ t, or ~ t | g, specifying a time covariate t and, optionally, a grouping factor g. A covariate for this correlation structure must be integer valued. When a grouping factor is present in formula, the correlation structure is assumed to apply only to observations within the same grouping level; observations with different grouping levels are assumed to be uncorrelated. Defaults to ~ 1, which corresponds to using the order of the observations in the data as a covariate, and no groups.

Value

An object of class cor_bsts.

Details

Bayesian structural time series models offer an alternative to classical AR(I)MA models (they are in fact a generalization). The basic version currently implemented in brms introduces local level terms for each observation, whereas each local level term depends on the former local level term: $$LL_t ~ N(LL_{t-1}, sigmaLL)$$ A simple introduction can be found in this blogpost: http://multithreaded.stitchfix.com/blog/2016/04/21/forget-arima/. More complicated Bayesian structural time series models may follow in the future.

Examples

Run this code
# NOT RUN {
dat <- data.frame(y = rnorm(100), x = rnorm(100))
fit <- brm(y~x, data = dat, autocor = cor_bsts())
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab