Skip to content

Commit 8d1c2e4

Browse files
authored
Chatterjee coefficient (#383)
* Chatterjee coefficient. * Finalize Chatterjee correlation * Fix examples * Fix badges * Add missing references in tables * Add reference * Remove unnecessary folder * Reproducible tests * Use .= syntax
1 parent d5268cf commit 8d1c2e4

File tree

16 files changed

+440
-41
lines changed

16 files changed

+440
-41
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = "Associations"
22
uuid = "614afb3a-e278-4863-8805-9959372b9ec2"
33
authors = ["Kristian Agasøster Haaga <[email protected]>", "Tor Einar Møller <[email protected]>", "George Datseris <[email protected]>"]
44
repo = "https://github.com/kahaaga/Associations.jl.git"
5-
version = "4.0.0"
5+
version = "4.1.0"
66

77
[deps]
88
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
[![CI](https://github.com/juliadynamics/Associations.jl/workflows/CI/badge.svg)](https://github.com/JuliaDynamics/Associations.jl/actions)
44
[![](https://img.shields.io/badge/docs-latest_tagged-blue.svg)](https://juliadynamics.github.io/Associations.jl/stable/)
5-
[![](https://img.shields.io/badge/docs-dev_(master)-blue.svg)](https://juliadynamics.github.io/Associations.jl/dev/)
6-
[![codecov](https://codecov.io/gh/JuliaDynamics/Associations.jl/branch/master/graph/badge.svg?token=0b71n6x6AP)](https://codecov.io/gh/JuliaDynamics/Associations.jl)
5+
[![](https://img.shields.io/badge/docs-dev_(main)-blue.svg)](https://juliadynamics.github.io/Associations.jl/dev/)
6+
[[![codecov](https://codecov.io/gh/JuliaDynamics/Associations.jl/branch/master/graph/badge.svg?token=0b71n6x6AP)](https://codecov.io/gh/JuliaDynamics/Associations.jl)](https://img.shields.io/codecov/c/github/juliadynamics/Associations.jl/main)
77
[![DOI](https://zenodo.org/badge/135443027.svg)](https://zenodo.org/badge/latestdoi/135443027)
88

99
Associations.jl is a package for quantifying associations, independence testing and causal inference.

changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
From version v4.0 onwards, this package has been renamed to to Associations.jl.
4+
5+
# 4.1
6+
7+
- New association measure: `ChatterjeeCorrelation`.
8+
9+
# 4.0 (package rename)
10+
11+
The package has been renamed from CausalityTools.jl to Associations.jl.
12+
313
## 3.0 (new major release)
414

515
This release contains several breaking changes. Any code from before v3.0 will need

docs/refs.bib

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,4 +1289,37 @@ @article{Arnhold1999
12891289
pages={419--430},
12901290
year={1999},
12911291
publisher={Elsevier}
1292+
}
1293+
1294+
@article{Chatterjee2021,
1295+
title={A new coefficient of correlation},
1296+
author={Chatterjee, Sourav},
1297+
journal={Journal of the American Statistical Association},
1298+
volume={116},
1299+
number={536},
1300+
pages={2009--2022},
1301+
year={2021},
1302+
publisher={Taylor \& Francis}
1303+
}
1304+
1305+
@article{Shi2022,
1306+
title={On the power of Chatterjee’s rank correlation},
1307+
author={Shi, Hongjian and Drton, Mathias and Han, Fang},
1308+
journal={Biometrika},
1309+
volume={109},
1310+
number={2},
1311+
pages={317--333},
1312+
year={2022},
1313+
publisher={Oxford University Press}
1314+
}
1315+
1316+
@article{Dette2013,
1317+
title={A Copula-Based Non-parametric Measure of Regression Dependence},
1318+
author={Dette, Holger and Siburg, Karl F and Stoimenov, Pavel A},
1319+
journal={Scandinavian Journal of Statistics},
1320+
volume={40},
1321+
number={1},
1322+
pages={21--41},
1323+
year={2013},
1324+
publisher={Wiley Online Library}
12921325
}

docs/src/associations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ CorrelationMeasure
114114
PearsonCorrelation
115115
PartialCorrelation
116116
DistanceCorrelation
117+
ChatterjeeCorrelation
117118
```
118119

119120
## [Cross-map measures](@id cross_map_api)

docs/src/examples/examples_associations.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1697,4 +1697,32 @@ using Random; rng = Xoshiro(1234);
16971697
x = rand(rng, 300); y = rand(rng, 300) .* sin.(x); z = rand(rng, 300) .* y;
16981698
est = RMCD(r = 0.5)
16991699
association(est, x, y), association(est, x, z), association(est, x, z, y)
1700-
```
1700+
```
1701+
1702+
## [[`ChatterjeeCorrelation`](@ref)](@id example_ChatterjeeCorrelation)
1703+
1704+
```@example example_ChatterjeeCorrelation
1705+
using Associations
1706+
using Random; rng = Xoshiro(1234);
1707+
x = rand(rng, 120)
1708+
y = rand(rng, 120) .* sin.(x)
1709+
```
1710+
1711+
By construction, there will almust surely be no ties in `x`, so we can use the
1712+
fast estimate by setting `handle_ties == false`.
1713+
1714+
```@example example_ChatterjeeCorrelation
1715+
association(ChatterjeeCorrelation(handle_ties = false), x, y)
1716+
```
1717+
1718+
If we have data where we know there are ties in the data, then
1719+
we should set `handle_ties == true`.
1720+
1721+
```@example example_ChatterjeeCorrelation
1722+
w = rand(rng, 1:10, 120) # there will be some ties
1723+
z = rand(rng, 1:15, 120) .* sin.(w) # introduce some dependence
1724+
association(ChatterjeeCorrelation(handle_ties = true), w, z)
1725+
```
1726+
1727+
1728+

docs/src/examples/examples_independence.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,26 @@ enough evidence in the data to suggest directional coupling.
117117

118118
## [[`SurrogateAssociationTest`](@ref)](@id examples_surrogatetest)
119119

120+
### [Chatterjee correlation](@id example_SurrogateAssociationTest_ChatterjeeCorrelation)
121+
122+
```@example example_SurrogateAssociationTest_ChatterjeeCorrelation
123+
using Associations
124+
using Random; rng = Xoshiro(1234)
125+
n = 1000
126+
x, y = rand(1:50, n), rand(1:50, n)
127+
test = SurrogateAssociationTest(ChatterjeeCorrelation(), nshuffles = 19)
128+
independence(test, x, y)
129+
```
130+
131+
As expected, the test indicates that we can't reject independence. What happens if we introduce
132+
a third variable that depends on `y`?
133+
134+
```@example example_SurrogateAssociationTest_ChatterjeeCorrelation
135+
z = rand(1:20, n) .* y
136+
independence(test, y, z)
137+
```
138+
139+
The test clearly picks up on the functional dependence.
120140

121141
### [Distance correlation](@id example_SurrogateAssociationTest_DistanceCorrelation)
122142

0 commit comments

Comments
 (0)