∑

Statis-Gravity

Clinical Biostatistics & Exploratory Visualization Platform

Conceived, supervised design and testing: Dr G Narenthiran MB ChB BSc(MedSci)(Hons) MRCS(Ed.) FEBNS FRCS(SN)

Power & Sample Size Determination

A-priori sample size planning & post-hoc power calculation

Effect Size (Cohen's d)
--
Standardized contrast
Sample Size per Group (n)
--
Equal 1:1 allocation
Total Sample Size (N)
--
Total study enrollment
Statistical Power (1 - β)
--
1 - Type II error rate
Study Protocol Justification (Grant / Ethics / IRB Ready)

--

🎲 Clinical & Research Randomisation Suite

Zero-modulo-bias cryptographically secure generation & balanced permuted block allocation with allocation concealment

⚙️ Simple Randomization Parameters

Uniform Odd/Even Mapping
🛡️ Bias & Modulo Prevention: Uses window.crypto.getRandomValues() with rejection sampling (rejection threshold 4,294,967,200) to ensure true cryptographic uniformity across 1–100, eliminating modulo bias.

🎯 Prominent Assignment & Live Balance

No allocation yet
🎲
Ready to Randomize

Click the generate button to assign the next subject via cryptographically secure odd/even number draw.

Total (N)
0
Group A
0 (0%)
Group B
0 (0%)
Ratio (A:B)
1:1
Group A Balance (50%) Group B Balance (50%)
Methodological Warning: In smaller samples (N < 100), simple randomization naturally experiences random drift leading to noticeable sample size imbalances. If strict balance is essential throughout enrolment, switch to Calculator 2: Block Randomization.

📋 Session Audit Trail & Allocation Log

Permanent verifiable chronological sequence of participant assignments for current session

0 Records
# ID Timestamp Method Random Draw / Slot Group Code Assigned Label
🎲
No participants randomized yet
Click "Generate / Assign Next Participant" above to initiate sequence allocation.

Dataset Input

Paste numeric values or load clinical sample

Sample Size (n)
--
Range: --
Mean (M)
--
SD: ±--
Median (50%)
--
50th Percentile
Mode
--
--
Interquartile Range (IQR)
--
Q1: -- | Q3: --
Std Dev (SD)
--
Var: --
95% CI for Mean
[--, --]
SEM: --
Skewness (G₁)
--
--
Kurtosis (Excess G₂)
--
--
Outliers (Tukey's)
--
--
Normality Test (Jarque-Bera)
--
JB Stat: -- | p = --
Frequency Distribution & Normal Curve Fit Binned Histogram & Parametric Gaussian Fit
Box & Whiskers Plot Median, IQR Box, Tukey Fences & Outliers
Violin Density Plot Kernel Density Estimation (KDE) & Quartiles
Descriptive Statistical Summary (ICMJE & APA Ready)

--

Two-Group Comparison

Automated assumption-driven test selection & execution

Active Design: Independent Cohorts (Two Separate Groups) (Uncheck for separate groups; check for repeated measures on same subjects)
Test Statistic
--
p-Value
--
--
Effect Size (Cohen's d)
--
Mean Difference
--
Comparative Cohort Distribution Error Bars: 95% Confidence Interval (Mean ± 95% CI)

🔬 Statistical Assumptions & Automated Decision Engine

Comprehensive diagnostic validation: Pairing, Normality (Jarque-Bera), & Homoscedasticity (F-Test)

--
Automated Test Recommendation & Decision Rationale: Run hypothesis test to evaluate assumptions and obtain data-driven recommendation.
1. Normality Distribution --
--
2. Equality of Variances --
--
Decision Pipeline: -- ➔ -- ➔ -- ➔ --
Clinical / Publication Summary (APA Style)

--

Multi-Cohort & Repeated Measures Analysis

Automated assumption-driven test selection & execution

Active Design: Independent Cohorts (Between-Subjects) (Uncheck for separate groups; check for repeated measures on same subjects)
Cohort 1:
n = 10
Cohort 2:
n = 10
Cohort 3:
n = 10
Test Statistic (F / H)
--
p-Value
--
--
Effect Size (η² / ω² / ε²)
--
Design & Degrees of Freedom
--
Multi-Cohort Variance & Dispersion Error Bars: 95% Confidence Interval (Mean ± 95% CI)

🔬 Statistical Assumptions & Automated Decision Engine

Comprehensive diagnostic validation: Pairing, Normality (Jarque-Bera across all cohorts), & Homoscedasticity (Levene's Test)

--
Automated Test Recommendation & Decision Rationale: Run multi-group analysis to evaluate assumptions and obtain data-driven recommendation.
1. Normality Distribution (All Cohorts) --
--
2. Equality of Variances (Levene's Test) --
--
Decision Pipeline: Design: Independent ➔ Normality: Testing... ➔ Variances: Testing... ➔ Recommended: --

🔬 Post-Hoc Pairwise Contrasts

Pinpoints which specific cohorts contribute to the statistically significant difference

Pairwise Contrast Difference (ΔM / Med) Std. Error Contrast Stat Adjusted p-Value 95% CI of Difference Effect Size Significance
Run multi-group analysis to view post-hoc pairwise contrasts
Multi-Cohort & Post-Hoc Clinical Summary

--

🎯 Observational Cohort & PSM Settings

Control for baseline confounding in non-randomized clinical studies

N = 120 patients
Selected: 4
⚙️ Matching Algorithm & Caliper Specifications
Austin 2011 standard: 0.20
Discard off-support tails
Matched Cohorts
--
--
Causal Effect (ATT)
--
--
95% Confidence Interval
--
--
Max Post-Match |SMD|
--
--

🔬 Balance & Overlap Diagnostics

Love Plot (SMD reduction) & Propensity Score Overlap Distribution

📊 Baseline Covariate Balance Diagnostics

Comparison of Unadjusted vs. Matched Standardized Mean Differences (|SMD| < 0.10 threshold)

Baseline Covariate Unadjusted Means (T vs C) Pre-Match SMD Matched Means (T vs C) Post-Match SMD Variance Ratio % Bias Reduction Balance Status
Run Propensity Score Matching to view covariate balance diagnostics

⚖️ Causal Treatment Effect (ATT) vs. Unadjusted Estimate

Quantifies confounding bias removed by Propensity Score Matching

Analytical Estimate Point Estimate Std. Error Test Statistic p-Value 95% Confidence Interval Clinical Interpretation
Run analysis to view causal treatment effect comparison

💻 Reproducible Statistical Code Scripts

Expert production-grade scripts with full methodology and inline biostatistical comments

# Select a language tab above to generate full reproducible code...
Causal Inference & STROBE Observational Summary

--

🌐 Multivariate EDA Controls

Dimensionality reduction for Continuous, Categorical, & Mixed Data

Balances continuous and categorical blocks via standardized indicator scaling (Pagès 2004).
N = 120 observations
📐 Projection Axes & Grouping
Technique & Cohort
FAMD
N = 120
Dim 1 Variance (λ₁)
--
--
Dim 2 Variance (λ₂)
--
--
Displayed Plane Inertia
--
--

🔬 Interactive Factor Space

Projection of observations, variable correlation vectors, and modality centroids

📊 Eigenvalues & Inertia Decomposition

Kaiser-Guttman criterion (λ > 1.0) and cumulative explained variance

Dimension Eigenvalue (λ) Variance Explained (%) Cumulative Variance (%) Kaiser Criterion
Run analysis to view eigenvalue decomposition

💡 Automated Natural-Language Findings & Drivers

Real-time interpretation of subspace variance, influential drivers, and outlier observations

Execute factor decomposition to generate automated clinical and statistical interpretation.

💻 Reproducible Statistical Code Scripts

Production-grade scripts utilizing scikit-learn/prince (Python) and FactoMineR/factoextra (R)

# Select a language tab above to generate full reproducible code...
Multivariate Dimensionality Reduction Academic Summary

--

2x2 Contingency & Diagnostic Matrix

Choose between Diagnostic Accuracy vs Clinical Study

Test \ Ref
Gold Standard (+)
Gold Standard (-)
New Test (+)
True Positive (TP)
False Positive (FP)
New Test (-)
False Negative (FN)
True Negative (TN)

Evaluates index test accuracy against the reference standard: Sensitivity, Specificity, PPV, NPV, Overall Accuracy (Wilson Score 95% CIs), and Likelihood Ratios.

Sensitivity (TPR)
--
95% CI: [--]
Specificity (TNR)
--
95% CI: [--]
Positive Predictive Value (PPV)
--
95% CI: [--]
Negative Predictive Value (NPV)
--
95% CI: [--]
Overall Diagnostic Accuracy
--
95% CI: [--]
Likelihood Ratios (LR+ / LR-)
--
Youden's J: --
Clinical Diagnostic / Epidemiological Summary

--

Bivariate Relationship

Pearson, Spearman & OLS Regression

Pearson r
--
R-Squared (R²)
--
Spearman Rank (ρ)
--
p-Value
--
Fitted Regression Equation
y = mx + c
Scatter Plot & Regression Fit

🛡️ Assumption Diagnostics & Test Decision Engine

Automated statistical verification of normality, outliers, homoscedasticity & linear vs U-shaped non-linear curvature

Recommended Method --
--

--

1. Normality of X
--
2. Normality of Y
--
3. Outlier / Leverage
--
4. Homoscedasticity
--
5. Curve Morphology
--
Correlation & Regression Clinical Statement

--

Biomarker & Diagnostic Test

Continuous score and true disease status (0 or 1)

ROC Area Under Curve (AUC)
--
Optimal Cutoff (Youden J)
--
Sensitivity
--
Specificity
--
Positive LR (+LR)
--
Negative LR (-LR)
--
Empirical ROC Curve & Optimal Youden J
Diagnostic Accuracy Statement

--

Computer-Generated Distributions & Probability Densities

Explore theoretical probability density functions (PDF) vs empirical simulated samples

500
Sample Mean
--
Theo: --
Sample SD
--
Theo: --
Skewness (G₁)
--
--
Kurtosis (G₂)
--
--
Normality Test
--
JB p = --
Empirical Histogram with Theoretical PDF Overlay
Clinical & Mathematical Context

--

Central Limit Theorem (CLT) Interactive Simulation

Observe how the distribution of sample averages (x̄) converges to a Gaussian bell curve regardless of parent population shape

The Core Principle of the Central Limit Theorem: Even if the raw patient population is strongly non-normal (e.g. uniform, exponential survival curves, or bimodal responder groups), the distribution of sample means x̄ drawn from that population will naturally conform to a normal distribution N(μ, σ²/n) as the sample size n increases (typically n ≥ 30).
30
n=2 (Skewed) n=30 (Parametric Zone) n=100 (Tight)
Simulated Means (k)
0
Each of size n = 30
True Pop Mean (μ)
5.00
Pop SD: 2.89
Observed Mean (x̄̄)
--
|Diff|: --
Theoretical SE
0.527
Formula: σ / √n
Observed SE (s_x̄)
--
Convergence: --
Normality (x̄)
--
JB Test: --
1. Parent Population Distribution
2. Sampling Distribution of Mean (x̄)

Student's t-Distribution Convergence to Standard Normal N(0, 1)

Demonstrating how heavier Student's t tails merge into the Standard Gaussian curve as sample size n increases

William Sealy Gosset's 1908 Discovery ("Student"): When estimating the population mean μ using the sample standard deviation s instead of true σ, small samples introduce extra stochastic uncertainty. This creates heavy/fat tails in the t-distribution. As sample size n grows (and degrees of freedom ν = n - 1 → ∞), Slutsky's theorem guarantees that s → σ and the t-distribution becomes mathematically indistinguishable from N(0, 1).
n = 4 (ν = 3)
n=2 (Extreme Tails) n=10 (Phase I) n=31 (Classic Threshold ν=30) n=61 n=150 (Identical)
Presets:
Degrees of Freedom (ν)
3
Sample size n = 4
Two-Tailed t_crit (α=0.05)
3.182
vs z = 1.960 (+62.3%)
Peak Density f(0)
0.3676
Normal: 0.3989 (-7.8%)
Tail Risk P(|T|>1.96)
14.5%
Normal: 5.0% (Type I Risk)
Max Discrepancy
0.0313
sup |f_t(x) - φ(x)|
Excess Kurtosis
∞
Fat-tailed (ν ≤ 4)
Student's t(ν=3) Density Curve vs Standard Normal N(0, 1)
Why This Matters in Clinical Research:

When conducting clinical trials with small cohorts (e.g. pilot neurosurgical studies with n < 30), using the Gaussian critical value z = 1.960 instead of Gosset's t-critical cutoff leads to serious Type I error inflation (false positives). For n = 4, testing at z = 1.96 yields an actual false-positive rate of 14.5% rather than the intended 5.0%. Once sample size reaches n ≥ 31 (ν ≥ 30), t_crit drops to 2.042 (only 4.2% wider than 1.960), making the normal approximation clinically acceptable.

Two-Sample Overlap, Dispersion (SD vs. SEM) & Alpha Significance Boundary

Explore how sample curves overlap and separate as SD, SEM (via n), and difference (Δ) change, why α = 0.05 defines significance, and what happens when α is adjusted

The Fundamental Distinction Between SD, SEM, and Alpha (α): Standard Deviation (SD) measures real biological variability between individual patients—it does not shrink as sample size grows. Standard Error (SEM = SD/√n) measures our uncertainty in the mean—it shrinks steadily as n increases. Two patient populations can overlap by 70% (large SD), yet their treatment means can separate completely (small SEM). Significance level α sets our tolerance for false-positive claims (Type I error). At α = 0.05, the required separation boundary is 1.96 standard errors. Tightening α to 0.01 pushes this boundary out to 2.58 SEs; relaxing α to 0.10 pulls it inward to 1.65 SEs.
2.00
Δ=0 (Null) Δ=1.5 (Moderate) Δ=3.5 (Large) Δ=6.0
α = 0.050 (z = 1.960)
α=0.001 (0.1%) α=0.01 α=0.05 (Standard) α=0.10 α=0.20
🔵 Group 1 (Control / Baseline) SD₁ = 2.50 | SEM₁ = 0.625
2.50
0.625
n₁ = 16
Formula: SEM₁ = SD₁ / √n₁
🟣 Group 2 (Treatment / Test) SD₂ = 2.50 | SEM₂ = 0.625
2.50
0.625
n₂ = 16
Formula: SEM₂ = SD₂ / √n₂
Alpha Presets:
View Mode:
Significance Decision
SIGNIFICANT
p = 0.031 < α = 0.050
Observed vs Δcrit
Δ = 2.00
Δcrit = 1.80 (Boundary)
Group 1 Spread (SD₁ | SEM₁)
2.50 | 0.625
n₁ = 16 subjects
Group 2 Spread (SD₂ | SEM₂)
2.50 | 0.625
n₂ = 16 subjects
Distribution Overlap
11.0%
Patient Overlap: 68.9%
Precision & Cutoff
t = 2.042
SE_diff: 0.884 | df: 30.0
Sampling Distributions of Means (SEM): Overlap & Alpha Boundary
Mathematical & Clinical Explanation:

Loading overlap simulation explanation...

⚡ Simulation 5: Statistical Power (1 − β), Type II Error (β), SD & SEM Interactive Visualizer

Interactively explore the mechanical relationship between biological noise (SD), sample precision (SEM = SD/√n), Type II error (β), and Statistical Power (1 − β). See why clinical trials become underpowered and how sample size governs statistical discovery.

Power Presets: Effect Presets:
View Mode:
🧬 Biological Noise & Sample Precision SD = 4.00 | SEM = 0.500
4.00
Biological heterogeneity / measurement noise. Higher SD requires more subjects.
0.500
Estimation precision (SEM = SD / √n). Shrinking SEM separates curves and skyrockets Power.
n = 64 (N = 128)
Formula: n = (SD / SEM)² | Total trial size N = 2n subjects
🎯 Power, Type II Error & Target Effect Power = 80.2% | β = 19.8%
80.2%
Probability of detecting a true effect (True Positive Rate). Regulatory standard: ≥ 80%.
19.8%
Risk of missing a true difference (False Negative Rate: β = 1 − Power).
2.00
Cohen's d = 0.50
0.050
z_crit = 1.960
Statistical Power (1 − β)
80.2%
Target: ≥ 80% (Adequate)
Type II Error (β)
19.8%
False Negative Risk
Required Sample Size
n = 64
Total N = 128 subjects
Effect Size (Δ & d)
Δ = 2.00
Cohen's d = 0.50 (Medium)
Sample Precision
SEM = 0.500
SE_diff: 0.707 (σ·√(2/n))
Significance Cutoff
xcrit = 1.386
α = 0.050 (Type I: 5.0%)
Dual Distribution: Null Hypothesis H₀ vs True Effect H₁ (Power & Beta Shading)
Mathematical & Clinical Explanation:

Loading power calculation explanation...

Teaching Report: Distributions, CLT, Student's t & Alpha Significance Simulation

Select a distribution above or run the Central Limit Theorem and Student's t simulations to generate educational outcomes.

🧠 Bayesian Statistics & Logic — The Geometry of Changing Beliefs

Inspired by 3Blue1Brown (Grant Sanderson) — Visualizing Bayes' Theorem via 1×1 unit square area, natural counts, and odds updating

Classic Puzzles & Presets:
🌱 Prior Belief & Population Base Rates Prior: 4.8% (1:20.0)
4.8%
Initial degree of belief before observing evidence (Steve: 1 librarian per 20 farmers = 4.76%).
N = 210 people
Representative count (e.g. 10 librarians + 200 farmers = 210). Framing as counts drops error rate to 0%.
🔍 Evidence Likelihoods & False Alarms P(E|H): 40% | P(E|¬H): 10%
40.0%
Probability of evidence if H is true (e.g. 40% of librarians fit meek/tidy description).
10.0%
Probability of evidence if H is false (e.g. 10% of farmers fit meek/tidy description).
Prior Probability P(H)
4.8%
Prior Odds: 1 : 20.0
Likelihood P(E|H)
40.0%
True Positive Probability
False Alarm P(E|¬H)
10.0%
False Positive Probability
Total Evidence P(E)
11.43%
Marginal / Shaded Area
Bayes Factor (LR)
4.00×
Substantial Evidence
POSTERIOR P(H|E)
16.7%
Belief Shift: +11.9%
3Blue1Brown 1×1 Unit Square: Visualizing Bayes' Theorem as Proportions of Area
3Blue1Brown Geometric Insight & Clinical Logic:

Loading Bayesian statistics explanation...

Teaching Report: Bayesian Statistics, Logic & 3Blue1Brown Geometric Belief Updating

Loading Bayesian statistics clinical and educational narrative...