GAgreement & reliability · reliability.alpha
Internal consistency (Cronbach's α, McDonald's ω)
Do the items of a scale measure the same thing consistently?
Cronbach's α (raw and standardized) with the Feldt confidence interval, item statistics (corrected item–total correlation, α if the item is dropped) and McDonald's ω from a one-factor maximum-likelihood factor analysis — ω does not assume that every item is equally strongly related to the construct.
A real result
Example “Attitude”, recorded in both engines. In the app, “Try this example” loads it into Analyze.
α = .84, 95% CI [.74, .92]
- Cronbach's α
- 0.8431
- 95% CI
- [0.7394, 0.9158]
- Standardized α
- 0.8391
- McDonald's ω
- 0.8405
Effect size
- Cronbach's α 0.8431 95% CI [0.7394, 0.9158]
Plots
View data
| Item | r (text) | Item | r |
|---|---|---|---|
| rating | 1.00 | rating | 1 |
| complaints | 0.83 | rating | 0.8254 |
| privileges | 0.43 | rating | 0.4261 |
| learning | 0.62 | rating | 0.6237 |
| raises | 0.59 | rating | 0.5901 |
| critical | 0.16 | rating | 0.1564 |
| advance | 0.16 | rating | 0.1551 |
| rating | 0.83 | complaints | 0.8254 |
| complaints | 1.00 | complaints | 1 |
| privileges | 0.56 | complaints | 0.5583 |
| learning | 0.60 | complaints | 0.5967 |
| raises | 0.67 | complaints | 0.6692 |
| critical | 0.19 | complaints | 0.1877 |
| advance | 0.22 | complaints | 0.2246 |
| rating | 0.43 | privileges | 0.4261 |
| complaints | 0.56 | privileges | 0.5583 |
| privileges | 1.00 | privileges | 1 |
| learning | 0.49 | privileges | 0.4933 |
| raises | 0.45 | privileges | 0.4455 |
| critical | 0.15 | privileges | 0.1472 |
| advance | 0.34 | privileges | 0.3433 |
| rating | 0.62 | learning | 0.6237 |
| complaints | 0.60 | learning | 0.5967 |
| privileges | 0.49 | learning | 0.4933 |
| learning | 1.00 | learning | 1 |
| raises | 0.64 | learning | 0.6403 |
| critical | 0.12 | learning | 0.1160 |
| advance | 0.53 | learning | 0.5316 |
| rating | 0.59 | raises | 0.5901 |
| complaints | 0.67 | raises | 0.6692 |
| privileges | 0.45 | raises | 0.4455 |
| learning | 0.64 | raises | 0.6403 |
| raises | 1.00 | raises | 1 |
| critical | 0.38 | raises | 0.3769 |
| advance | 0.57 | raises | 0.5742 |
| rating | 0.16 | critical | 0.1564 |
| complaints | 0.19 | critical | 0.1877 |
| privileges | 0.15 | critical | 0.1472 |
| learning | 0.12 | critical | 0.1160 |
| raises | 0.38 | critical | 0.3769 |
| critical | 1.00 | critical | 1 |
| advance | 0.28 | critical | 0.2833 |
| rating | 0.16 | advance | 0.1551 |
| complaints | 0.22 | advance | 0.2246 |
| privileges | 0.34 | advance | 0.3433 |
| learning | 0.53 | advance | 0.5316 |
| raises | 0.57 | advance | 0.5742 |
| critical | 0.28 | advance | 0.2833 |
| advance | 1.00 | advance | 1 |
Assumptions
- Items scored in the same direction — Every item correlates positively with the rest of the scale.
- One underlying factor — Weak items (corrected item–total r < .30): critical.
- Sample size — 30 complete respondents — the interval is wide.
Item statistics
| Item | Mean | SD | Corrected item–total r | α if dropped | Loading (one factor) |
|---|---|---|---|---|---|
| rating | 64.633 | 12.173 | 0.6713 | 0.8098 | 0.8525 |
| complaints | 66.600 | 13.315 | 0.7421 | 0.7969 | 0.9022 |
| privileges | 53.133 | 12.235 | 0.5607 | 0.8278 | 0.5927 |
| learning | 56.367 | 11.737 | 0.7144 | 0.8030 | 0.7307 |
| raises | 64.633 | 10.397 | 0.7863 | 0.7954 | 0.7650 |
| critical | 74.767 | 9.895 | 0.2650 | 0.8639 | 0.2461 |
| advance | 42.933 | 10.289 | 0.4608 | 0.8405 | 0.3778 |
- α from the item covariance matrix (n − 1); ω total = (Σλ)² / ((Σλ)² + Σψ) from a one-factor ML fit of the correlation matrix.
α = .84, 95% CI [.74, .92]
- Cronbach's α
- 0.8431
- 95% CI
- [0.7394, 0.9158]
- Standardized α
- 0.8391
- McDonald's ω
- 0.8405
Effect size
- Cronbach's α 0.8431 95% CI [0.7394, 0.9158]
To keep this page light, the plots are shown once, under the R tab.
Assumptions
- Items scored in the same direction — Every item correlates positively with the rest of the scale.
- One underlying factor — Weak items (corrected item–total r < .30): critical.
- Sample size — 30 complete respondents — the interval is wide.
Item statistics
| Item | Mean | SD | Corrected item–total r | α if dropped | Loading (one factor) |
|---|---|---|---|---|---|
| rating | 64.633 | 12.173 | 0.6713 | 0.8098 | 0.8525 |
| complaints | 66.600 | 13.315 | 0.7421 | 0.7969 | 0.9022 |
| privileges | 53.133 | 12.235 | 0.5607 | 0.8278 | 0.5927 |
| learning | 56.367 | 11.737 | 0.7144 | 0.8030 | 0.7307 |
| raises | 64.633 | 10.397 | 0.7863 | 0.7954 | 0.7650 |
| critical | 74.767 | 9.895 | 0.2650 | 0.8639 | 0.2461 |
| advance | 42.933 | 10.289 | 0.4608 | 0.8405 | 0.3778 |
- α from the item covariance matrix (n − 1); ω total = (Σλ)² / ((Σλ)² + Σψ) from a one-factor ML fit of the correlation matrix.
Do it in CodeSplash Run it on your own data, in Python or R, with the code to prove it.
Worked examples in the app
- Attitudeattitude · items: rating, complaints, privileges, learning, raises, critical, advance
- Likert reversedlikert_sim · items: q1, q2, q3, q4 (reversed), q5, q6
- Two items no omegaattitude · items: rating, complaints
- Degenerate constantattitude · items: rating, complaints, privileges, learning, raises, critical, advance
- Degenerate n2attitude · items: rating, complaints, privileges, learning, raises, critical, advance
- Degenerate n3attitude · items: rating, complaints, privileges, learning, raises, critical, advance
In the guides
Where it sits in the decision guides
- Internal consistency: Cronbach's α, ω · Statistics Guide · G — Agreement / reliability
What you need
- Itemsnumeric · 2–200 columns
- The scale's items, scored in the same direction (reverse-code negatively worded items first). Rows with a missing item are left out.
Choices you make
hypothesis
- Confidence leveldefault 0.95
How sure the intervals should be: 0.95 gives 95% confidence intervals. Higher confidence means wider intervals.
statistics
- McDonald's ω (one-factor model)default on
Fit a one-factor maximum-likelihood factor analysis and report ω total and the loadings.
Checks and remedies
CodeSplash checks each testable assumption on every run and shows the result on the card; premises the data can’t test are marked. If a check fails, these are the ways forward.
Items scored in the same direction
A negative corrected item–total correlation usually means the item needs reverse coding.
One underlying factor
α and ω (total) describe one construct; low loadings suggest the item measures something else.
Sample size
Stable estimates need enough respondents (often 100 or more).
What it reports
- alpha
- The false-positive rate you accept before looking at the data, usually 0.05.
- alpha_low
- A range of effect values compatible with your data at the chosen confidence level.
- alpha_high
- A range of effect values compatible with your data at the chosen confidence level.
- alpha_std
- A reliability estimate from how a scale's items covary. It assumes each item measures the factor equally well.
- mean_r
- A number from −1 to 1 for how closely two variables move together; Pearson measures straight-line association.
- n
- How many independent units the analysis used; it sets precision and power.
- k
- How many groups, studies or clusters the analysis used. Many methods are less reliable when k is small.
- omega
- A model of how big the next move is likely to be, built from recent shocks and recent volatility. It says nothing about direction.
Per group, level or term: item_total_r[<item>], alpha_if_deleted[<item>], item_mean[<item>], item_sd[<item>], loading[<item>]
Python and R
Python and R agree to 6 decimals (relative tolerance 1e-10). Python uses pandas, numpy, scipy, codesplash; R uses stats, nanoparquet, codesplashr.
Default traps between the two languages
- α and item statistics are closed form (P0). ω comes from the same EM iterations in both engines (codesplash.stats.reliability.omega_1f ↔ cs_omega_1f) run to 1e-12; factanal's own optimizer agrees to its tolerance (≈ 1e-6).
The exact script CodeSplash ran for example “Attitude” · Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Internal consistency (Cronbach's α, McDonald's ω)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method reliability.alpha 1.0.1 · spec 9608a335a3376f93
# Dataset: attitude (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
import numpy as np
import pandas as pd
import codesplash as cs
from codesplash.stats import reliability as rl # α and one-factor ω (twins of R's cs_alpha / cs_omega_1f)
# %% Data
df = pd.read_parquet("tests/parity/fixtures/attitude.parquet", columns=["rating", "complaints", "privileges", "learning", "raises", "critical", "advance"])
n_input = len(df)
df = df.dropna(subset=["rating", "complaints", "privileges", "learning", "raises", "critical", "advance"]) # listwise deletion over the analysis columns
n_dropped = n_input - len(df)
warnings = []
if n_dropped:
warnings.append(cs.cs_warning("CS_W_ROWS_DROPPED", dropped=n_dropped, total=n_input))
if n_input and not len(df):
cs.cs_error("CS_E_NO_ROWS")
cs.check_finite_columns(df, ["rating", "complaints", "privileges", "learning", "raises", "critical", "advance"]) # infinite values stop the run (registry/errors.yaml)
# %% Cronbach's alpha
items = ["rating", "complaints", "privileges", "learning", "raises", "critical", "advance"]
X = df[items].to_numpy(dtype=float)
n, k = X.shape
if n < 3:
cs.cs_error("CS_E_TOO_FEW_ROWS", what="Cronbach's α", min=3, n=n)
for j, item in enumerate(items):
if len(np.unique(X[:, j])) < 2: # its correlations (standardized α, item–total r, ω) would be 0 / 0
cs.cs_error("CS_E_CONSTANT", column=item)
conf = 0.95
res = rl.alpha(X, conf)
values = {"alpha": res["alpha"], "alpha_low": res["ci_low"], "alpha_high": res["ci_high"], "alpha_std": res["alpha_std"],
"mean_r": res["mean_r"], "n": float(n), "k": float(k), "omega": None}
# %% McDonald's omega (one-factor ML factor analysis, EM)
om = None
if True and k >= 3:
if n <= k: # the correlation matrix is singular with no more respondents than items
warnings.append(cs.cs_warning("CS_W_SMALL_SAMPLE", n=n, consequence="McDonald's ω needs more respondents than items, so it is not reported."))
else:
om = rl.omega_1f(res["R"])
if om["converged"]:
values["omega"] = om["omega"]
nan = lambda x: None if x is None or not np.isfinite(x) else float(x) # noqa: E731
rows = []
for j, item in enumerate(items):
load = float(om["loadings"][j]) if om and om["converged"] else None
values[f"item_mean[{item}]"], values[f"item_sd[{item}]"] = float(res["item_mean"][j]), float(res["item_sd"][j])
values[f"item_total_r[{item}]"] = float(res["item_total"][j])
values[f"alpha_if_deleted[{item}]"] = nan(res["if_deleted"][j])
values[f"loading[{item}]"] = load
rows.append({"item": item, "mean": float(res["item_mean"][j]), "sd": float(res["item_sd"][j]), "r_drop": float(res["item_total"][j]),
"alpha_drop": nan(res["if_deleted"][j]), "loading": load})
# %% Assumptions
neg = [items[j] for j in range(k) if res["item_total"][j] < 0]
weak = [items[j] for j in range(k) if 0 <= res["item_total"][j] < 0.3]
assumptions = [
{"key": "item_direction", "label": "Items scored in the same direction", "status": "warn" if neg else "pass",
"detail": f"Negative corrected item–total correlation for {', '.join(neg)} — reverse-code before computing α." if neg
else "Every item correlates positively with the rest of the scale."},
{"key": "unidimensionality", "label": "One underlying factor", "status": "warn" if weak else "pass",
"detail": f"Weak items (corrected item–total r < .30): {', '.join(weak)}." if weak else "Every item correlates at least .30 with the rest of the scale."},
{"key": "sample_size", "label": "Sample size", "status": "warn" if n < 100 else "pass",
"detail": f"{n} complete respondents" + (" — the interval is wide." if n < 100 else ".")},
]
if om and not om["converged"]:
warnings.append("The one-factor model did not converge; ω is not reported.")
# %% Result
pct = f"{conf:.0%}"
R = res["R"]
cs.publish({
"method": "reliability.alpha",
"methodVersion": "1.0.1",
"title": "Internal consistency",
"engine": cs.engine_info("numpy", "scipy", "codesplash"),
"n": int(n),
"summary": f"Cronbach's α = {res['alpha']:.3f}, {pct} CI [{res['ci_low']:.3f}, {res['ci_high']:.3f}] for {k} items"
+ (f"; ω = {values['omega']:.3f}." if values["omega"] is not None else "."),
"apa": f"α = {cs.fmt_num(res['alpha'], 2, leading_zero=False)}, {pct} CI [{cs.fmt_num(res['ci_low'], 2, leading_zero=False)}, {cs.fmt_num(res['ci_high'], 2, leading_zero=False)}]",
"statistics": [{"key": "alpha", "label": "Cronbach's α", "value": res["alpha"]}, {"key": "ci", "label": f"{pct} CI", "value": [res["ci_low"], res["ci_high"]]},
{"key": "alpha_std", "label": "Standardized α", "value": res["alpha_std"]}]
+ ([{"key": "omega", "label": "McDonald's ω", "value": values["omega"]}] if values["omega"] is not None else []),
"tables": [{"key": "items", "title": "Item statistics", "columns": [
{"key": "item", "label": "Item", "type": "string"}, {"key": "mean", "label": "Mean", "type": "number"},
{"key": "sd", "label": "SD", "type": "number"}, {"key": "r_drop", "label": "Corrected item–total r", "type": "number"},
{"key": "alpha_drop", "label": "α if dropped", "type": "number"}, {"key": "loading", "label": "Loading (one factor)", "type": "number"},
], "rows": rows}],
"effectSizes": [{"key": "alpha", "label": "Cronbach's α", "value": res["alpha"], "ciLow": res["ci_low"], "ciHigh": res["ci_high"],
"ciLevel": conf, "method": "Feldt (1965) F interval"}],
"assumptions": assumptions,
"warnings": warnings,
"notes": ["α from the item covariance matrix (n − 1); ω total = (Σλ)² / ((Σλ)² + Σψ) from a one-factor ML fit of the correlation matrix."],
"charts": [cs.chart("corr", "matrix-heatmap", "Inter-item correlations", {
"row": cs.col("Item", [a for a in items for _ in items], "categorical", levels=items),
"col": cs.col("Item ", [b for _ in items for b in items], "categorical", levels=items),
"value": cs.col("r", R.ravel().tolist(), "numeric"),
"label": cs.col("r (text)", [f"{x:.2f}" for x in R.ravel()], "categorical"),
}, controls={"scale": "diverging", "min": -1, "max": 1})],
"values": values,
})
The exact script CodeSplash ran for example “Attitude” · R version 4.5.1 (2025-06-13)
# Internal consistency (Cronbach's α, McDonald's ω)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method reliability.alpha 1.0.1 · spec 9608a335a3376f93
# Dataset: attitude (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
library(codesplashr)
# %% Data
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/attitude.parquet", col_select = c("rating", "complaints", "privileges", "learning", "raises", "critical", "advance")))
n_input <- nrow(df)
df <- df[stats::complete.cases(df[c("rating", "complaints", "privileges", "learning", "raises", "critical", "advance")]), , drop = FALSE] # listwise deletion
df[] <- lapply(df, function(x) if (is.factor(x)) droplevels(x) else x)
n_dropped <- n_input - nrow(df)
warnings <- list()
if (n_dropped > 0) {
warnings <- c(warnings, cs_warning("CS_W_ROWS_DROPPED", dropped = n_dropped, total = n_input))
}
if (n_input > 0 && nrow(df) == 0) cs_error("CS_E_NO_ROWS")
cs_check_finite_columns(df, c("rating", "complaints", "privileges", "learning", "raises", "critical", "advance")) # infinite values stop the run (registry/errors.yaml)
# %% Cronbach's alpha
items <- c("rating", "complaints", "privileges", "learning", "raises", "critical", "advance")
X <- as.matrix(df[items])
n <- nrow(X)
k <- ncol(X)
if (n < 3) cs_error("CS_E_TOO_FEW_ROWS", what = "Cronbach's α", min = 3, n = n)
for (j in seq_len(k)) {
# its correlations (standardized alpha, item-total r, omega) would be 0 / 0
if (length(unique(X[, j])) < 2) cs_error("CS_E_CONSTANT", column = items[j])
}
conf <- 0.95
res <- cs_alpha(X, conf) # twin of codesplash.stats.reliability.alpha
values <- list(alpha = res$alpha, alpha_low = res$ci_low, alpha_high = res$ci_high, alpha_std = res$alpha_std,
mean_r = res$mean_r, n = n, k = k, omega = NA)
# %% McDonald's omega (one-factor ML factor analysis, EM)
om <- NULL
if (TRUE && k >= 3) {
if (n <= k) { # the correlation matrix is singular with no more respondents than items
warnings <- c(warnings, cs_warning("CS_W_SMALL_SAMPLE", n = n, consequence = "McDonald's ω needs more respondents than items, so it is not reported."))
} else {
om <- cs_omega_1f(res$R)
if (om$converged) values$omega <- om$omega
}
}
fin <- function(x) if (is.null(x) || !is.finite(x)) NA else unname(x)
rows <- list()
for (j in seq_len(k)) {
item <- items[j]
load <- if (!is.null(om) && om$converged) om$loadings[j] else NA
values[[sprintf("item_mean[%s]", item)]] <- unname(res$item_mean[j])
values[[sprintf("item_sd[%s]", item)]] <- unname(res$item_sd[j])
values[[sprintf("item_total_r[%s]", item)]] <- res$item_total[j]
values[[sprintf("alpha_if_deleted[%s]", item)]] <- fin(res$if_deleted[j])
values[[sprintf("loading[%s]", item)]] <- load
rows[[j]] <- list(item = item, mean = unname(res$item_mean[j]), sd = unname(res$item_sd[j]), r_drop = res$item_total[j],
alpha_drop = fin(res$if_deleted[j]), loading = load)
}
# %% Assumptions
neg <- items[res$item_total < 0]
weak <- items[res$item_total >= 0 & res$item_total < 0.3]
assumptions <- list(
list(key = "item_direction", label = "Items scored in the same direction", status = if (length(neg)) "warn" else "pass",
detail = if (length(neg)) sprintf("Negative corrected item–total correlation for %s — reverse-code before computing α.", paste(neg, collapse = ", "))
else "Every item correlates positively with the rest of the scale."),
list(key = "unidimensionality", label = "One underlying factor", status = if (length(weak)) "warn" else "pass",
detail = if (length(weak)) sprintf("Weak items (corrected item–total r < .30): %s.", paste(weak, collapse = ", "))
else "Every item correlates at least .30 with the rest of the scale."),
list(key = "sample_size", label = "Sample size", status = if (n < 100) "warn" else "pass",
detail = paste0(sprintf("%d complete respondents", n), if (n < 100) " — the interval is wide." else "."))
)
if (!is.null(om) && !om$converged) warnings <- c(warnings, "The one-factor model did not converge; ω is not reported.")
# %% Result
pct <- sprintf("%.0f%%", conf * 100)
R <- res$R
cs_publish(list(
method = "reliability.alpha",
methodVersion = "1.0.1",
title = "Internal consistency",
engine = cs_engine_info("stats", "codesplashr"),
n = n,
summary = paste0(sprintf("Cronbach's α = %.3f, %s CI [%.3f, %.3f] for %d items", res$alpha, pct, res$ci_low, res$ci_high, k),
if (!is.na(values$omega)) sprintf("; ω = %.3f.", values$omega) else "."),
apa = sprintf("α = %s, %s CI [%s, %s]", cs_fmt_num(res$alpha, 2, leading_zero = FALSE), pct, cs_fmt_num(res$ci_low, 2, leading_zero = FALSE),
cs_fmt_num(res$ci_high, 2, leading_zero = FALSE)),
statistics = c(list(list(key = "alpha", label = "Cronbach's α", value = res$alpha), list(key = "ci", label = paste(pct, "CI"), value = c(res$ci_low, res$ci_high)),
list(key = "alpha_std", label = "Standardized α", value = res$alpha_std)),
if (!is.na(values$omega)) list(list(key = "omega", label = "McDonald's ω", value = values$omega))),
tables = list(list(key = "items", title = "Item statistics", columns = list(
list(key = "item", label = "Item", type = "string"), list(key = "mean", label = "Mean", type = "number"),
list(key = "sd", label = "SD", type = "number"), list(key = "r_drop", label = "Corrected item–total r", type = "number"),
list(key = "alpha_drop", label = "α if dropped", type = "number"), list(key = "loading", label = "Loading (one factor)", type = "number")
), rows = rows)),
effectSizes = list(list(key = "alpha", label = "Cronbach's α", value = res$alpha, ciLow = res$ci_low, ciHigh = res$ci_high,
ciLevel = conf, method = "Feldt (1965) F interval")),
assumptions = assumptions,
warnings = warnings,
notes = list("α from the item covariance matrix (n − 1); ω total = (Σλ)² / ((Σλ)² + Σψ) from a one-factor ML fit of the correlation matrix."),
charts = list(cs_chart("corr", "matrix-heatmap", "Inter-item correlations", list(
row = cs_col("Item", rep(items, each = k), "categorical", levels = items),
col = cs_col("Item ", rep(items, times = k), "categorical", levels = items),
value = cs_col("r", as.vector(t(R)), "numeric"),
label = cs_col("r (text)", sprintf("%.2f", as.vector(t(R))), "categorical")
), controls = list(scale = "diverging", min = -1, max = 1))),
values = values
))
Sources
- Cronbach, L. J. (1951). Coefficient alpha and the internal structure of tests. Psychometrika, 16, 297–334.
- Feldt, L. S. (1965). The approximate sampling distribution of Kuder-Richardson reliability coefficient twenty. Psychometrika, 30, 357–370.
- McDonald, R. P. (1999). Test theory: A unified treatment. Erlbaum.
- Dunn, T. J., Baguley, T., & Brunsden, V. (2014). From alpha to omega. British Journal of Psychology, 105, 399–412.
From the CodeSplash method registry · reliability.alpha v1.0.1.