View source: R/followingRelation.R
followingRelation | R Documentation |
03/24/2021: Chai's code rewritten by Namrata to replicate Matlab version The changes are in the DTW function, which is implemented here as DTW2 instead of the one in the R package DTW
followingRelation is a function that infers whether Y
follows X
.
followingRelation(Y, X, timeLagWindow, lagWindow = 0.1)
Y |
is a T-by-D matrix of numerical time series of a follower |
X |
is a T-by-D matrix numerical time series of a leader |
timeLagWindow |
is a maximum possible time delay in the term of time steps. |
lagWindow |
is a maximum possible time delay in the term of percentage of length(X).
If |
This function returns a list of following relation variables below.
follVal |
is a following-relation value s.t. if |
dtwIndexVec |
is a numeric vector of index-warping difference: dtwIndexVec[k] = dtwOut$index1[k] - dtwOut$index2[k] where dtwOut is the output from dtw::dtw(x=Y,y=X) function. |
# Load example data ???
leader<- mFLICA::TS[1,1:200,]
follower<- mFLICA::TS[2,1:200,]
# Run the function
out<-followingRelation(Y=follower,X=leader)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.