Detects the Most Recent Changepoints (mrc) for panel data consisting of many related univariate timeseries (Bardwell, Eckley, Fearnhead and Smith, 2016). The method first determines the most recent univariate changepoints using PELT (Killick, Fearnhead and Eckley 2012) and then pools information across the time-series by solving the K-median problem using tb.raw (Teitz and Bart, 1968).
mrc(
data,
cost = "mean",
alpha = function(n) 1.5 * log(n),
pmax = 5,
indexed = FALSE,
mad = FALSE,
phi = 0
)
An
A string indicating which cost function to use. Possible choices are "mean" (change in mean) or "var" (change in variance).
The default value is cost="mean"
.
The variable-specific penalty used to penalise the addition of a given changepoint into a given variable. This can be specified as a real positive value
or as a function of
Default value alpha=function(n) 1.5*log(n)
.
Maximum number of most recent changepoints to search for. Default value pmax=5
.
Boolean value indicating that the first column of data
is an index variable. If indexed=FALSE
an index variable will automatically be generated.
Default value is indexed=FALSE
.
Boolean value indicating if the variates should be scaled by an estimate of the their standard deviation obtained using mean absolute deviation (Zhang, Nancy, Siegmund and David 2007).
This is useful in conjunction with cost="mean"
for which unit variance is assumed. Default value is mad=FALSE
.
Lag 1 autocorrelation to model the temporal dependence in the residuals of the time series assuming a MA(1) process. Default phi=0
.
doi:10.1080/00401706.2018.1438926changepoint.mv
OR:TEITZBARTchangepoint.mv
doi:10.1080/01621459.2012.737745changepoint.mv
# NOT RUN {
library(changepoint.mv)
data(mrcexample)
res<-mrc(mrcexample,pmax=2)
MDL(res) # MDL == pmax (possibly under-estimating MDL, retry)
res<-mrc(mrcexample,pmax=6)
MDL(res) # MDL = 5 (< pmax)
# view the most recent changepoints (corresponding to pmax = 5)
unique(cpts.mr(res,p=5)[,1])
summary(res) # summary of result
# }
Run the code above in your browser using DataLab