Skip to content

Calculates the earliest index in a time series from which causality analysis can begin, based on the embedding dimension, time delay, prediction horizon, and the length of the series. It ensures that there are enough data points for conducting a causality analysis without running out of data.

Usage

firstCausalityPoint(E, tau, h, X)

Arguments

E

An integer representing the embedding dimension, which influences the number of dimensions in which the time series is reconstructed for analysis.

tau

An integer representing the time delay, used in reconstructing the time series in the embedded space.

h

An integer representing the prediction horizon, indicating how far ahead in the time series the predictions are aimed.

X

A numeric vector representing the time series data.

Value

An integer indicating the first index in the time series from which causality analysis is feasible without running out of data. If the parameters are set such that the analysis is not possible, the function will stop and provide an error message.

Examples

time_series <- rnorm(1000) # Generate a random time series of 1000 points
embedding_dim <- 3 # Set embedding dimension
time_delay <- 2 # Set time delay
pred_horizon <- 1 # Set prediction horizon

# Calculate the first causality point
fc_point <- firstCausalityPoint(embedding_dim, time_delay, pred_horizon, time_series)
print(fc_point)
#> [1] 10