Utils¶
Utility functions and helper modules.
Statistics¶
Statistical utilities and helper functions.
Statistical utilities and helper functions.
- statqa.utils.stats.calculate_effect_size(data1, data2=None, effect_type='cohen_d')[source]¶
Calculate effect size for statistical tests.
- Parameters:
data1 (
Series|ndarray[Any,dtype[floating[Any]]] |float) – First sample or correlation coefficientdata2 (
Series|ndarray[Any,dtype[floating[Any]]] |None) – Second sample (for two-sample tests)effect_type (
Literal['cohen_d','r_to_d','cramers_v','eta_squared']) – Type of effect size (‘cohen_d’, ‘r_to_d’, ‘cramers_v’, ‘eta_squared’)
- Return type:
- Returns:
Effect size value
- Raises:
ValueError – If invalid effect_type or incompatible data
NotImplementedError – If effect_type is not yet implemented
- statqa.utils.stats.cohens_d(group1, group2)[source]¶
Calculate Cohen’s d effect size for two groups.
- statqa.utils.stats.correct_multiple_testing(p_values, method='fdr_bh', alpha=0.05)[source]¶
Apply multiple testing correction to p-values.
- Parameters:
p_values (
list[float] |ndarray[Any,dtype[floating[Any]]]) – List or array of p-valuesmethod (
Literal['bonferroni','fdr_bh','fdr_by']) – Correction method (‘bonferroni’, ‘fdr_bh’, ‘fdr_by’) - bonferroni: Bonferroni correction (most conservative) - fdr_bh: Benjamini-Hochberg FDR (recommended) - fdr_by: Benjamini-Yekutieli FDR (more conservative)alpha (
float) – Significance level
- Return type:
tuple[ndarray[Any,dtype[bool]],ndarray[Any,dtype[floating[Any]]]]- Returns:
Tuple of (reject, corrected_p_values) - reject: Boolean array indicating which tests reject null - corrected_p_values: Adjusted p-values
- Raises:
ValueError – If correction method is not supported
- statqa.utils.stats.cramers_v(contingency_table)[source]¶
Calculate Cramér’s V effect size for categorical associations.
- statqa.utils.stats.detect_outliers(data, method='iqr', threshold=1.5)[source]¶
Detect outliers in data.
- Parameters:
data (
Series|ndarray[Any,dtype[floating[Any]]]) – Input datamethod (
Literal['iqr','mad','zscore']) – Detection method (‘iqr’, ‘mad’, ‘zscore’)threshold (
float) – Threshold for outlier detection - iqr: Multiplier for IQR (default 1.5) - mad: Multiplier for MAD (default 3.0 recommended) - zscore: Z-score threshold (default 3.0)
- Return type:
- Returns:
Boolean array indicating outliers
- Raises:
ValueError – If outlier detection method is not supported
- statqa.utils.stats.mann_kendall_trend(series)[source]¶
Perform Mann-Kendall trend test for temporal data.
I/O¶
Input/output utilities for loading and saving data.
I/O utilities for loading and saving data.
- statqa.utils.io.load_data(source, file_pattern='(?i)\\\\.csv$', **kwargs)[source]¶
Load data from various sources.
Logging¶
Logging configuration and utilities.
Simple logging setup for statqa.
Provides minimal logging configuration with debug support via environment variable. No complex logging infrastructure - just simple, useful debugging.
- statqa.utils.logging.get_logger(name)[source]¶
Get a logger for a module with statqa’s simple configuration.
- Return type: