onlineCPD for a version that runs iteratively, one data point at a time. The algorithm implements the Bayesian methods given in Adams and Mackay (2007) and is based on Matlab code released with the paper. The model has been extended to work on multivariate data.
offlineCPD(data, time = NULL, hazard_func = const_hazard, m = 0, k = 0.01, a = 0.01, b = 1e-04)onlineCPD
data matrix or vector, used for pretty-printing in the plot.oCPD function.
mu, the mean of the data. Defaults to 0. As the mean is updated with every data point, this value does not need to be changed, but is safe to be experimented with.
kappa, basically a counter. Defaults to 0.01. May be useful to increase this to 1 if the data is large.
alpha, basically a counter. Defaults to 0.01. May be useful to increase this to 1 if the data is large.
beta, the variance of the data. Defaults to 1e-4. As the variance is updated with every data point, this value does not need to be changed, but is safe to be experimented with.
findCP, called from plot.oCPD, will help reduce some of these changes.The algorithm works by estimating the posterior distribution over the run-length, or the number of data points since the last changepoint. At each time, the run-length can either increase by one or reduce to zero.
The functions summary.oCPD, plot.oCPD, str.oCPD and print.oCPD are used to obtain summaries of the results.
See plot.oCPD for advice on how to interpret the results after plotting.
####OUR PAPER, WHEN IT EXISTS
##### Univariate Data #####
set.seed(6)
x <- c(rnorm(50,mean=0.3,sd=0.15),rnorm(40,mean=0.7,sd=0.1),rnorm(60,mean=0.5,sd=0.15))
plot(offlineCPD(x))
##### Real Multivariate Data #####
data(WalBelSentiment)
data(WalBelTimes)
plot(offlineCPD(WalBelSentiment[1400:1600,],WalBelTimes[1400:1600]))
Run the code above in your browser using DataLab