API Comparison Table - Quick Function Lookup
Overview
This guide helps you quickly find the Real Simple Stats function you need, with comparisons to similar functions in other popular libraries.
Descriptive Statistics
Task |
Real Simple Stats |
NumPy |
SciPy |
Pandas |
statsmodels |
|---|---|---|---|---|---|
Mean |
|
|
- |
|
- |
Median |
|
|
- |
|
- |
Mode |
|
- |
|
|
- |
Std Dev |
|
|
- |
|
- |
Variance |
|
|
- |
|
- |
Range |
|
|
- |
|
- |
IQR |
|
|
- |
|
- |
5-Number Summary |
|
- |
- |
|
- |
CV |
|
- |
|
- |
- |
Example:
import real_simple_stats as rss
data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(rss.mean(data)) # 5.5
print(rss.five_number_summary(data)) # {'min': 1, 'q1': 3.25, ...}
Probability Distributions
Normal Distribution
Task |
Real Simple Stats |
SciPy |
NumPy |
|---|---|---|---|
|
|
- |
|
CDF |
|
|
- |
Inverse CDF |
|
|
- |
Z-score |
|
|
- |
Random samples |
- |
|
|
Binomial Distribution
Task |
Real Simple Stats |
SciPy |
NumPy |
|---|---|---|---|
PMF |
|
|
- |
CDF |
|
|
- |
Mean |
|
|
- |
Variance |
|
|
- |
Other Distributions
Distribution |
Real Simple Stats |
SciPy Equivalent |
|---|---|---|
Poisson |
|
|
Geometric |
|
|
Exponential |
|
|
Negative Binomial |
|
|
Example:
import real_simple_stats as rss
# Normal distribution
prob = rss.normal_cdf(1.96, 0, 1) # P(Z ≤ 1.96) ≈ 0.975
# Binomial distribution
prob = rss.binomial_probability(10, 7, 0.5) # P(X=7) when n=10, p=0.5
🧪 Hypothesis Testing
Test |
Real Simple Stats |
SciPy |
statsmodels |
|---|---|---|---|
One-sample t-test |
|
|
|
Two-sample t-test |
|
|
|
Paired t-test |
|
|
- |
Z-test |
|
|
|
Chi-square test |
|
|
- |
ANOVA |
|
|
|
Example:
import real_simple_stats as rss
# One-sample t-test
data = [23, 25, 28, 30, 32]
t_stat, p_value = rss.one_sample_t_test(data, mu0=30)
print(f"t = {t_stat:.3f}, p = {p_value:.3f}")
# Two-sample t-test
group1 = [1, 2, 3, 4, 5]
group2 = [3, 4, 5, 6, 7]
t_stat, p_value = rss.two_sample_t_test(group1, group2)
📉 Regression & Correlation
Task |
Real Simple Stats |
SciPy |
scikit-learn |
statsmodels |
|---|---|---|---|---|
Pearson correlation |
|
|
- |
|
Simple linear regression |
|
|
|
|
R-squared |
|
|
|
|
Multiple regression |
|
- |
|
|
Prediction |
|
|
|
|
Example:
import real_simple_stats as rss
x = [1, 2, 3, 4, 5]
y = [2, 4, 5, 4, 5]
# Correlation
r = rss.pearson_correlation(x, y)
print(f"Correlation: {r:.3f}")
# Regression
slope, intercept, r_value, p_value, std_err = rss.linear_regression(x, y)
print(f"y = {slope:.2f}x + {intercept:.2f}")
# Prediction
y_pred = rss.regression_equation(6, slope, intercept)
🔄 Time Series Analysis
Task |
Real Simple Stats |
pandas |
statsmodels |
|---|---|---|---|
Moving average |
|
|
- |
Exponential MA |
|
|
- |
Autocorrelation |
|
|
|
Partial ACF |
|
- |
|
Linear trend |
|
- |
|
Detrend |
|
- |
|
Seasonal decompose |
|
- |
|
Differencing |
|
|
- |
Example:
import real_simple_stats as rss
data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# Moving average
ma = rss.moving_average(data, window_size=3, method='simple')
# Autocorrelation
acf = rss.autocorrelation(data, max_lag=5)
# Trend analysis
slope, intercept, r2 = rss.linear_trend(data)
Resampling Methods
Method |
Real Simple Stats |
scikit-learn |
scipy |
|---|---|---|---|
Bootstrap |
|
- |
- |
Bootstrap CI |
Returns |
- |
- |
Permutation test |
|
|
- |
Jackknife |
|
- |
- |
Cross-validation |
|
|
- |
Stratified split |
|
|
- |
Example:
import real_simple_stats as rss
import numpy as np
data = [1, 2, 3, 4, 5]
# Bootstrap confidence interval
result = rss.bootstrap(data, np.mean, n_iterations=1000)
print(f"95% CI: {result['confidence_interval']}")
# Permutation test
group1 = [1, 2, 3, 4, 5]
group2 = [3, 4, 5, 6, 7]
result = rss.permutation_test(group1, group2,
lambda d1, d2: np.mean(d1) - np.mean(d2))
print(f"p-value: {result['p_value']:.3f}")
Effect Sizes
Effect Size |
Real Simple Stats |
Other Libraries |
|---|---|---|
Cohen’s d |
|
|
Hedges’ g |
|
|
Glass’s Δ |
|
- |
Eta-squared |
|
|
Partial η² |
|
- |
Omega-squared |
|
- |
Cramér’s V |
|
|
Phi coefficient |
|
- |
Odds ratio |
|
|
Relative risk |
|
- |
Cohen’s h |
|
- |
Interpretation |
|
- |
Example:
import real_simple_stats as rss
group1 = [1, 2, 3, 4, 5]
group2 = [3, 4, 5, 6, 7]
# Cohen's d
d = rss.cohens_d(group1, group2)
interpretation = rss.interpret_effect_size(d, 'd')
print(f"Cohen's d = {d:.3f} ({interpretation})")
# Cramér's V for categorical data
table = [[10, 20], [30, 40]]
v = rss.cramers_v(table)
print(f"Cramér's V = {v:.3f}")
🔬 Power Analysis
Analysis |
Real Simple Stats |
statsmodels |
G*Power |
|---|---|---|---|
t-test power |
|
|
Manual |
Proportion test |
|
|
Manual |
ANOVA power |
|
|
Manual |
Correlation power |
|
- |
Manual |
Min detectable effect |
|
- |
Manual |
Sample size summary |
|
- |
- |
Example:
import real_simple_stats as rss
# Calculate required sample size for t-test
result = rss.power_t_test(delta=0.5, power=0.8, sig_level=0.05)
print(f"Required n per group: {result['n']}")
# Calculate power for given sample size
result = rss.power_t_test(delta=0.5, n=64, sig_level=0.05)
print(f"Statistical power: {result['power']:.3f}")
Bayesian Statistics
Method |
Real Simple Stats |
PyMC |
Stan |
|---|---|---|---|
Beta-Binomial update |
|
Manual |
Manual |
Normal-Normal update |
|
Manual |
Manual |
Gamma-Poisson update |
|
Manual |
Manual |
Credible interval |
|
|
Manual |
HDI |
|
|
Manual |
Bayes factor |
|
Manual |
Manual |
Posterior predictive |
|
|
Manual |
Example:
import real_simple_stats as rss
# Update Beta prior with binomial data
prior_alpha, prior_beta = 1, 1 # Uniform prior
successes, trials = 7, 10
post_alpha, post_beta = rss.beta_binomial_update(prior_alpha, prior_beta,
successes, trials)
# Calculate credible interval
lower, upper = rss.credible_interval('beta',
{'alpha': post_alpha, 'beta': post_beta},
0.95)
print(f"95% Credible Interval: [{lower:.3f}, {upper:.3f}]")
📐 Multivariate Analysis
Method |
Real Simple Stats |
scikit-learn |
statsmodels |
|---|---|---|---|
Multiple regression |
|
|
|
PCA |
|
|
- |
Factor analysis |
|
|
- |
Canonical correlation |
|
|
- |
Mahalanobis distance |
|
- |
- |
Example:
import real_simple_stats as rss
X = [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6]]
y = [2, 4, 5, 4, 5]
# Multiple regression
result = rss.multiple_regression(X, y)
print(f"R² = {result['r_squared']:.3f}")
print(f"Coefficients: {result['coefficients']}")
# PCA
result = rss.pca(X, n_components=2)
print(f"Explained variance: {result['explained_variance']}")
🔍 Quick Lookup by Use Case
“I want to…”
…compare two groups
two_sample_t_test(group1, group2)- Test for mean differencecohens_d(group1, group2)- Calculate effect sizepermutation_test(group1, group2, statistic)- Non-parametric test
…analyze relationships
pearson_correlation(x, y)- Linear correlationlinear_regression(x, y)- Fit regression linecoefficient_of_determination(x, y)- R² value
…work with time series
moving_average(data, window)- Smooth dataautocorrelation(data, max_lag)- Find patternsseasonal_decompose(data, period)- Decompose components
…calculate confidence
confidence_interval_known_std(mean, std, n, conf)- Known σconfidence_interval_unknown_std(mean, std, n, conf)- Unknown σbootstrap(data, statistic, n_iterations)- Bootstrap CI
…plan a study
power_t_test(delta, power, sig_level)- Sample size for t-testrequired_sample_size(confidence, width, std)- CI-based planningslovins_formula(N, e)- Survey sample size
…do Bayesian analysis
beta_binomial_update(α, β, k, n)- Update beliefscredible_interval(dist, params, cred)- Bayesian CIbayes_factor(L_H1, L_H0)- Compare hypotheses
📚 Function Categories
By Statistical Domain
Descriptive Statistics: mean, median, mode, sample_std_dev, sample_variance, five_number_summary, interquartile_range, coefficient_of_variation
Probability: normal_pdf, normal_cdf, binomial_probability, poisson_pmf, geometric_pmf, exponential_pdf
Inference: one_sample_t_test, two_sample_t_test, paired_t_test, one_sample_z_test, chi_square_statistic, one_way_anova
Regression: linear_regression, multiple_regression, pearson_correlation, coefficient_of_determination
Time Series: moving_average, autocorrelation, seasonal_decompose, detrend, difference
Resampling: bootstrap, permutation_test, jackknife, cross_validate
Effect Sizes: cohens_d, eta_squared, cramers_v, odds_ratio
Power Analysis: power_t_test, power_anova, minimum_detectable_effect
Bayesian: beta_binomial_update, credible_interval, bayes_factor
Multivariate: pca, factor_analysis, canonical_correlation
Learning Path
Beginner → Intermediate → Advanced
Start here:
mean,median,std_dev,normal_cdfThen learn:
t_test,linear_regression,confidence_intervalNext:
bootstrap,effect_sizes,power_analysisAdvanced:
time_series,bayesian_stats,multivariate
Tips
All functions return simple Python types (floats, lists, dicts) - no custom objects
Type hints included for better IDE support
Comprehensive docstrings with examples in every function
Consistent naming - functions do what their names say
Educational focus - designed for learning and teaching
See also:
Mathematical Formulas - LaTeX notation for all functions
FAQ - Common questions
Migration Guide - Switching from other libraries