Causality from time series
The causality
function and its methods provide a common interface for testing causal hypotheses. For analysing time series, all you need to do is provide a source
and a target
. Then, choose one of the available causality tests to quantify the (directional) dynamical dependence between source
and target
.
For data with uncertainties, see uncertainty handling.
#
CausalityToolsBase.causality
— Method.
causality(source::AbstractVector, AbstractVector, test::CausalityTest)
Test for a causal influence from source
to target
using the provided causality test
.
Examples
x, y = rand(300), rand(300)
# Define some causality tests and apply them to `x` and `y`.
test_ccm = ConvergentCrossMappingTest(timeseries_lengths = [45, 50], n_reps = 20)
test_cm = CrossMappingTest(n_reps = 10)
test_vf = VisitationFrequencyTest(binning = RectangularBinning(5), ηs = 1:5)
test_tog = TransferOperatorGridTest(binning = RectangularBinning(5), ηs = 1:5)
test_jdd = JointDistanceDistributionTest()
test_jddt = JointDistanceDistributionTTest()
predtest = VisitationFrequencyTest(binning = RectangularBinning(5), ηs = -5:5)
test_pa = PredictiveAsymmetryTest(predictive_test = predtest)
causality(x, y, test_ccm)
causality(x, y, test_cm)
causality(x, y, test_vf)
causality(x, y, test_tog)
causality(x, y, test_jdd)
causality(x, y, test_jddt)
causality(x, y, test_pa)