latent.stats.effect_size¶
Effect size calculations.
Delegates to scipy for core statistical computations.
Functions¶
cohens_d¶
Cohen's d effect size for two groups.
Derived from the t-statistic of an independent-samples t-test (equal variance assumed).
Reference: Cohen (1988), via scipy.stats.ttest_ind.
Args: scores_a: Scores from group A. scores_b: Scores from group B.
Returns: Cohen's d (positive means B > A).
cohens_d_paired¶
Cohen's d_z for paired data.
Derived from the t-statistic of a paired-samples t-test.
Reference: Cohen (1988), via scipy.stats.ttest_rel.
Args: scores_a: Scores from group A. scores_b: Scores from group B (paired, same order).
Returns: Cohen's d_z (positive means B > A).
common_language_effect_size¶
Common language effect size (probability of superiority).
Computes the probability that a randomly drawn score from B exceeds a randomly drawn score from A, using the Mann-Whitney U statistic (which handles ties as half-credit).
Reference: Vargha & Delaney (2000), via scipy.stats.mannwhitneyu.
Args: scores_a: Scores from group A. scores_b: Scores from group B.
Returns: Probability in [0, 1]. 0.5 means no difference.
odds_ratio¶
Odds ratio comparing two groups with Haldane continuity correction.
Reference: Haldane-Anscombe correction. Uses the sample odds ratio
formula (a * d) / (b * c) with 0.5 added to each cell to handle
zero counts. scipy.stats.contingency.odds_ratio requires integer
tables and cannot apply the Haldane correction directly.
Args: a_success: Successes in group A. a_total: Total in group A. b_success: Successes in group B. b_total: Total in group B.
Returns: Odds ratio (B relative to A). Values > 1 mean B has higher odds.
risk_ratio¶
Risk ratio (relative risk) comparing two groups.
Reference: via scipy.stats.contingency.relative_risk.
Args: a_success: Successes in group A. a_total: Total in group A. b_success: Successes in group B. b_total: Total in group B.
Returns: Risk ratio (B relative to A). Values > 1 mean B has higher rate.