# Some questions regarding the calculation of effective degrees of freedom in the corr\_ttest function in pyleoclim

**URL:** <https://discourse.linked.earth/t/some-questions-regarding-the-calculation-of-effective-degrees-of-freedom-in-the-corr-ttest-function-in-pyleoclim/148>\
**Category:** Software\
**Tags:** pyleoclim\
**Created:** [February 24, 2025, 7:29am UTC](https://discourse.linked.earth/t/some-questions-regarding-the-calculation-of-effective-degrees-of-freedom-in-the-corr-ttest-function-in-pyleoclim/148 "2025-02-24T07:29:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LiaresCN](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.linked.earth/liarescn/32/89_2.png) [@LiaresCN](https://discourse.linked.earth/u/LiaresCN)\
**Post date:** [February 24, 2025, 7:29am UTC](https://discourse.linked.earth/t/some-questions-regarding-the-calculation-of-effective-degrees-of-freedom-in-the-corr-ttest-function-in-pyleoclim/148/1 "2025-02-24T07:29:55Z")

</div>

Hello teachers, I have some questions regarding the `corr_ttest` function in `pyleoclim`. This function provides a calculation for effective degrees of freedom, but when I reviewed the calculation method, I noticed that the resulting effective degrees of freedom can exceed the length of the data itself. The formula used is **Ne = gmean([Ney1 + Ney2])**, and I am curious as to why the geometric mean is used instead of the arithmetic mean. Additionally, the formula used in the article by (Hu, EPSL, 2017 ) seems different from the one in the `corr_ttest` function. Therefore, I would like to ask which method provides the correct calculation for effective degrees of freedom?

---

<div class="post-metadata">

**Author:** ![jeg](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.linked.earth/jeg/32/12_2.png) [@jeg](https://discourse.linked.earth/u/jeg)\
**Post date:** [March 12, 2025, 8:56pm UTC](https://discourse.linked.earth/t/some-questions-regarding-the-calculation-of-effective-degrees-of-freedom-in-the-corr-ttest-function-in-pyleoclim/148/2 "2025-03-12T20:56:27Z")

</div>

Hi @LiaresCN. I don’t advocate for the modified T-test because it is approximate, and tends to fail when autocorrelation is very high (which is very likely the case in your example). Is there any reason why you cannot use [phase randomization](https://linked.earth/PyleoTutorials/notebooks/L1_surrogates.html#phase-randomization-and-correlations)?  
In general, when parametric methods misbehave, it is an indication that they are a poor fit for your data – a red flag to heed. That being said you raise a good point about the discrepancy between the code and paper. I now cannot remember why I implemented the geometric mean. Can you open an [issue](https://github.com/LinkedEarth/Pyleoclim_util/issues/new/choose) and I’ll get to it this week?

Some sense of the type of data you are applying this to would be helpful.
