Naive, constrained resampling
If you need to truncate the furnishing distributions of your uncertain datasets before applying a causality test, use the following method.
#
CausalityToolsBase.causality
— Method.
causality(source::AbstractUncertainIndexValueDataset,
target::AbstractUncertainIndexValueDataset,
test::ConstrainedTest{CT, CR}) where {CT, CR}
Apply a causality test of type CT
to test.n
independent realisations of source
and target
, after first constraining the supports of the uncertain values furnishing the datasets.
See also ConstrainedTest
.
ConstrainedTest
#
CausalityTools.CausalityTests.ConstrainedTest
— Type.
ConstrainedTest(test::CausalityTest, constraints::ConstrainedResampling, n::Int)
ConstrainedTest(test::CausalityTest, constraints::ConstrainedResampling)
A causality test where the supports of the uncertain values furnishing the uncertain values in the datasets are truncated (according to the provided constraints
) prior to performing the test
.
n
controls the number of independent resamplings over which the test is performed (if not provided, n
is set to 1
by default).
Examples
Assume we want to apply a causality test to two uncertain datasets X
and Y
, but restricting the ranges of values their elements can take while resampling.
# Constraints for X.indices and X.values
cx = (TruncateQuantiles(0.3, 0.7), TruncateStd(1.5))
# Constraints for Y.indices and Y.values
cy = (TruncateQuantiles(0.3, 0.7), TruncateStd(1.5))
# Need to gather to feed to the ConstrainedTest constructor.
cs = ConstrainedIndexValueResampling(cx, cy)
# A cross mapping test applied to 100 independent realisations
# of `X` and `Y`, resampled after constraining the data.
ctest = ConstrainedTest(CrossMappingTest(), cs, 100)