library(pwr)
pwr.t.test(d = {effectd}, sig.level = {alpha}, power = {power},
type = "two.sample")User guide
When to use. Determine the minimum sample size before starting a study, given your target power and expected effect size.
Assumptions. You have a planned alpha (usually 0.05), target power (usually 0.80), and an estimate of the effect size from pilot data or literature.
Common mistakes. Do not compute power after data collection to justify a non-significant result (post-hoc power is uninformative).
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Cohen J. Statistical Power Analysis for the Behavioral Sciences. 2nd ed. 1988.
Expected: 2 columns: Group 1 values | Group 2 values
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 2 columns: Group 1 values | Group 2 values
g1 <- c({g1})
g2 <- c({g2})
t.test(g1, g2, var.equal = {eqvar})User guide
When to use. Compare the means of two independent groups on a continuous outcome.
Assumptions. Independence of observations; approximately normal distributions in each group; equal variances (or use the Welch correction).
Common mistakes. Do not use for paired/matched data: use the paired t-test instead. Check normality first for small samples.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Student. The probable error of a mean. Biometrika. 1908;6(1):1-25.
- Welch BL. The generalization of Student's problem. Biometrika. 1947;34:28-35.
Expected: 2 columns: Before / Condition A | After / Condition B
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 2 columns: Before / Condition A | After / Condition B
pre <- c({pre})
post <- c({post})
t.test(pre, post, paired = TRUE)User guide
When to use. Compare two measurements taken on the same subjects (before/after, matched pairs).
Assumptions. The differences between pairs are approximately normally distributed.
Common mistakes. Only valid when pairs are genuinely matched; do not use for two independent samples.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Student. The probable error of a mean. Biometrika. 1908;6(1):1-25.
{p_r}
# z: 2 * pnorm(-abs(z)) t: 2 * pt(-abs(t), df)
# chi-square: pchisq(x, df, lower.tail = FALSE) F: pf(x, df1, df2, lower.tail = FALSE)User guide
When to use. Convert a test statistic (z, t, χ² or F) into a p-value under the null hypothesis.
Assumptions. You already have a correctly computed statistic and the right degrees of freedom.
Common mistakes. A p-value is not the probability the null is true, nor the size of an effect.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Wasserstein RL, Lazar NA. The ASA statement on p-values. Am Stat. 2016;70:129-133.
Expected format: Observed counts (rows on new lines, comma-separated)
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected format: Observed counts (rows on new lines, comma-separated)
tbl <- matrix(c({obs_flat}), nrow = {nrows}, byrow = TRUE)
chisq.test(tbl)User guide
When to use. Test whether two categorical variables are associated, using a contingency table of counts.
Assumptions. Expected count in each cell should be at least 5. Observations independent.
Common mistakes. If expected counts are below 5 (small samples), use Fisher’s exact test instead.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Pearson K. On the criterion that a given system of deviations… Philos Mag. 1900;50:157-175.
Expected format: Sample values
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected format: Sample values
x <- c({data})
t.test(x, conf.level = {conf})$conf.intUser guide
When to use. Estimate the plausible range for a population mean from a sample.
Assumptions. Sample is random; for small n the underlying distribution is approximately normal.
Common mistakes. A 95% CI does not mean a 95% probability the true value lies in this one interval.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Neyman J. Outline of a theory of statistical estimation. Philos Trans R Soc A. 1937;236:333-380.
Expected: 2 columns: Group 1 values | Group 2 values
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 2 columns: Group 1 values | Group 2 values
g1 <- c({g1})
g2 <- c({g2})
library(effsize)
cohen.d(g1, g2)
cohen.d(g1, g2, hedges.correction = TRUE) # Hedges' gUser guide
When to use. Quantify the standardised magnitude of difference between two groups.
Assumptions. Continuous data; pooled SD is meaningful (similar variances).
Common mistakes. Effect size measures magnitude, not statistical significance or clinical importance.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Cohen J. Statistical Power Analysis for the Behavioral Sciences. 1988.
Expected: one row per record, Label: v1, v2 …
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: one row per record, Label: v1, v2 …
df <- stack(list({anova_groups}))
summary(aov(values ~ ind, data = df))User guide
When to use. Compare means across three or more independent groups simultaneously.
Assumptions. Independence; normality within groups; homogeneity of variance.
Common mistakes. Do not run multiple pairwise t-tests instead: it inflates the Type I error rate.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Fisher RA. Statistical Methods for Research Workers. 1925.
Expected: 2 columns: Variable X | Variable Y
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 2 columns: Variable X | Variable Y
x <- c({x})
y <- c({y})
cor.test(x, y, method = "{method}"{spearman_exact})User guide
When to use. Measure the strength and direction of a linear (Pearson) or monotonic (Spearman) relationship between two variables.
Assumptions. Pearson: linearity, normality, no major outliers. Spearman: monotonic relationship only.
Common mistakes. Correlation does not imply causation. Inspect the scatter plot for non-linearity.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Pearson K. Note on regression and inheritance. Proc R Soc Lond. 1895;58:240-242.
- Spearman C. The proof and measurement of association. Am J Psychol. 1904;15:72-101.
tp <- {tp}; fp <- {fp}; fn <- {fn}; tn <- {tn}
sens <- tp/(tp+fn); spec <- tn/(tn+fp)
c(sensitivity = sens, specificity = spec)User guide
When to use. Evaluate diagnostic test performance from a 2×2 of test result vs true disease status.
Assumptions. A valid reference (gold) standard classifies true disease status.
Common mistakes. PPV and NPV depend heavily on disease prevalence: report it.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Altman DG, Bland JM. Diagnostic tests 1: sensitivity and specificity. BMJ. 1994;308:1552.
Expected format: Score, Label: one per line (1=positive, 0=negative)
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected format: Score, Label: one per line (1=positive, 0=negative)
library(pROC)
scores <- c({roc_scores})
labels <- c({roc_labels})
roc(labels, scores, direction = "{roc_dir}") # {roc_dir_note}User guide
When to use. Evaluate the discriminatory ability of a continuous test or score.
Assumptions. Binary true outcome (0/1); continuous predictor or score.
Common mistakes. AUC near 0.5 means no discrimination; do not over-interpret a single threshold.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Hanley JA, McNeil BJ. The meaning and use of the area under an ROC curve. Radiology. 1982;143:29-36.
tbl <- matrix(c({a},{b},{c},{d}), nrow = 2, byrow = TRUE)
fisher.test(tbl) # or epitools::oddsratio(tbl)User guide
When to use. Quantify association in a 2×2 table; OR for case-control, RR for cohort designs.
Assumptions. Counts are independent; cells are non-zero (else apply continuity correction).
Common mistakes. Do not interpret OR as RR when the outcome is common (>10%).
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Woolf B. On estimating the relation between blood group and disease. Ann Hum Genet. 1955;19:251-253.
cer <- {cer}; eer <- {eer}
arr <- cer - eer # > 0 benefit, < 0 harm
if (arr > 0) c(ARR = arr, NNT_benefit = ceiling(round(1/arr, 6))) else c(ARR = arr, NNH_harm = ceiling(round(1/(eer - cer), 6)))User guide
When to use. Express treatment benefit as the number of patients needed to treat to prevent one event.
Assumptions. Event rates are from comparable groups over a defined time horizon.
Common mistakes. Always report the time horizon; NNT is meaningless without it.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Laupacis A, Sackett DL, Roberts RS. An assessment of clinically useful measures. N Engl J Med. 1988;318:1728-1733.
Expected: one row per record, TP, FP, FN, TN
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: one row per record, TP, FP, FN, TN
library(mada)
dat <- read.csv(text = "TP,FP,FN,TN
{dm_csv}")
madad(dat); reitsma(dat)User guide
When to use. Pool diagnostic accuracy (sensitivity and specificity) across studies with a random-effects model.
Assumptions. Each study reports a 2×2 of test result vs reference standard.
Common mistakes. Pooling sensitivity and specificity separately ignores their correlation; a bivariate/HSROC model is preferred when feasible.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Reitsma JB, et al. Bivariate analysis of sensitivity and specificity. J Clin Epidemiol. 2005;58:982-990.
Expected format: Subjects: one per line, counts of raters per category
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected format: Subjects: one per line, counts of raters per category
library(irr) # rows = subjects, columns = categories (rater counts) kappam.fleiss(ratings)
User guide
When to use. Measure agreement among three or more raters classifying subjects into categories (Fleiss’ kappa).
Assumptions. Each subject is rated by the same number of raters; categories are mutually exclusive.
Common mistakes. Kappa is prevalence-sensitive; report category frequencies alongside it.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Fleiss JL. Measuring nominal scale agreement among many raters. Psychol Bull. 1971;76:378-382.
Expected: 2 columns: Method 1 measurements | Method 2 measurements
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 2 columns: Method 1 measurements | Method 2 measurements
m1 <- c({m1})
m2 <- c({m2})
d <- m1 - m2
c(bias = mean(d), lower = mean(d)-1.96*sd(d), upper = mean(d)+1.96*sd(d))
cor.test(m1, m2)
coef(lm(m2 ~ m1)) # ordinary least-squares lineUser guide
When to use. Compare two measurement methods using bias, 95% limits of agreement, correlation and ordinary least-squares line.
Assumptions. Paired measurements of the same quantity by both methods.
Common mistakes. Do not judge agreement by correlation alone: report the limits of agreement.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Bland JM, Altman DG. Statistical methods for assessing agreement between two methods. Lancet. 1986;1:307-310.
Expected: 2 columns: X values | Y values
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 2 columns: X values | Y values
x <- c({x})
y <- c({y})
summary(lm(y ~ x))User guide
When to use. Model and predict a continuous outcome from a single continuous predictor.
Assumptions. Linearity, independence, constant variance (homoscedasticity), normal residuals.
Common mistakes. Do not extrapolate predictions beyond the observed range of x.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Galton F. Regression towards mediocrity in hereditary stature. J Anthropol Inst. 1886;15:246-263.
Expected: one row per record, y, x1, x2, …
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: one row per record, y, x1, x2, …
df <- read.csv(text = "y,x1,x2
{mlr_csv}")
summary(lm(y ~ ., data = df))User guide
When to use. Model a continuous outcome from several predictors simultaneously; read each coefficient as the adjusted effect.
Assumptions. Linearity, independent errors, constant variance, normal residuals, no severe multicollinearity.
Common mistakes. Avoid fitting more predictors than the sample can support; check variance inflation factors.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Draper NR, Smith H. Applied Regression Analysis. 3rd ed. 1998.
Expected: one row per record, y(0/1), x1, x2, …
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: one row per record, y(0/1), x1, x2, …
df <- read.csv(text = "y,x1
{logit_csv}")
m <- glm(y ~ ., data = df, family = binomial)
summary(m); exp(cbind(OR = coef(m), confint(m)))User guide
When to use. Model a binary outcome and obtain adjusted odds ratios for each predictor.
Assumptions. Outcome is binary; log-odds are linear in the predictors; observations independent.
Common mistakes. Rule of thumb: at least ~10 events per predictor to avoid unstable estimates.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Hosmer DW, Lemeshow S, Sturdivant RX. Applied Logistic Regression. 3rd ed. 2013.
Expected: one row per record, count, x1, x2, …
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: one row per record, count, x1, x2, …
df <- read.csv(text = "count,x1
{pois_csv}")
m <- glm(count ~ ., data = df, family = poisson)
summary(m); exp(coef(m))User guide
When to use. Model count outcomes and obtain rate ratios for each predictor.
Assumptions. Counts follow a Poisson distribution; mean equals variance (check for overdispersion).
Common mistakes. If variance far exceeds the mean, use negative binomial or a quasi-Poisson model.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Cameron AC, Trivedi PK. Regression Analysis of Count Data. 2nd ed. 2013.
Expected: 2 columns: Group 1 values | Group 2 values
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 2 columns: Group 1 values | Group 2 values
g1 <- c({g1})
g2 <- c({g2})
wilcox.test(g1, g2)User guide
When to use. Non-parametric comparison of two independent groups when normality is doubtful.
Assumptions. Independent observations; ordinal or continuous data.
Common mistakes. It compares rank distributions, not means: describe results as a shift in distribution.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Mann HB, Whitney DR. On a test of whether one of two random variables is stochastically larger. Ann Math Stat. 1947;18:50-60.
Expected: 2 columns: Before values | After values
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 2 columns: Before values | After values
pre <- c({pre})
post <- c({post})
wilcox.test(pre, post, paired = TRUE)User guide
When to use. Non-parametric paired test for matched data when differences are not normal.
Assumptions. Differences are symmetric around the median; paired design.
Common mistakes. Zero differences are dropped; ties reduce power.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Wilcoxon F. Individual comparisons by ranking methods. Biometrics Bull. 1945;1:80-83.
Expected: one row per record, Label: v1, v2 …
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: one row per record, Label: v1, v2 …
df <- stack(list({anova_groups}))
kruskal.test(values ~ ind, data = df)User guide
When to use. Non-parametric comparison across three or more groups.
Assumptions. Independent groups; ordinal or continuous data; similarly shaped distributions.
Common mistakes. A significant H tells you groups differ, not which ones: follow with Dunn’s test.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Kruskal WH, Wallis WA. Use of ranks in one-criterion variance analysis. J Am Stat Assoc. 1952;47:583-621.
tbl <- matrix(c({a},{b},{c},{d}), nrow = 2, byrow = TRUE)
fisher.test(tbl)User guide
When to use. Exact test of association in a 2×2 table, ideal for small samples.
Assumptions. Fixed marginal totals; independent observations.
Common mistakes. For large samples the chi-square test is computationally simpler and equivalent.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Fisher RA. The logic of inductive inference. J R Stat Soc. 1935;98:39-82.
Expected: one row per record, time, event(1=event,0=censored)[, group]
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: one row per record, time, event(1=event,0=censored)[, group]
library(survival)
df <- read.csv(text = "time,event,group
{km_csv}")
fit <- survfit(Surv(time, event) ~ group, data = df)
summary(fit); survdiff(Surv(time, event) ~ group, data = df)User guide
When to use. Estimate survival probability over time from censored time-to-event data, and compare groups with the log-rank test.
Assumptions. Censoring is non-informative; survival times are measured from a common origin.
Common mistakes. Do not treat censored subjects as event-free at the end: the method already accounts for them.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Kaplan EL, Meier P. Nonparametric estimation from incomplete observations. J Am Stat Assoc. 1958;53:457-481.
Expected: one row per record, time, event(1/0), x1, x2, …
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: one row per record, time, event(1/0), x1, x2, …
library(survival)
df <- read.csv(text = "time,event,x1
{cox_csv}")
summary(coxph(Surv(time, event) ~ ., data = df))User guide
When to use. Estimate hazard ratios for covariates on time-to-event outcomes without specifying the baseline hazard.
Assumptions. Proportional hazards (covariate effects constant over time); non-informative censoring.
Common mistakes. Test the proportional-hazards assumption (e.g. Schoenfeld residuals) before trusting the HRs.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Cox DR. Regression models and life-tables. J R Stat Soc B. 1972;34:187-220.
Expected format: Studies: Label, Effect, LowerCI, UpperCI (one per line)
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected format: Studies: Label, Effect, LowerCI, UpperCI (one per line)
library(meta)
studlab <- c({meta_studlab})
TE <- c({meta_te})
lower <- c({meta_lower})
upper <- c({meta_upper})
seTE <- (upper - lower) / (2 * 1.96) # SE from the 95% CI, as the calculator does
m <- metagen(TE, seTE, studlab = studlab, sm = "SMD",
common = {meta_common}, random = {meta_random}, method.tau = "DL")
summary(m) # pooled effect, Cochran's Q, I2, tau2User guide
When to use. Pool effect sizes across studies and quantify heterogeneity (I-squared).
Assumptions. Studies are clinically and methodologically comparable enough to combine.
Common mistakes. High I-squared (>75%) signals substantial heterogeneity: interpret the pooled estimate cautiously.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- DerSimonian R, Laird N. Meta-analysis in clinical trials. Control Clin Trials. 1986;7:177-188.
Expected: one row per record, label, effect, standard error
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: one row per record, label, effect, standard error
library(meta)
studlab <- c({funnel_studlab})
TE <- c({funnel_te})
seTE <- c({funnel_se})
m <- metagen(TE, seTE, studlab = studlab, common = TRUE, random = FALSE)
summary(m) # fixed-effect pooled estimate and 95% CI, as the calculator reports
funnel(m)
metabias(m, method.bias = "linreg", k.min = 3) # Egger's regression test: intercept, t, pUser guide
When to use. Detect funnel-plot asymmetry (a marker of possible publication bias) via Egger’s regression test.
Assumptions. At least ~10 studies for a well-powered Egger test; effect sizes and standard errors per study.
Common mistakes. Asymmetry can also reflect genuine heterogeneity or small-study effects, not only bias.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Egger M, Davey Smith G, Schneider M, Minder C. Bias in meta-analysis detected by a simple, graphical test. BMJ. 1997;315:629-634.
library(PRISMA2020) # supply counts to PRISMA_flowdiagram()
User guide
When to use. Build the record counts for a PRISMA 2020 study-selection flow diagram and check the arithmetic balances.
Assumptions. Counts come from your screening log at each stage.
Common mistakes. Numbers must reconcile: screened minus excluded should equal full-text assessed.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Page MJ, et al. The PRISMA 2020 statement. BMJ. 2021;372:n71.
# GRADE is a structured judgement, not a computation. # Start: RCT = High (4), Observational = Low (2). # Downgrade (-1/-2) for risk of bias, inconsistency, # indirectness, imprecision, publication bias. # Upgrade (+1/+2) for large effect, dose-response.
User guide
When to use. Grade the certainty of a body of evidence (High / Moderate / Low / Very low) using the GRADE framework.
Assumptions. You have appraised each GRADE domain for the outcome of interest.
Common mistakes. Grade certainty per outcome, not per study; upgrades normally apply only to observational evidence.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Guyatt GH, et al. GRADE: an emerging consensus on rating quality of evidence. BMJ. 2008;336:924-926.
Expected format: Agreement matrix: rows on new lines, comma-separated
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected format: Agreement matrix: rows on new lines, comma-separated
library(irr)
tbl <- matrix(c({mat_flat}), nrow = {nrows}, byrow = TRUE)
r1 <- rep(row(tbl), tbl); r2 <- rep(col(tbl), tbl) # one pair of ratings per item
kappa2(cbind(r1, r2))User guide
When to use. Measure categorical inter-rater agreement beyond what is expected by chance.
Assumptions. Two raters; same categories; independent ratings.
Common mistakes. Kappa is sensitive to prevalence: high agreement can yield low kappa.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Cohen J. A coefficient of agreement for nominal scales. Educ Psychol Meas. 1960;20:37-46.
Expected format: Raters (one per line): RaterName: v1, v2 …
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected format: Raters (one per line): RaterName: v1, v2 …
library(irr)
ratings <- {icc_ratings} # rows = subjects, columns = raters
icc(ratings, model = "oneway", unit = "single")User guide
When to use. Quantify reliability of continuous measurements across multiple raters.
Assumptions. Continuous ratings; consistent rater set across subjects.
Common mistakes. Specify the ICC form (1,1 / 2,1 / 3,1): they are not interchangeable.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Shrout PE, Fleiss JL. Intraclass correlations. Psychol Bull. 1979;86:420-428.
Expected format: Respondents × items: one per line, items comma-separated
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected format: Respondents × items: one per line, items comma-separated
library(psych) # rows = respondents, columns = items alpha(data_matrix)
User guide
When to use. Assess the internal consistency (reliability) of a multi-item scale.
Assumptions. Items measure a single underlying construct; interval-level scoring.
Common mistakes. Alpha increases with more items: do not over-interpret high values on long scales.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Cronbach LJ. Coefficient alpha and the internal structure of tests. Psychometrika. 1951;16:297-334.
te <- {te}; bias <- {bias}; cv <- {cv}
sigma <- (te - abs(bias))/cv
sigmaUser guide
When to use. Compute the sigma metric for a laboratory assay and select appropriate QC rules.
Assumptions. TEa, bias and CV are in the same percentage units.
Common mistakes. Sigma below 3 requires intensive multi-rule QC; do not run with single rules.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Westgard JO. Basic QC Practices. 4th ed. 2016.
Expected: 2 columns: Method 1 values | Method 2 values
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 2 columns: Method 1 values | Method 2 values
m1 <- c({m1})
m2 <- c({m2})
d <- m1 - m2
c(bias = mean(d), lower = mean(d)-1.96*sd(d), upper = mean(d)+1.96*sd(d))User guide
When to use. Assess agreement between two measurement methods via mean bias and limits of agreement.
Assumptions. Differences are approximately normal and constant across the measurement range.
Common mistakes. Never use the correlation coefficient to assess method agreement.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Bland JM, Altman DG. Statistical methods for assessing agreement. Lancet. 1986;1:307-310.
Expected: 2 columns: Method 1 values | Method 2 values
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 2 columns: Method 1 values | Method 2 values
library(mcr)
m1 <- c({m1})
m2 <- c({m2})
mcreg(m1, m2, method.reg = "PaBa")User guide
When to use. Non-parametric method comparison robust to outliers and measurement error in both methods.
Assumptions. Continuous paired measurements; no assumption on error distribution.
Common mistakes. Needs a reasonable measurement range to estimate the slope reliably.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Passing H, Bablok W. A new biometrical procedure for testing the equality of measurements. J Clin Chem Clin Biochem. 1983;21:709-720.
events <- {events}; pt <- {pt}
poisson.test(events, pt) # exact CI per unit of person-time
poisson.test(events, pt)$conf.int * {mult_n} # 95% CI per {mult_n}User guide
When to use. Calculate the rate of new events per unit of person-time at risk.
Assumptions. Person-time is correctly accumulated; events are independent.
Common mistakes. Do not confuse incidence (new cases over time) with prevalence (existing cases).
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Rothman KJ, Greenland S, Lash TL. Modern Epidemiology. 3rd ed. 2008.
cases <- {cases}; pop <- {pop}
prop.test(cases, pop)User guide
When to use. Estimate the proportion of a population with a condition at a point or period.
Assumptions. Cases and population are measured over the same window.
Common mistakes. Prevalence reflects both incidence and duration, not the rate of new cases.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Rothman KJ, Greenland S, Lash TL. Modern Epidemiology. 3rd ed. 2008.
a <- {a}; b <- {b}; c <- {c}; d <- {d}
Re <- a/(a+b); Ru <- c/(c+d)
c(AR = Re-Ru, ARP = (Re-Ru)/Re, RR = Re/Ru)User guide
When to use. Quantify the excess risk attributable to an exposure (attributable risk, attributable fraction, population AR).
Assumptions. A causal interpretation requires the exposure-outcome association to be unconfounded.
Common mistakes. Attributable fractions assume causality: do not apply to purely associational data.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Rothman KJ, Greenland S, Lash TL. Modern Epidemiology. 3rd ed. 2008.
ea <- {ea}; na <- {na}; ec <- {ec}; nc <- {nc}
fp <- function(x1, x0) fisher.test(matrix(c(x1, na - x1, x0, nc - x0), 2, byrow = TRUE))$p.value
p0 <- fp(ea, ec); x1 <- ea; x0 <- ec; fi <- 0
if (p0 < 0.05) while (fp(x1, x0) < 0.05) { if (ea <= ec) x1 <- x1 + 1 else x0 <- x0 + 1; fi <- fi + 1 }
c(fisher_p = p0, fragility_index = if (p0 < 0.05) fi else NA)User guide
When to use. Assess how robust a statistically significant RCT result is.
Assumptions. Binary outcome 2×2 from a randomised trial.
Common mistakes. A low fragility index does not by itself invalidate a trial.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Walsh M, et al. The statistical significance of randomized controlled trial results is frequently fragile. J Clin Epidemiol. 2014;67:622-628.
Expected format: Values
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected format: Values
x <- c({data})
shapiro.test(x)User guide
When to use. Assess whether data plausibly come from a normal distribution before choosing a parametric test.
Assumptions. Continuous data; n between 3 and 5000 for Shapiro-Wilk.
Common mistakes. p > 0.05 does not prove normality: always inspect the histogram and Q-Q plot too.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Shapiro SS, Wilk MB. An analysis of variance test for normality. Biometrika. 1965;52:591-611.
Expected format: Values
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected format: Values
x <- c({data})
summary(x); sd(x)User guide
When to use. Summarise a continuous variable for a Table 1 (mean, SD, median, IQR, range).
Assumptions. None: descriptive only.
Common mistakes. Report mean ± SD only for roughly symmetric data; use median (IQR) for skewed data.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- American Psychological Association. Publication Manual. 7th ed. 2020.
x <- {val}; mu <- {mu}; sigma <- {sig}
z <- (x - mu)/sigma
c(z = z, percentile = pnorm(z))User guide
When to use. Standardise a value and find its percentile in a normal distribution.
Assumptions. Population mean and SD are known; distribution is normal.
Common mistakes. Use a t-score instead when estimating parameters from a small sample.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Moore DS, McCabe GP, Craig BA. Introduction to the Practice of Statistics. 9th ed. New York: WH Freeman; 2017.
Expected format: Values
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected format: Values
x <- c({data})
hist(x); summary(x)User guide
When to use. Visualise the shape, centre and spread of a continuous variable.
Assumptions. Continuous data; adequate sample size for meaningful bins.
Common mistakes. Bin width strongly affects appearance: try a few before concluding.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Sturges HA. The choice of a class interval. J Am Stat Assoc. 1926;21:65-66.
Expected: 2 columns: Method A values | Method B values
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 2 columns: Method A values | Method B values
x <- c({x})
y <- c({y})
n <- length(x)
sx <- mean((x-mean(x))^2); sy <- mean((y-mean(y))^2); sxy <- mean((x-mean(x))*(y-mean(y)))
ccc <- 2*sxy/(sx+sy+(mean(x)-mean(y))^2)
ccc
cor(x, y) # precision; Cb = ccc / r (accuracy)User guide
When to use. Quantify agreement (not just correlation) between two methods measuring the same continuous quantity.
Assumptions. Paired measurements on the same subjects; approximately bivariate-normal for the Fisher-z confidence interval; a reasonably wide range of values.
Common mistakes. Do not use Pearson r alone to claim agreement. With very small samples the confidence interval is unreliable; add a Bland-Altman plot.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Lin LI. A concordance correlation coefficient to evaluate reproducibility. Biometrics. 1989;45(1):255-268.
- McBride GB. A proposal for strength-of-agreement criteria for Lin’s concordance correlation coefficient. NIWA Client Report HAM2005-062. 2005.
Expected: 2 columns: Reference / method X | Test method Y
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 2 columns: Reference / method X | Test method Y
x <- c({x})
y <- c({y})
lambda <- {delta}
sxx <- var(x); syy <- var(y); sxy <- cov(x, y)
b <- (syy - lambda*sxx + sqrt((syy - lambda*sxx)^2 + 4*lambda*sxy^2)) / (2*sxy)
a <- mean(y) - b*mean(x)
c(intercept = a, slope = b)User guide
When to use. Compare two measurement methods when both have measurement error (unlike ordinary least squares, which assumes X is exact).
Assumptions. The ratio of the two methods’ error variances (λ) is known or can be estimated from replicates; errors are roughly constant across the range.
Common mistakes. If error is proportional to concentration, use weighted Deming or Passing-Bablok. Do not use OLS when both methods are noisy.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Deming WE. Statistical Adjustment of Data. Wiley; 1943.
- Linnet K. Evaluation of regression procedures for method comparison studies. Clin Chem. 1993;39(3):424-432.
Expected: one row per record, name, value, type
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: one row per record, name, value, type
u <- c(0.12, 0.20, 0.05/sqrt(3), 0.10/sqrt(6)) # standard uncertainties
uc <- sqrt(sum(u^2))
k <- {k}
c(combined = uc, expanded = k*uc)User guide
When to use. Build a GUM uncertainty budget: convert each component to a standard uncertainty and combine them by root-sum-of-squares.
Assumptions. Components are independent (no covariance terms) and the measurand is a sum of the contributions with sensitivity coefficients of 1.
Common mistakes. Do not mix expanded and standard uncertainties. Include correlated or non-unit-sensitivity terms by hand before entering them.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- JCGM 100:2008. Evaluation of measurement data — Guide to the expression of uncertainty in measurement (GUM).
- Eurachem/CITAC Guide CG 4. Quantifying Uncertainty in Analytical Measurement. 3rd ed. 2012.
Expected: 4 columns: Blank replicates | Low-level sample replicates | Calibration concentrations | Instrument responses
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 4 columns: Blank replicates | Low-level sample replicates | Calibration concentrations | Instrument responses
blank <- c({blank})
low <- c({low})
LoB <- mean(blank) + 1.645 * sd(blank)
cp <- 1.645 / (1 - 1 / (4 * (length(low) - 1)))
LoD <- LoB + cp * sd(low)
c(LoB = LoB, LoD = LoD)
# ICH Q2 calibration-curve alternative:
conc <- c({x}); resp <- c({y})
fit <- lm(resp ~ conc)
c(LoD = 3.3 * summary(fit)$sigma / coef(fit)[2], LoQ = 10 * summary(fit)$sigma / coef(fit)[2])User guide
When to use. Estimate the limit of blank and limit of detection from blank and low-level replicates with the parametric formulas (CLSI EP17-A2 sets the study design), or LoD/LoQ from a calibration curve (ICH Q2(R1)).
Assumptions. EP17: results are approximately Gaussian, from at least 60 blank and 60 low-level measurements (20 each to verify) spread over several days and reagent lots. ICH: linear response near the limit.
Common mistakes. The calculator accepts 10 or more replicates; EP17 guidance uses about 60 blank and 60 low-level results to establish a limit and at least 20 to verify a claimed limit. This parametric route assumes a single low-level sample; with several samples or non-Gaussian blanks use the non-parametric procedure. Confirm limits experimentally.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- CLSI. Evaluation of Detection Capability for Clinical Laboratory Measurement Procedures; EP17-A2. 2012.
- ICH Q2(R1). Validation of Analytical Procedures: Text and Methodology. 2005.
- Armbruster DA, Pry T. Limit of blank, limit of detection and limit of quantitation. Clin Biochem Rev. 2008;29(Suppl 1):S49-S52.
Expected format: Reference-population values
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected format: Reference-population values
x <- c({data})
quantile(x, c(0.025, 0.975), type = 6) # nonparametric (CLSI C28-A3)
mean(x) + c(-1, 1) * qnorm(0.975) * sd(x) # parametricUser guide
When to use. Establish a reference interval (central 95% of a healthy reference population) for a laboratory analyte.
Assumptions. Values come from at least 120 well-defined reference individuals (CLSI C28-A3); outliers have been reviewed, not blindly removed.
Common mistakes. With fewer than 120 values treat the limits as approximate. Partition by age or sex when the distributions clearly differ.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- CLSI. Defining, Establishing, and Verifying Reference Intervals in the Clinical Laboratory; Approved Guideline C28-A3. 2008.
- Horn PS, Pesce AJ. Reference intervals: an update. Clin Chim Acta. 2003;334:5-23.
Expected: 2 columns: Expected concentrations | Measured results
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 2 columns: Expected concentrations | Measured results
x <- c({x})
y <- c({y})
summary(lm(y ~ x + I(x^2)))$coefficients # row 3 = non-linearity test
summary(lm(y ~ x))$r.squaredUser guide
When to use. Check that an assay responds linearly across its reporting range by testing for a quadratic component (the polynomial approach of the earlier CLSI EP6-A).
Assumptions. At least five equally informative levels; replicates averaged per level; constant variance across the range.
Common mistakes. A high R² alone does not prove linearity. Not significant does not prove linear with very few levels: inspect residuals.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- CLSI. Evaluation of the Linearity of Quantitative Measurement Procedures; EP06. 2nd ed. 2020.
Expected: 3 columns: Variable X | Variable Y | Control variable Z
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 3 columns: Variable X | Variable Y | Control variable Z
x <- c({x})
y <- c({y})
z <- c({z})
rx <- resid(lm(x ~ z)); ry <- resid(lm(y ~ z))
r <- cor(rx, ry)
t <- r * sqrt((length(x) - 3) / (1 - r^2))
c(partial_r = r, t = t, p = 2 * pt(-abs(t), length(x) - 3))User guide
When to use. Estimate the association between X and Y after removing the linear effect of a third variable Z (a confounder).
Assumptions. Linear relationships; approximately normal variables; Z is measured without error.
Common mistakes. Partial correlation does not prove Z is a confounder or that X causes Y. For several covariates use multiple regression.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Kim S. ppcor: an R package for a fast calculation to semi-partial correlation coefficients. Commun Stat Appl Methods. 2015;22(6):665-674.
e1 <- {e1}; n1 <- {n1}; e0 <- {e0}; n0 <- {n0}
margin <- {margin}/100
p1 <- e1/n1; p0 <- e0/n0
se <- sqrt(p1*(1-p1)/n1 + p0*(1-p0)/n0)
z <- (p1 - p0 + margin)/se # non-inferiority (higher is better)
c(diff = p1 - p0, z = z, p_one_sided = 1 - pnorm(z))
# Equivalence (TOST):
z2 <- (margin - (p1 - p0))/se
max(1 - pnorm(z), 1 - pnorm(z2)) # TOST p-valueUser guide
When to use. Show that a new treatment is not worse than control by more than a pre-specified margin (non-inferiority), or that two treatments differ by less than the margin in either direction (equivalence, TOST), for a binary outcome.
Assumptions. The margin was fixed in the protocol before data were seen and is justified clinically; large enough samples for the Wald approximation.
Common mistakes. Do not choose the margin after seeing the data. With small cells or rates near 0 or 100% use a score (Farrington-Manning) method. Non-significance in a superiority test is not evidence of equivalence.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Blackwelder WC. Proving the null hypothesis in clinical trials. Control Clin Trials. 1982;3:345-353.
- Schuirmann DJ. A comparison of the two one-sided tests procedure and the power approach for assessing the equivalence of average bioavailability. J Pharmacokinet Biopharm. 1987;15:657-680.
- Piaggio G, et al. Reporting of noninferiority and equivalence randomized trials (CONSORT extension). JAMA. 2012;308(24):2594-2604.
Expected: 4 columns: Sequence AB, Period 1 | Sequence AB, Period 2 | Sequence BA, Period 1 | Sequence BA, Period 2
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 4 columns: Sequence AB, Period 1 | Sequence AB, Period 2 | Sequence BA, Period 1 | Sequence BA, Period 2
ab1 <- c({ab1}); ab2 <- c({ab2}) # sequence AB: period 1 (A), period 2 (B)
ba1 <- c({ba1}); ba2 <- c({ba2}) # sequence BA: period 1 (B), period 2 (A)
dA <- ab1 - ab2; dB <- ba1 - ba2
t.test(dA, dB, var.equal = TRUE) # treatment effect A - B = (mean(dA) - mean(dB)) / 2
t.test(dA, -dB, var.equal = TRUE) # period effect
t.test(ab1 + ab2, ba1 + ba2, var.equal = TRUE) # carryover (difference in subject totals)User guide
When to use. Analyse a two-period, two-treatment (AB/BA) crossover trial with a continuous outcome: estimate the treatment effect, and test for period and carryover effects (Hills-Armitage / Grizzle).
Assumptions. Participants randomised to the two sequences; adequate washout; approximately normal within-subject differences; no treatment-by-period interaction.
Common mistakes. The carryover test has low power and should not be used as a gatekeeper for the analysis (Senn); decide on washout in the design. Do not use for conditions that resolve or treatments with permanent effects.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Senn S. Cross-over Trials in Clinical Research. 2nd ed. Wiley; 2002.
- Hills M, Armitage P. The two-period cross-over clinical trial. Br J Clin Pharmacol. 1979;8:7-20.
- Grizzle JE. The two-period change-over design and its use in clinical trials. Biometrics. 1965;21:467-480.
power.t.test(delta = {delta}, sd = sqrt(2) * {sigma}, sig.level = {alpha}, power = {power}, type = "paired")$n # total NUser guide
When to use. Plan a two-period, two-sequence (AB/BA) crossover trial comparing two treatments on a continuous outcome.
Assumptions. No carry-over or period-by-treatment interaction; equal numbers in the two sequences; within-subject SD from a previous crossover study.
Common mistakes. Do not use for parallel-group trials or when carry-over is likely (long-lasting treatments, no washout). Bioequivalence needs a TOST-based calculation.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Senn S. Cross-over Trials in Clinical Research. 2nd ed. Wiley; 2002.
- Chow SC, Shao J, Wang H. Sample Size Calculations in Clinical Research. 2nd ed. 2008.
# Classic (fixed-shape) group-sequential boundaries, equally spaced looks
K <- {looks}; alpha <- {alpha}; type <- "{interim_type}" # "OF" = O'Brien-Fleming, "Pocock"
w <- if (type == "Pocock") rep(1, K) else sqrt(K / seq_len(K))
surv <- function(C, NG = 240) {
simp <- c(1, rep(c(4, 2), length.out = NG - 1), 1)
for (k in seq_len(K)) {
b <- C * w[k] * sqrt(k); hn <- 2 * b / NG; ng <- -b + (0:NG) * hn
nd <- if (k == 1) dnorm(ng) else sapply(ng, function(s) sum(simp * dens * dnorm(s - grid)) * h / 3)
s <- sum(simp * nd) * hn / 3; grid <- ng; dens <- nd; h <- hn
}
s
}
C <- uniroot(function(C) 1 - surv(C) - alpha, c(1, 6), tol = 1e-10)$root
round(C * w, 3) # critical |z| at each lookUser guide
When to use. Set efficacy stopping boundaries for a trial with planned interim looks so overall type I error stays at α.
Assumptions. Equally spaced looks (equal information per stage); two-sided test of a normally distributed statistic; boundaries fixed before unblinding.
Common mistakes. Do not add unplanned looks. For unequal spacing use alpha-spending (Lan-DeMets) in specialised software.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- O’Brien PC, Fleming TR. A multiple testing procedure for clinical trials. Biometrics. 1979;35(3):549-556.
- Pocock SJ. Group sequential methods in the design and analysis of clinical trials. Biometrika. 1977;64(2):191-199.
- Jennison C, Turnbull BW. Group Sequential Methods with Applications to Clinical Trials. CRC; 2000.
set.seed({seed})
arms <- trimws(strsplit("{arms}", ",")[[1]]); blocks <- c({blocks}); n <- {n}
strata <- trimws(strsplit("{strata}", ",")[[1]]); scheme <- "{scheme}"
gen <- function(n) {
if (grepl("Simple", scheme)) return(arms[sample.int(length(arms), n, replace = TRUE)])
out <- character(0)
while (length(out) < n) {
b <- blocks[sample.int(length(blocks), 1)]
out <- c(out, sample(rep(arms, length.out = b)))
}
out[1:n]
}
if (grepl("Stratified", scheme)) lapply(setNames(strata, strata), function(s) gen(n)) else gen(n)User guide
When to use. Generate a reproducible allocation list (simple, permuted-block or stratified) with a recorded seed. The R command reproduces the exact list.
Assumptions. The list is held by someone independent of recruitment (allocation concealment); the seed and list are archived.
Common mistakes. Do not use a single fixed block size in unblinded trials (the last assignments become predictable). Simple randomisation can leave small trials unbalanced. Dynamic methods such as minimisation need dedicated software.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Schulz KF, Grimes DA. Generation of allocation sequences in randomised trials. Lancet. 2002;359:515-519.
- Kim J, Shin W. How to do random allocation (randomization). Clin Orthop Surg. 2014;6(1):103-109.
e1 <- {e1}; n1 <- {n1}; e0 <- {e0}; n0 <- {n0}
pt <- e1/n1; pc <- e0/n0
arr <- pc - pt
se <- sqrt(pt*(1-pt)/n1 + pc*(1-pc)/n0)
ci <- arr + c(-1, 1) * qnorm(0.975) * se
c(ARR = arr, NNT = 1/arr)
1/rev(ci) # NNT 95% CI (valid when the ARR CI excludes 0)User guide
When to use. Report treatment effects as absolute risk reduction, relative risk, odds ratio and number needed to treat, each with a 95% CI, plus a Cates plot showing what happens to 100 treated people.
Assumptions. Binary outcome over a fixed follow-up; reasonably large counts for the Wald intervals.
Common mistakes. When the ARR interval includes zero, the NNT interval runs through infinity (NNTB to NNTH): do not quote it as a simple range. NNT is specific to the follow-up time.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Altman DG. Confidence intervals for the number needed to treat. BMJ. 1998;317:1309-1312.
- Laupacis A, Sackett DL, Roberts RS. An assessment of clinically useful measures of the consequences of treatment. N Engl J Med. 1988;318:1728-1733.
library(effectsize)
d <- {value} # if converting from d
d_to_r(d) # equal group sizes
d_to_oddsratio(d)
J <- 1 - 3/(4*({n1}+{n2}-2) - 1); d * J # Hedges gUser guide
When to use. Convert between Cohen’s d, Hedges’ g, the correlation r and the odds ratio so studies can be pooled in a meta-analysis.
Assumptions. Underlying continuous outcome is approximately normal in both groups (the logistic conversion to OR assumes this).
Common mistakes. Do not convert when the original data are truly binary: use the reported odds ratio directly. Conversions between d and r assume a two-group design.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Borenstein M, Hedges LV, Higgins JPT, Rothstein HR. Introduction to Meta-Analysis. Wiley; 2009. Ch. 7.
- Chinn S. A simple method for converting an odds ratio to effect size. Stat Med. 2000;19:3127-3131.
tab <- matrix(c({a}, {c}, {b}, {d}), nrow = 2) # rows: before +/-, cols: after +/-
mcnemar.test(tab)
binom.test({b}, {b} + {c}) # exact p-valueUser guide
When to use. Compare paired binary outcomes (the same subjects before/after, or matched case-control pairs).
Assumptions. Pairs are independent of each other; the outcome is dichotomous at both time points; only discordant pairs carry information.
Common mistakes. Do not use for independent groups (use chi-square or Fisher). With fewer than ~25 discordant pairs prefer the exact p-value.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- McNemar Q. Note on the sampling error of the difference between correlated proportions. Psychometrika. 1947;12(2):153-157.
- Fagerland MW, Lydersen S, Laake P. The McNemar test for binary matched-pairs data. BMC Med Res Methodol. 2013;13:91.
Expected: 3 columns: True status , one per subject | Marker 1 scores | Marker 2 scores
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 3 columns: True status , one per subject | Marker 1 scores | Marker 2 scores
status <- c({status})
s1 <- c({score1})
s2 <- c({score2})
if (grepl("^Lower", "{dir1}")) s1 <- -s1 # make "higher = more positive"
if (grepl("^Lower", "{dir2}")) s2 <- -s2
alpha <- {alpha}
# DeLong (1988) structural components, base R only
psi <- function(x, y) (x > y) + 0.5 * (x == y)
comp <- function(s) {
M <- outer(s[status == 1], s[status == 0], psi) # positives x negatives
list(V10 = rowMeans(M), V01 = colMeans(M))
}
c1 <- comp(s1); c2 <- comp(s2)
m <- sum(status == 1); n <- sum(status == 0)
auc <- c(mean(c1$V10), mean(c2$V10))
S10 <- cov(cbind(c1$V10, c2$V10))
S01 <- cov(cbind(c1$V01, c2$V01))
S <- S10 / m + S01 / n # covariance matrix of (AUC1, AUC2)
d <- auc[1] - auc[2]
se <- sqrt(S[1, 1] + S[2, 2] - 2 * S[1, 2])
z <- d / se
p <- 2 * pnorm(-abs(z))
q <- qnorm(1 - alpha / 2)
ci <- function(a, v) pmin(1, pmax(0, a + c(-1, 1) * q * sqrt(v)))
ci1 <- ci(auc[1], S[1, 1]); ci2 <- ci(auc[2], S[2, 2])
cid <- d + c(-1, 1) * q * se
rho <- S[1, 2] / sqrt(S[1, 1] * S[2, 2])
cat(sprintf("n positives = %d, n negatives = %d\n", m, n))
cat(sprintf("AUC1 = %.4f [%.4f, %.4f]\n", auc[1], ci1[1], ci1[2]))
cat(sprintf("AUC2 = %.4f [%.4f, %.4f]\n", auc[2], ci2[1], ci2[2]))
cat(sprintf("Difference = %.4f [%.4f, %.4f], z = %.4f, p = %.4f\n", d, cid[1], cid[2], z, p))
cat(sprintf("Correlation of AUCs = %.4f\n", rho))
# Optional cross-check if pROC is installed:
# pROC::roc.test(pROC::roc(status, s1, direction = "<"),
# pROC::roc(status, s2, direction = "<"), method = "delong")User guide
When to use. Test whether two diagnostic tests or biomarkers, measured on the same subjects, differ in discriminative ability (area under the ROC curve).
Assumptions. Each subject has both scores and a true 0/1 status; subjects are independent of one another; the two AUCs are correlated because they share the same subjects (DeLong accounts for this). Ties are handled by the midrank convention (0.5).
Common mistakes. Do not use for markers measured on different subjects (use an unpaired comparison). With very few positives or negatives the normal approximation is unreliable; a non-significant result is not proof of equal performance. Compare partial AUCs or clinically relevant thresholds when the full curve is not the question.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- DeLong ER, DeLong DM, Clarke-Pearson DL. Comparing the areas under two or more correlated receiver operating characteristic curves: a nonparametric approach. Biometrics. 1988;44(3):837-845.
- Hanley JA, McNeil BJ. A method of comparing the areas under receiver operating characteristic curves derived from the same cases. Radiology. 1983;148(3):839-843.
- Robin X, Turck N, Hainard A, et al. pROC: an open-source package for R and S+ to analyze and compare ROC curves. BMC Bioinformatics. 2011;12:77.
Expected: 2 columns: Disease status per subject | Marker value per subject
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 2 columns: Disease status per subject | Marker value per subject
status <- c({status})
score <- c({score})
higher <- "{dir}" == "Higher = more positive"
method <- "{method}"
target <- {target} / 100
cr <- {costratio}
prev <- suppressWarnings(as.numeric("{prev}")) / 100 # blank -> NA -> sample prevalence
P <- sum(status == 1); N <- sum(status == 0)
if (is.na(prev)) prev <- P / (P + N)
u <- sort(unique(score))
cut <- (head(u, -1) + tail(u, -1)) / 2 # candidates: midpoints between distinct values
posf <- function(s, c) if (higher) s >= c else s <= c
sens <- sapply(cut, function(c) mean(posf(score[status == 1], c)))
spec <- sapply(cut, function(c) mean(!posf(score[status == 0], c)))
obj <- if (grepl("Youden", method)) sens + spec - 1 else
if (grepl("top-left", method)) -((1 - sens)^2 + (1 - spec)^2) else
if (grepl("sensitivity", method)) ifelse(sens >= target - 1e-12, spec, -Inf) else
if (grepl("specificity", method)) ifelse(spec >= target - 1e-12, sens, -Inf) else
-(cr * prev * (1 - sens) + (1 - prev) * (1 - spec))
stopifnot(is.finite(max(obj))) # fixed methods: target must be attainable
i <- which(obj >= max(obj) - 1e-12)[1] # ties -> lowest cut-off
c(cutoff = cut[i], sensitivity = sens[i], specificity = spec[i], J = sens[i] + spec[i] - 1)
cp <- function(x, n) c(if (x == 0) 0 else qbeta(.025, x, n - x + 1), if (x == n) 1 else qbeta(.975, x + 1, n - x))
cp(round(sens[i] * P), P); cp(round(spec[i] * N), N) # exact (Clopper-Pearson) 95% CI
# AUC with DeLong CI: library(pROC); r <- roc(status, score, direction = ifelse(higher, "<", ">")); auc(r); ci.auc(r, method = "delong")User guide
When to use. Choose a single decision threshold for a continuous diagnostic marker, and see sensitivity, specificity, predictive values, likelihood ratios and AUC at that threshold. Five criteria are compared side by side: Youden index, closest to the top-left corner, fixed sensitivity, fixed specificity, and expected cost given prevalence and the relative cost of a false negative.
Assumptions. One marker value per subject with a true 0/1 reference-standard status; independent subjects. Cut-off candidates are the midpoints between consecutive distinct sorted marker values (the same thresholds pROC uses); a subject is test-positive when the marker is ≥ the cut-off (or ≤ if lower values are more positive). Predictive values at a different prevalence are only valid if sensitivity and specificity transfer to that population.
Common mistakes. The cut-off and its accuracy are chosen and estimated on the same data and are optimistic; validate in new data or by bootstrap, especially with fewer than about 30 subjects per class. Different criteria legitimately give different cut-offs (Perkins & Schisterman). Do not use sample prevalence for PPV/NPV when cases and controls were sampled separately; enter the true prevalence instead. The AUC confidence interval is a normal approximation (DeLong) truncated to [0, 1] and is unreliable near 1 or with very few subjects.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Youden WJ. Index for rating diagnostic tests. Cancer. 1950;3(1):32-35.
- Clopper CJ, Pearson ES. The use of confidence or fiducial limits illustrated in the case of the binomial. Biometrika. 1934;26(4):404-413.
- DeLong ER, DeLong DM, Clarke-Pearson DL. Comparing the areas under two or more correlated receiver operating characteristic curves: a nonparametric approach. Biometrics. 1988;44(3):837-845.
- Perkins NJ, Schisterman EF. The inconsistency of “optimal” cutpoints obtained using two criteria based on the receiver operating characteristic curve. Am J Epidemiol. 2006;163(7):670-675.
- Robin X, Turck N, Hainard A, et al. pROC: an open-source package for R and S+ to analyze and compare ROC curves. BMC Bioinformatics. 2011;12:77.
Expected: 3 columns: Observed outcome , one value per subject | Predicted probability, model / marker 1 | Predicted probability, model 2
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected: 3 columns: Observed outcome , one value per subject | Predicted probability, model / marker 1 | Predicted probability, model 2
y <- c({status}) # observed outcome, 1 = event
p1 <- c({p1}) # predicted risk, model 1
p2 <- c({p2}) # predicted risk, model 2 (leave c() empty for one model)
thr <- round(seq({tmin}, {tmax}, by = {tstep}), 10)
nb <- function(p, y, pt) { # net benefit; treat when predicted risk >= threshold
treat <- p >= pt - 1e-12
sum(treat & y == 1) / length(y) - sum(treat & y == 0) / length(y) * pt / (1 - pt)
}
prev <- mean(y)
dca <- data.frame(threshold = thr,
treat_all = prev - (1 - prev) * thr / (1 - thr),
treat_none = 0,
model1 = sapply(thr, function(t) nb(p1, y, t)))
if (length(p2)) dca$model2 <- sapply(thr, function(t) nb(p2, y, t))
print(dca[dca$threshold %in% c(0.05, 0.10, 0.20, 0.30, 0.40, 0.50), ])
matplot(dca$threshold, dca[, -1], type = "l", lty = c(2, 1, 1, 1), lwd = 2,
col = c("grey50", "black", "#1a5276", "#c0504d"), ylim = c(-0.05, prev),
xlab = "Threshold probability", ylab = "Net benefit")
legend("topright", c("Treat all", "Treat none", "{label1}", if (length(p2)) "{label2}"),
lty = c(2, 1, 1, 1), col = c("grey50", "black", "#1a5276", "#c0504d"), lwd = 2, bty = "n")User guide
When to use. Judge whether a prediction model or marker would improve clinical decisions: net benefit weighs true positives against false positives at the risk threshold where a patient or clinician would act, and compares the model with treating everyone or no one.
Assumptions. Predicted values are calibrated probabilities between 0 and 1 for a binary outcome observed in every subject (no censoring); the same subjects are used for all models; the threshold range reflects the risks at which a decision would plausibly change. Curves from the data used to fit the model are optimistic.
Common mistakes. Do not use raw scores that are not probabilities, do not read curves outside a clinically sensible threshold range, and do not claim benefit from small differences without validation: this tool shows no confidence intervals and no correction for overfitting. Net benefit is not an accuracy measure such as AUC.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Vickers AJ, Elkin EB. Decision curve analysis: a novel method for evaluating prediction models. Med Decis Making. 2006;26(6):565-574. doi:10.1177/0272989X06295361
- Vickers AJ, van Calster B, Steyerberg EW. Net benefit approaches to the evaluation of prediction models, molecular markers, and diagnostic tests. BMJ. 2016;352:i6. doi:10.1136/bmj.i6
- Vickers AJ, van Calster B, Steyerberg EW. A simple, step-by-step guide to interpreting decision curve analysis. Diagn Progn Res. 2019;3:18. doi:10.1186/s41512-019-0064-7
AUC: Var(A) = [A(1−A) + (n1−1)(Q1−A2) + (n0−1)(Q2−A2)] / (n1n0), Q1 = A/(2−A), Q2 = 2A2/(1+A). Smallest n1 (n0 = ceiling(ratio·n1)) with A−A0 ≥ z1−α/2√Var0 + zpower√Var1; precision-only: z1−α/2√Var(A) ≤ d. Paired: Var(A1−A2) = Var(A1) + Var(A2) − 2r√(Var(A1)Var(A2)).
# Sample size for diagnostic accuracy studies (base R, no packages)
goal <- "{goal}"; alpha <- {alpha}
za <- qnorm(1 - alpha / 2)
if (grepl("Buderer", goal)) {
# Buderer 1996 / Flahault 2005: n = z^2 P (1 - P) / d^2, then divide by prevalence or 1 - prevalence
se <- {se} / 100; sp <- {sp} / 100; prev <- {prev} / 100; d <- {d} / 100
n_dis <- za^2 * se * (1 - se) / d^2 # diseased needed for sensitivity (unrounded)
n_non <- za^2 * sp * (1 - sp) / d^2 # non-diseased needed for specificity (unrounded)
tot_se <- ceiling(n_dis / prev); tot_sp <- ceiling(n_non / (1 - prev))
c(diseased = ceiling(n_dis), nondiseased = ceiling(n_non),
total_sensitivity = tot_se, total_specificity = tot_sp, required_total = max(tot_se, tot_sp))
} else {
# Hanley & McNeil (1982) variance of an AUC; n0 = ceiling(ratio * n1)
A <- {auc}; A0 <- {auc0}; A2 <- {auc2}; r <- {rho}; ratio <- {ratio}
pw <- {power} / 100; dd <- {d} / 100; zb <- qnorm(pw)
hmvar <- function(A, n1, n0) {
Q1 <- A / (2 - A); Q2 <- 2 * A^2 / (1 + A)
(A * (1 - A) + (n1 - 1) * (Q1 - A^2) + (n0 - 1) * (Q2 - A^2)) / (n1 * n0)
}
# Hanley & McNeil (1983): Var(A1 - A2) = Var(A1) + Var(A2) - 2 r SE1 SE2
vd <- function(A1, A2, n1, n0) {
v1 <- hmvar(A1, n1, n0); v2 <- hmvar(A2, n1, n0); v1 + v2 - 2 * r * sqrt(v1 * v2)
}
if (grepl("correlated", goal)) {
Ab <- (A + A2) / 2; D <- abs(A - A2)
ok <- function(n1) { n0 <- ceiling(ratio * n1); D >= za * sqrt(vd(Ab, Ab, n1, n0)) + zb * sqrt(vd(A, A2, n1, n0)) }
okp <- function(n1) { n0 <- ceiling(ratio * n1); za * sqrt(vd(A, A2, n1, n0)) <= dd }
} else {
ok <- function(n1) { n0 <- ceiling(ratio * n1); A - A0 >= za * sqrt(hmvar(A0, n1, n0)) + zb * sqrt(hmvar(A, n1, n0)) }
okp <- function(n1) { n0 <- ceiling(ratio * n1); za * sqrt(hmvar(A, n1, n0)) <= dd }
}
n1 <- 2; while (!ok(n1)) n1 <- n1 + 1
p1 <- 2; while (!okp(p1)) p1 <- p1 + 1
c(positives = n1, negatives = ceiling(ratio * n1), total = n1 + ceiling(ratio * n1),
precision_only_total = p1 + ceiling(ratio * p1))
}User guide
When to use. Plan how many participants a diagnostic accuracy study needs: to estimate sensitivity and specificity with a chosen precision (Buderer), to show that an AUC exceeds a null value, or to compare the AUCs of two tests read on the same subjects.
Assumptions. Buderer: Wald (normal-approximation) intervals, so d should be small enough that the interval stays inside 0 to 100%; prevalence is the prevalence in the recruited sample. AUC: the Hanley-McNeil variance is a smooth approximation that assumes roughly binormal-like score distributions; results are for the empirical (Mann-Whitney) AUC and a normal test statistic. Paired comparison: r is the correlation between the two AUC estimates, taken as entered, and it must come from pilot data or the literature.
Common mistakes. Do not read the Buderer result as a power calculation for a hypothesis test (it targets CI width only). Do not use the AUC results for tiny samples (a few diseased cases), for partial AUC, or for clustered/multi-reader data. For an exact or very high/low sensitivity use exact-binomial planning or a dedicated package.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Buderer NMF. Statistical methodology: I. Incorporating the prevalence of disease into the sample size calculation for sensitivity and specificity. Acad Emerg Med. 1996;3(9):895-900.
- Flahault A, Cadilhac M, Thomas G. Sample size calculation should be performed for design accuracy in diagnostic test studies. J Clin Epidemiol. 2005;58(8):859-862.
- Hanley JA, McNeil BJ. The meaning and use of the area under a receiver operating characteristic (ROC) curve. Radiology. 1982;143(1):29-36.
- Hanley JA, McNeil BJ. A method of comparing the areas under receiver operating characteristic curves derived from the same cases. Radiology. 1983;148(3):839-843.
- Obuchowski NA. Sample size calculations in studies of test accuracy. Stat Methods Med Res. 1998;7(4):371-392.
tp <- {tp}; fp <- {fp}; fn <- {fn}; tn <- {tn}; pretest <- {pretest} # pre-test probability, %
if (any(c(tp, fp, fn, tn) == 0)) { tp <- tp + .5; fp <- fp + .5; fn <- fn + .5; tn <- tn + .5 } # zero-cell correction
sens <- tp/(tp+fn); spec <- tn/(tn+fp)
# From sens/spec instead: sens <- {sens}/100; spec <- {spec}/100
lrp <- sens/(1-spec); lrn <- (1-sens)/spec
# From LRs instead: lrp <- {lrp}; lrn <- {lrn}
se_p <- sqrt(1/tp - 1/(tp+fn) + 1/fp - 1/(fp+tn)); se_n <- sqrt(1/fn - 1/(tp+fn) + 1/tn - 1/(fp+tn))
ci <- function(l, se) exp(log(l) + c(-1, 1) * qnorm(0.975) * se)
odds <- (pretest/100) / (1 - pretest/100)
post <- function(l) { o <- odds * l; 100 * o / (1 + o) }
list(LRplus = c(lrp, ci(lrp, se_p)), LRminus = c(lrn, ci(lrn, se_n)),
post_positive = post(lrp), post_negative = post(lrn))User guide
When to use. Convert a test result into a post-test probability: enter sensitivity/specificity, a 2×2 table or published likelihood ratios, set the pre-test probability, and read the answer from the table or the Fagan nomogram.
Assumptions. Sensitivity and specificity are transportable to your setting; the pre-test probability is realistic (a prevalence or a clinical estimate); the result is dichotomous. With 2×2 counts the CI uses the log method (Simel 1991), which assumes adequate cell counts. If any cell is zero, 0.5 is added to every cell before computing LR and CI (continuity correction), and the page says so.
Common mistakes. Do not chain likelihood ratios of correlated tests as if independent. LR from sensitivity and specificity entered as percentages carries no CI (counts are needed). A spec of 100% gives LR+ = infinity; in counts mode the 0.5 correction gives a finite but very wide-interval value.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Fagan TJ. Nomogram for Bayes theorem. N Engl J Med. 1975;293(5):257.
- Simel DL, Samsa GP, Matchar DB. Likelihood ratios with confidence: sample size estimation for diagnostic test studies. J Clin Epidemiol. 1991;44(8):763-770.
- Deeks JJ, Altman DG. Diagnostic tests 4: likelihood ratios. BMJ. 2004;329(7458):168-169.
All Free Research Tools
Every tool below runs entirely in your browser — no account, no upload, no data leaving your device. Each has its own page with the formula, its assumptions, a worked example, primary references and the reproducible R command.
Core statistics
Clinical & diagnostic
Survival & regression
Non-parametric tests
Agreement & reliability
Laboratory & method validation
Clinical trial design
Meta-analysis & evidence synthesis
Reporting-guideline flow diagrams
Choosing a test
Further Reading
Guides and peer-reviewed sources to help you choose, run, and report the right analysis.
- Which Statistical Test Should I Use? — interactive selector
- Sample Size & Power Analysis Calculator
- Understanding P-Values & Statistical Significance
- Meta-Analysis: Forest Plots & Heterogeneity
- All 44 Free Statistical Calculators
- Greenland S, et al. Statistical tests, P values, confidence intervals, and power: a guide to misinterpretations. Eur J Epidemiol. 2016.PMID 27209009 · free full text
- Franc JM. Analysis of Paired Data. Prehosp Disaster Med. 2025.PMID 40213959 · the paired-data error
- Altman N, Krzywinski M. Understanding p-values and significance. Lab Anim. 2024.PMID 39315628 · effect size & multiple testing
Request Statistical Help
Tell us about your data and the analysis you need. A PhD biostatistician replies with the right package and a clear plan — usually within one business day.
