Description Usage Arguments Value References Examples
Estimate energy distance which is a metric that measures the distance between the distributions of random vectors \insertCiterizzo-szekely10changedetection. The energy distance is zero if an only if the distributions are identical, otherwise it will diverge.
1 | energyDistance(x1, y1, x2, y2, l = NULL, alpha = 1)
|
x1 |
matrix of first period regressors with variables in columns and observations in rows |
y1 |
matrix of first period responses with variables in columns and observations in rows |
x2 |
matrix of second period regressors with variables in columns and observations in rows |
y2 |
matrix of second period responses with variables in columns and observations in rows |
l |
approximate number of contributing variables (default: overall number of regressors) |
alpha |
parameter for energy distance formula (default: '1') |
energy distance value
1 2 3 4 5 6 7 8 9 10 11 12 | 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)
ed <- energyDistance(x1=as.data.frame(x[1:30]),
y1=as.data.frame(y[1:30]),
x2=as.data.frame(x[31:T]),
y2=as.data.frame(y[31:T]))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.