Calculate critical effect size values.
Project description
critical_es_value
Calculate critical effect size values for t-Tests, correlation tests and linear regression coefficients.
Installation
pip install critical-es-value
Overview
This package offers 8 main functions. Either provide the raw sample data to the main version of the function, or provide the summary statistics to the from_values() version.
| Main version | from_values() |
|---|---|
critical_for_one_sample_ttest() |
critical_for_one_sample_ttest_from_values() |
critical_for_two_sample_ttest() |
critical_for_two_sample_ttest_from_values() |
critical_for_correlation_test() |
critical_for_correlation_test_from_values() |
critical_for_linear_regression() |
critical_for_linear_regression_from_values() |
Main Usage
import numpy as np
import pingouin as pg
import critical_es_value as cev
np.random.seed(123)
mean, cov, n = [4, 5], [(1, .6), (.6, 1)], 30
x, y = np.random.multivariate_normal(mean, cov, n).T
t-Test
pg.ttest(x, 0)
cev.critical_for_one_sample_ttest(x)
| T | dof | alternative | p-val | CI95% | cohen-d | BF10 | power | |
|---|---|---|---|---|---|---|---|---|
| T-test | 16.0765 | 29 | two-sided | 5.54732e-16 | [3.37 4.35] | 2.93515 | 1.031e+13 | nan |
| T | dof | T_critical | d | d_critical | b_critical | g | g_critical | |
|---|---|---|---|---|---|---|---|---|
| critical | 16.0765 | 29 | 2.04523 | 2.93515 | 0.373406 | 0.491162 | 2.85847 | 0.363651 |
pg.ttest(x, y, paired=False)
cev.critical_for_two_sample_ttest(x, y, paired=False)
| T | dof | alternative | p-val | CI95% | cohen-d | BF10 | power | |
|---|---|---|---|---|---|---|---|---|
| T-test | -3.40071 | 58 | two-sided | 0.0012224 | [-1.68 -0.43] | 0.878059 | 26.155 | 0.916807 |
| T | dof | T_critical | d | d_critical | b_critical | g | g_critical | |
|---|---|---|---|---|---|---|---|---|
| critical | -3.40071 | 58 | 2.00172 | -0.878059 | 0.516841 | 0.62077 | -0.866647 | 0.510124 |
Correlation Test
pg.corr(x, y)
cev.critical_for_correlation_test(x, y)
| n | r | CI95% | p-val | BF10 | power | |
|---|---|---|---|---|---|---|
| pearson | 30 | 0.594785 | [0.3 0.79] | 0.00052736 | 69.723 | 0.950373 |
| n | r | dof | r_critical | se_r | se_r_critical | |
|---|---|---|---|---|---|---|
| critical | 30 | 0.594785 | 28 | 0.361007 | 0.15192 | 0.176238 |
Linear Regression
import pandas as pd
np.random.seed(123)
data = pd.DataFrame({"X": x, "Y": y, "Z": np.random.normal(5, 1, 30)})
pg.linear_regression(data[["X", "Z"]], data["Y"])
cev.critical_for_linear_regression(data[["X", "Z"]], data["Y"])
| names | coef | se | T | pval | r2 | adj_r2 | CI[2.5%] | CI[97.5%] | |
|---|---|---|---|---|---|---|---|---|---|
| 0 | Intercept | 3.15799 | 0.844129 | 3.74112 | 0.000874245 | 0.354522 | 0.306709 | 1.42598 | 4.88999 |
| 1 | X | 0.487772 | 0.126736 | 3.84871 | 0.000659501 | 0.354522 | 0.306709 | 0.22773 | 0.747814 |
| 2 | Z | -0.0249309 | 0.140417 | -0.177548 | 0.860403 | 0.354522 | 0.306709 | -0.313044 | 0.263182 |
| names | coef | coef_critical | |
|---|---|---|---|
| 0 | Intercept | 3.15799 | 1.73201 |
| 1 | X | 0.487772 | 0.260042 |
| 2 | Z | -0.0249309 | 0.288113 |
Usage of from_values() version
t-Test
t_test_result = pg.ttest(x, 0).iloc[0]
cev.critical_for_one_sample_ttest_from_values(
t=t_test_result["T"],
n=len(x),
dof=t_test_result.dof,
std=np.std(x, ddof=1),
)
| T | dof | T_critical | d | d_critical | g | g_critical | b_critical | |
|---|---|---|---|---|---|---|---|---|
| critical | 16.0765 | 29 | 2.04523 | 2.93515 | 0.373406 | 2.85847 | 0.363651 | 0.491162 |
t_test_result = pg.ttest(x, y, paired=False).iloc[0]
cev.critical_for_two_sample_ttest_from_values(
t=t_test_result["T"],
n1=len(x),
n2=len(y),
dof=t_test_result.dof,
paired=False,
std1=np.std(x, ddof=1),
std2=np.std(y, ddof=1),
)
| T | dof | T_critical | d | d_critical | g | g_critical | b_critical | |
|---|---|---|---|---|---|---|---|---|
| critical | -3.40071 | 58 | 2.00172 | -0.878059 | 0.516841 | -0.866647 | 0.510124 | 0.62077 |
Correlation Test
corr_test = pg.corr(x, y).iloc[0]
cev.critical_for_correlation_test_from_values(
r=corr_test["r"],
n=corr_test["n"],
variant="ttest",
)
| n | r | dof | r_critical | se_r | se_r_critical | |
|---|---|---|---|---|---|---|
| critical | 30 | 0.594785 | 28 | 0.361007 | 0.15192 | 0.176238 |
Linear Regression
model = pg.linear_regression(data[["X", "Z"]], data["Y"])
cev.critical_for_linear_regression_from_values(
coeffs=model["coef"].values,
coeffs_se=model["se"].values,
coeffs_names=model["names"].values,
dof=model.df_resid_,
variant="ttest",
)
| names | coef | coef_critical | |
|---|---|---|---|
| 0 | Intercept | 3.15799 | 1.73201 |
| 1 | X | 0.487772 | 0.260042 |
| 2 | Z | -0.0249309 | 0.288113 |
Resources
Perugini, A., Gambarota, F., Toffalini, E., Lakens, D., Pastore, M., Finos, L., ... & Altoè, G. (2025). The Benefits of Reporting Critical-Effect-Size Values. Advances in Methods and Practices in Psychological Science, 8(2), 25152459251335298.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file critical_es_value-0.3.0.tar.gz.
File metadata
- Download URL: critical_es_value-0.3.0.tar.gz
- Upload date:
- Size: 173.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82e1b546b9097f0572ef7621e3dd5ade70796fd9de21df416844764e9a96778c
|
|
| MD5 |
d2c11fd62c92d7f4d717036b7fbe0661
|
|
| BLAKE2b-256 |
556d320bdf6682671d8f9b4291cbfc34b2dc955440f839b0a547a9c8b8061888
|
Provenance
The following attestation bundles were made for critical_es_value-0.3.0.tar.gz:
Publisher:
publish.yaml on r0f1/critical_es_value
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
critical_es_value-0.3.0.tar.gz -
Subject digest:
82e1b546b9097f0572ef7621e3dd5ade70796fd9de21df416844764e9a96778c - Sigstore transparency entry: 606475307
- Sigstore integration time:
-
Permalink:
r0f1/critical_es_value@6e0e69c87397aa537ee650f2b458eb2b13a691da -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/r0f1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@6e0e69c87397aa537ee650f2b458eb2b13a691da -
Trigger Event:
release
-
Statement type:
File details
Details for the file critical_es_value-0.3.0-py3-none-any.whl.
File metadata
- Download URL: critical_es_value-0.3.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0f5cae9954b502bddcc7fc5f03e000349adc3e9ee1cce0a0ea12c97cc46cae3
|
|
| MD5 |
e24aebace152530e42be5d1de1fca1e2
|
|
| BLAKE2b-256 |
a7ce020d39612e6f4b2705ff1789b1f32c75a252710855df2e1b4557ecc8bade
|
Provenance
The following attestation bundles were made for critical_es_value-0.3.0-py3-none-any.whl:
Publisher:
publish.yaml on r0f1/critical_es_value
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
critical_es_value-0.3.0-py3-none-any.whl -
Subject digest:
c0f5cae9954b502bddcc7fc5f03e000349adc3e9ee1cce0a0ea12c97cc46cae3 - Sigstore transparency entry: 606475311
- Sigstore integration time:
-
Permalink:
r0f1/critical_es_value@6e0e69c87397aa537ee650f2b458eb2b13a691da -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/r0f1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@6e0e69c87397aa537ee650f2b458eb2b13a691da -
Trigger Event:
release
-
Statement type: