Learn R Programming

changedetection (version 0.2.0)

changes: A list of change locations occured in the structure having given responses `y` and regressors `x`

Description

The main function of the package which estimates a set of structural change points for a dataset following multivariate (or univariate) linear model.

We consider the following problem. Assume we have observations \(y_t\in{R}^q\), \(x_t\in{R}^p\) over time \(t=1,...,N\) which follow linear model

$$ y_t= x'_t{\beta}(t)+{\epsilon}_t$$

where \(\epsilon_t\in{R}^d\) stands for the model noise and \(\beta\) is a \(p\times d\)-dimensional piecewise-constant function, i.e. \({\beta}(t)\in{R}^{p\times d}\) is a weight matrix for every \(t\). A change point is defined as a time instant \(\hat{t}\) where \(\beta\) shifts. More precisely, a set of points separating sequential regimes is a set of change points of the model and the objective of detectChanges function is to find this set.

The approach is based on the splitting procedure NSA gorskikh17changedetection and energy distance analysis rizzo-szekely10changedetection.

Usage

changes(x, y, tau = NULL, l = NULL, R = 1000, pzero = 0.05,
  gamma = 0.5, alpha = 1)

Arguments

x

matrix of regressors with variables in columns and observations in rows

y

matrix of responses with variables in columns and observations in rows

tau

length of splitting periods (default: l*10, which is dictated by The general rule of thumb Harrellchangedetection)

l

approximate number of contributing variables (default: overall number of regressors)

R

number of bootstrap rounds (default: `1000`)

pzero

trust level for bootstrap (default: `0.05`)

gamma

tau reduction rate used in NSA (default: `0.5`)

alpha

parameter for energy distance formula (default: `1`)

Value

A set of change locations indexes changes.

References

Examples

Run this code
# NOT RUN {
T<-60
change<-35
x<-rnorm(n=T, m=0, sd=1)
e<-scale(rt(n=T,3), scale=FALSE)
y1<-5*x[1:(change-1)]+e[1:(change-1)]
y2<--2*x[change:T]+e[change:T]
y<-c(y1,y2)

changes(x=as.data.frame(x),
        y=as.data.frame(y),
        tau=20, R=100)

# }

Run the code above in your browser using DataLab