regimes {sovereign}R Documentation

Identify regimes via unsupervised ML algorithms

Description

Regime assignment (clustering) methods available include the unsupervised random forest, k-mean clustering, Fraley and Raftery Model-based clustering EM algorithm, and the Bai & Perron (2003) method for simultaneous estimation of multiple breakpoints.

Usage

regimes(data, method = "rf", regime.n = NULL)

Arguments

data

data.frame, matrix, ts, xts, zoo: Endogenous regressors

method

string: regime assignment technique ('rf', 'kmeans', 'EM', or 'BP)

regime.n

int: number of regimes to estimate (applies to kmeans and EM)

Value

data as a data.frame with a regime column assigning rows to mutually exclusive regimes

Examples



 # simple time series
 AA = c(1:100) + rnorm(100)
 BB = c(1:100) + rnorm(100)
 CC = AA + BB + rnorm(100)
 date = seq.Date(from = as.Date('2000-01-01'), by = 'month', length.out = 100)
 Data = data.frame(date = date, AA, BB, CC)

 # estimate reigme
 regime =
  sovereign::regimes(
     data = Data,
     method = 'kmeans',
     regime.n = 3)



[Package sovereign version 1.2.1 Index]