followingRelation: followingRelation

Description Usage Arguments Value Examples

View source: R/followingRelation.R

Description

followingRelation is a function that infers whether Y follows X.

Usage

1
followingRelation(Y, X, timeLagWindow, lagWindow = 0.2)

Arguments

Y

is a numerical time series of a follower

X

is a 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 timeLagWindow is missing, then timeLagWindow=ceiling(lagWindow*length(X)). The default is 0.2.

Value

This function returns a list of following relation variables below.

follVal

is a following-relation value s.t. if follVal is positive, then Y follows X. If follVal is negative, then X follows Y. Otherwise, if follVal is zero, there is no following relation between X,Y.

nX

is a time series that is rearranged from X by applying the lags optIndexVec in order to imitate Y.

optDelay

is the optimal time delay inferred by cross-correlation of X,Y. It is positive if Y is simply just a time-shift of X (e.g. Y[t]=X[t-optDelay]).

optCor

is the optimal correlation of Y[t]=X[t-optDelay] for all t.

optIndexVec

is a time series of optimal warping-path from DTW that is corrected by cross correlation. It is approximately that Y[t]=X[t-optIndexVec[t]]).

VLval

is a percentage of elements in optIndexVec that is not equal to optDelay.

ccfout

is an output object of ccf function.

Examples

1
2
3
4
# Generate simulation data
TS <- SimpleSimulationVLtimeseries()
# Run the function
out<-followingRelation(Y=TS$Y,X=TS$X)

VLTimeCausality documentation built on Jan. 24, 2022, 5:07 p.m.