Learn R Programming

changedetection (version 0.2.0)

movingEnergyDistance: Moving energy distance

Description

Estimates energy distance rizzo-szekely10changedetection for each point starting from tau+1 to T-tau, where T is a data length. In these terms, energy distance for a point means energy distance between the dataset containing tau observations to the left and the dataset containing tau observations to the right of the original point. Hence, we are considering a so-called 'moving frame' of length 2tau. The resulting array shows how the energy distance behaves along the period to analyze.

Usage

movingEnergyDistance(x, y, l = NULL, tau = NULL, 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

l

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

tau

length of a splitting period (Default: l*10, which is dictated by The general rule of thumb Harrellchangedetection)

alpha

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

Value

a list of energy distnce values for pairs of adjacent data segments of length tau (moving-frame construction)

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)

med <- movingEnergyDistance(x=as.data.frame(x),
                            y=as.data.frame(y))
# }

Run the code above in your browser using DataLab