dcor is a Python library that provides efficient implementations of distance correlation and energy statistics, powerful tools for measuring dependence and performing two-sample tests. It supports various statistical tests including independence testing and two-sample testing. Currently at version 0.7, it is actively maintained with regular updates and a focus on numerical stability and performance.
pip install dcorVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to calculate distance correlation, energy distance, and perform an independence test using dcor. It initializes sample NumPy arrays and applies the main functions, printing their results.
Update your code to use `dcor.distance_correlation`.
Ensure your input data is converted to `numpy.ndarray` before passing it to dcor functions (e.g., `np.array(my_list)`).
Always provide a sufficiently large `n_bootstraps` argument (e.g., 1000 or more for production) to `independence_test`.
Reshape or filter your data to ensure `x.shape[0] == y.shape[0]` before computing statistics like distance correlation or energy distance.