my_code_base.stats.core¶
Functions¶
|
Calculate the t-statistic for a given correlation coefficient and number of effective samples. |
|
Calculate the p-value for a given t-statistic and number of degrees of freedom. |
Module Contents¶
- my_code_base.stats.core.t_statistic(r, dof)[source]¶
Calculate the t-statistic for a given correlation coefficient and number of effective samples.
The formula is given by:
\[t_\text{score} = r \cdot \frac{ \sqrt{dof} }{ \sqrt{1 - r^2} } = r \cdot \frac{ \sqrt{n_\text{eff}-2} }{ \sqrt{1 - r^2} }\]where $r$ is the Pearson correlation coefficient, $dof$ is the number of degrees of freedom, typicallyt he number of effective sample size - 2.
- my_code_base.stats.core.tstats_p_value(t, dof)[source]¶
Calculate the p-value for a given t-statistic and number of degrees of freedom.
The formula is given by:
\[\begin{split}f_p &= 2 \cdot (1 - \text{cdf}(t, dof)) \\ &= 2 \cdot \text{sf}(t, dof)\end{split}\]sfis the survival function of the t-distribution fromscipy.stats.tand is equivalent to1-cdf. The number of degrees of freedom (dof) is typically the number of effective samples - 2.