CAssociation · correlation.compare
Compare two correlations (Fisher z, Williams, Steiger)
Is one correlation stronger than another?
Compares two Pearson correlations. Independent samples (r of x and y in two groups) use Fisher's r-to-z test; two correlations from the same people that share a variable (x with y vs x with z) use Williams' t, Steiger's z or Hittner–May–Silver's z; two correlations from the same people with no shared variable (x with y vs z with w) use Steiger's z. Zou's interval for the difference and Cohen's q are reported throughout.
A real result
Example “Independent fisher”, recorded in both engines. In the app, “Try this example” loads it into Analyze.
z = 2.30, p = .021, Δr = .35, 95% CI [.05, .62], q = 0.35
- r₁
- 0.2015
- r₂
- −0.1442
- r₁ − r₂
- 0.3456
- z
- 2.303
- p
- .021
- 95% CI (Zou)
- [0.0510, 0.6206]
Effect size
- Cohen's q 0.3494
- r₁ − r₂ 0.3456 95% CI [0.0510, 0.6206]
Assumptions
- Approximately bivariate normal data — Fisher-z based tests assume normal variables; check scatter plots for curvature and outliers.
- Valid correlation matrix — Independent samples: each correlation comes from its own group.
All applicable tests
| Test | Statistic | df | p |
|---|---|---|---|
| Fisher r-to-z | 2.303 | — | .021 |
- Pearson correlations; Fisher r-to-z; alternative: two-sided; Zou's (2007) two-sided 95% interval for r₁ − r₂.
z = 2.30, p = .021, Δr = .35, 95% CI [.05, .62], q = 0.35
- r₁
- 0.2015
- r₂
- −0.1442
- r₁ − r₂
- 0.3456
- z
- 2.303
- p
- .021
- 95% CI (Zou)
- [0.0510, 0.6206]
Effect size
- Cohen's q 0.3494
- r₁ − r₂ 0.3456 95% CI [0.0510, 0.6206]
Assumptions
- Approximately bivariate normal data — Fisher-z based tests assume normal variables; check scatter plots for curvature and outliers.
- Valid correlation matrix — Independent samples: each correlation comes from its own group.
All applicable tests
| Test | Statistic | df | p |
|---|---|---|---|
| Fisher r-to-z | 2.303 | — | .021 |
- Pearson correlations; Fisher r-to-z; alternative: two-sided; Zou's (2007) two-sided 95% interval for r₁ − r₂.
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
- Independent fisherbirthwt · group: smoke · x: age · y: bwt
- Overlapping williamsmtcars · x: mpg · y: weight (1000 lbs) · z: hp
- Overlapping steiger greatermtcars · x: mpg · y: disp · z: qsec
- Nonoverlapping steigermtcars · w: qsec · x: mpg · y: weight (1000 lbs) · z: disp
- Overlapping hittner 90airquality · x: Ozone · y: Temp · z: Wind
- Degenerate constantbirthwt · group: smoke · x: age · y: bwt
- Degenerate n2birthwt · group: smoke · x: age · y: bwt
- Degenerate n3birthwt · group: smoke · x: age · y: bwt
In the guides
Tests from the statistics guide this method runs
Where it sits in the decision guides
- Continuous–continuous: Pearson / Spearman / Kendall · Statistics Guide · C — Test association
What you need
- First variablenumeric · 1 column
- In every design, the first variable of the first correlation (and the shared variable when the correlations overlap).
- Second variablenumeric · 1 column
- The first correlation is r(x, y).
- Two independent groupscategorical / boolean · 0–1 column · 2–2 levels
- Independent samples: r(x, y) in the first group is compared with r(x, y) in the second. Leave empty for one sample.
- Third variablenumeric · 0–1 column
- One sample: with z alone, r(x, y) is compared with r(x, z) (overlapping); with z and w, with r(z, w) (non-overlapping).
- Fourth variablenumeric · 0–1 column
- Non-overlapping correlations: the second correlation is r(z, w) from the same rows.
Choices you make
statistics
- Testdefault auto
Automatic picks the test that matches the design the roles describe.
- Automatic (from the roles)(default) — Fisher z for two groups, Williams' t for overlapping correlations, Steiger's z for non-overlapping ones.
- Fisher r-to-z (independent samples) — z test on the difference of Fisher-transformed correlations from two independent samples.
- Williams' t (overlapping) — t on n − 3 df for r(x, y) vs r(x, z) from one sample; uses r(y, z). Recommended by Steiger (1980).
- Steiger's z — Fisher z difference with the Dunn–Clark covariance at the pooled r; overlapping or non-overlapping correlations.
- Hittner–May–Silver z (overlapping) — Steiger's z with the back-transformed mean Fisher z; a little better Type I error control in small samples.
hypothesis
- Alternative hypothesisdefault two-sided
Which direction counts as evidence. Keep two-sided unless you fixed the direction before seeing the data.
- The correlations differ (≠)(default) — Tests for a difference between the two correlations in either direction; keep it unless you fixed a direction before seeing the data.
- The first is larger (>) — Larger signed correlation, not larger in absolute value.
- The first is smaller (<) — Tests only for the first correlation being smaller; pick it only if you fixed this direction before seeing the data.
- Confidence leveldefault 0.95
Level of Zou's two-sided interval for the difference between the correlations.
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.
Approximately bivariate normal data
Fisher's z and its variants assume (multivariate) normal variables; with heavy tails or outliers compare rank correlations by bootstrap instead.
Valid correlation matrix
For dependent correlations, the correlations among all the variables must form a positive definite matrix.
Independent observationsNot checked from data: state why it holds
Rows are independent; in the one-sample designs all correlations come from the same rows.
What it reports
- Tests: Difference between correlations
- design
- The exact variant that ran (for example Welch vs classic F), shown so the result can be reported and reproduced.
- test
- The exact variant that ran (for example Welch vs classic F), shown so the result can be reported and reproduced.
- r1
- A number from −1 to 1 for how closely two variables move together; Pearson measures straight-line association.
- r2
- The share of the outcome's variance explained by the model, from 0 to 1.
- r_yz
- 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.
- n1
- How many independent units the analysis used; it sets precision and power.
- n2
- How many independent units the analysis used; it sets precision and power.
- diff
- The first correlation minus the second (r₁ − r₂). Positive means the first correlation is larger.
- statistic
- One test of "every component null holds" from several independent tests' p-values.
- df
- How much independent information is left to estimate variability after fitting the model.
- p
- How surprising your data would be if the null hypothesis were true, as a probability.
- ci_low
- A range of effect values compatible with your data at the chosen confidence level.
- ci_high
- A range of effect values compatible with your data at the chosen confidence level.
- q
- Effect size for the difference between two correlations — the difference of their Fisher z values.
- level_1
- Which group counts as first (or treated, or positive) decides the sign of differences and ratios on the card.
- level_2
- Which group counts as first (or treated, or positive) decides the sign of differences and ratios on the card.
Python and R
Python and R agree to 10 decimals (relative tolerance 1e-10). Python uses pandas, numpy, scipy, codesplash; R uses stats, nanoparquet, codesplashr.
Default traps between the two languages
- Both engines use the codesplash twins (codesplash.stats.dependence ↔ codesplashr) written from Fisher (1921), Williams (1959), Steiger (1980), Hittner, May & Silver (2003) and Zou (2007); cocor's williams1959, steiger1980, hittner2003 and zou2007 agree.
The exact script CodeSplash ran for example “Independent fisher” · Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Compare two correlations (Fisher z, Williams, Steiger)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method correlation.compare 1.0.1 · spec b09c691cef35475a
# Dataset: birthwt (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 dependence
# %% Data
df = pd.read_parquet("tests/parity/fixtures/birthwt.parquet", columns=["age", "bwt", "smoke"])
n_input = len(df)
df["smoke"] = pd.Categorical(df["smoke"], categories=["false", "true"]) # stored level order
df = df.dropna(subset=["age", "bwt", "smoke"]) # listwise deletion over the analysis columns
df["smoke"] = df["smoke"].cat.remove_unused_categories()
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, ["age", "bwt", "smoke"]) # infinite values stop the run (registry/errors.yaml)
# %% Correlations
a, b = "age", "bwt"
c = None
d = None
g = "smoke"
alternative = "two-sided"
conf = 0.95
test = "fisher"
def r_of(u, v):
return float(np.corrcoef(u.to_numpy(dtype=float), v.to_numpy(dtype=float))[0, 1])
if g is not None and c is not None:
raise ValueError("Bind either Two independent groups or a Third variable, not both.")
if d is not None and c is None:
raise ValueError("Non-overlapping correlations need a Third variable as well as the Fourth.")
r_yz = n1 = n2 = level_1 = level_2 = None
# Fisher's z and the tests for correlations from one sample have SE terms in 1 / (n − 3).
if g is not None:
levels = list(df[g].cat.categories)
if len(levels) != 2:
cs.cs_error("CS_E_GROUP_COUNT", column=g, expected=2, k=len(levels))
for lv in levels:
if (df[g] == lv).sum() < 4:
cs.cs_error("CS_E_SMALL_GROUP", min=4, group=str(lv), n=int((df[g] == lv).sum()))
elif c is not None and len(df) < 4:
cs.cs_error("CS_E_TOO_FEW_ROWS", what="Comparing correlations", min=4, n=len(df))
# A correlation is 0 / 0 when one of its variables is constant.
for col in [v for v in (a, b, c, d) if v is not None]:
if df[col].nunique() < 2:
cs.cs_error("CS_E_CONSTANT", column=col)
if g is not None:
design = "independent"
boolean_group = True
level_1, level_2 = ((f"{g} = {levels[0]}", f"{g} = {levels[1]}") if boolean_group else (str(levels[0]), str(levels[1])))
d1, d2 = df[df[g] == levels[0]], df[df[g] == levels[1]]
n1, n2 = len(d1), len(d2)
for label, part in ((level_1, d1), (level_2, d2)):
for col in (a, b):
if part[col].nunique() < 2:
cs.cs_error("CS_E_UNDEFINED", what=f"The correlation of {a} and {b} in {label}", reason=f"{col} has no variation in this group")
r1, r2 = r_of(d1[a], d1[b]), r_of(d2[a], d2[b])
res = dependence.compare_independent(r1, n1, r2, n2, alternative=alternative, conf=conf)
allowed = ["fisher"]
elif c is not None and d is None:
design = "overlapping"
r1, r2, r_yz = r_of(df[a], df[b]), r_of(df[a], df[c]), r_of(df[b], df[c])
res = dependence.compare_overlapping(r1, r2, r_yz, len(df), alternative=alternative, conf=conf)
allowed = ["williams", "steiger", "hittner"]
elif c is not None:
design = "nonoverlapping"
r = {"xy": r_of(df[a], df[b]), "zw": r_of(df[c], df[d]), "xz": r_of(df[a], df[c]), "xw": r_of(df[a], df[d]),
"yz": r_of(df[b], df[c]), "yw": r_of(df[b], df[d])}
r1, r2 = r["xy"], r["zw"]
res = dependence.compare_nonoverlapping(r, len(df), alternative=alternative, conf=conf)
allowed = ["steiger"]
else:
raise ValueError("Bind Two independent groups (independent samples) or a Third variable (one sample).")
n = len(df)
if test == "auto":
test = allowed[0]
if test not in allowed:
raise ValueError(f"The {test} test does not apply to {design} correlations; choose one of: {', '.join(allowed)}.")
main = next(t for t in res["tests"] if t["test"] == test)
statistic, dof, p = main["statistic"], main["df"], main["p"]
# %% Result
alpha = 1 - conf
pct = f"{conf:.0%}"
if design == "independent":
first = f"r({a}, {b}) = {r1:.2f} in {level_1} (n = {n1}) and {r2:.2f} in {level_2} (n = {n2})"
elif design == "overlapping":
first = f"{a} correlated r = {r1:.2f} with {b} and r = {r2:.2f} with {c} (n = {n}; r({b}, {c}) = {r_yz:.2f})"
else:
first = f"r({a}, {b}) = {r1:.2f} and r({c}, {d}) = {r2:.2f} (n = {n})"
verdict = (f"The correlations differ ({cs.fmt_p(p)})." if p < alpha
else f"The data are compatible with equal correlations ({cs.fmt_p(p)}).")
summary = f"{first}: a difference of {res['diff']:.2f}, {pct} CI [{res['ci_low']:.2f}, {res['ci_high']:.2f}]. {verdict}"
stat_txt = f"t({dof:g}) = {statistic:.2f}" if dof is not None else f"z = {statistic:.2f}"
apa = (f"{stat_txt}, {cs.fmt_p(p)}, Δr = {cs.fmt_num(res['diff'], leading_zero=False)}, {pct} CI "
f"[{cs.fmt_num(res['ci_low'], leading_zero=False)}, {cs.fmt_num(res['ci_high'], leading_zero=False)}], q = {res['q']:.2f}")
rows = [{"test": t["label"], "statistic": t["statistic"], "df": t["df"], "p": t["p"]} for t in res["tests"]]
cs.publish({
"method": "correlation.compare",
"methodVersion": "1.0.1",
"title": {"independent": "Comparing independent correlations", "overlapping": "Comparing overlapping correlations",
"nonoverlapping": "Comparing non-overlapping correlations"}[design],
"engine": cs.engine_info("pandas", "numpy", "scipy"),
"n": n,
"summary": summary,
"apa": apa,
"statistics": [
{"key": "r1", "label": "r₁", "value": r1},
{"key": "r2", "label": "r₂", "value": r2},
{"key": "diff", "label": "r₁ − r₂", "value": res["diff"]},
{"key": "statistic", "label": "t" if dof is not None else "z", "value": statistic},
{"key": "p", "label": "p", "value": p, "format": "p"},
{"key": "ci", "label": f"{pct} CI (Zou)", "value": [res["ci_low"], res["ci_high"]]},
],
"tables": [{"key": "tests", "title": "All applicable tests", "columns": [
{"key": "test", "label": "Test", "type": "string"}, {"key": "statistic", "label": "Statistic", "type": "number"},
{"key": "df", "label": "df", "type": "number"}, {"key": "p", "label": "p", "type": "pvalue"}], "rows": rows}],
"effectSizes": [{"key": "q", "label": "Cohen's q", "value": res["q"], "method": "atanh(r₁) − atanh(r₂)"},
{"key": "diff", "label": "r₁ − r₂", "value": res["diff"], "ciLow": res["ci_low"], "ciHigh": res["ci_high"],
"ciLevel": conf, "method": "Zou (2007) interval"}],
"assumptions": [
{"key": "normality", "label": "Approximately bivariate normal data", "status": "info",
"detail": "Fisher-z based tests assume normal variables; check scatter plots for curvature and outliers."},
{"key": "matrix", "label": "Valid correlation matrix", "status": "pass",
"detail": "The correlations form a valid (positive definite) correlation matrix." if design != "independent"
else "Independent samples: each correlation comes from its own group."},
],
"charts": [],
"warnings": warnings,
"notes": [f"Pearson correlations; {main['label']}; alternative: {alternative}; Zou's (2007) two-sided {pct} interval for r₁ − r₂."],
"values": {"design": design, "test": test, "r1": r1, "r2": r2, "r_yz": r_yz, "n": n, "n1": n1, "n2": n2,
"diff": res["diff"], "statistic": statistic, "df": dof, "p": p, "ci_low": res["ci_low"], "ci_high": res["ci_high"],
"q": res["q"], "level_1": level_1, "level_2": level_2},
})
The exact script CodeSplash ran for example “Independent fisher” · R version 4.5.1 (2025-06-13)
# Compare two correlations (Fisher z, Williams, Steiger)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method correlation.compare 1.0.1 · spec b09c691cef35475a
# Dataset: birthwt (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/birthwt.parquet", col_select = c("age", "bwt", "smoke")))
n_input <- nrow(df)
df[["smoke"]] <- factor(df[["smoke"]], levels = c("false", "true")) # stored level order
df <- df[stats::complete.cases(df[c("age", "bwt", "smoke")]), , 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("age", "bwt", "smoke")) # infinite values stop the run (registry/errors.yaml)
# %% Correlations
a <- "age"
b <- "bwt"
c3 <- NULL
d4 <- NULL
g <- "smoke"
alternative <- "two-sided"
conf <- 0.95
test <- "fisher"
r_of <- function(u, v) stats::cor(as.double(u), as.double(v))
if (!is.null(g) && !is.null(c3)) stop("Bind either Two independent groups or a Third variable, not both.")
if (!is.null(d4) && is.null(c3)) stop("Non-overlapping correlations need a Third variable as well as the Fourth.")
r_yz <- NULL; n1 <- NULL; n2 <- NULL; level_1 <- NULL; level_2 <- NULL
# Fisher's z and the tests for correlations from one sample have SE terms in 1 / (n - 3).
if (!is.null(g)) {
lv <- levels(df[[g]])
if (length(lv) != 2) cs_error("CS_E_GROUP_COUNT", column = g, expected = 2, k = length(lv))
for (l in lv) {
if (sum(df[[g]] == l) < 4) cs_error("CS_E_SMALL_GROUP", min = 4, group = l, n = sum(df[[g]] == l))
}
} else if (!is.null(c3) && nrow(df) < 4) {
cs_error("CS_E_TOO_FEW_ROWS", what = "Comparing correlations", min = 4, n = nrow(df))
}
# A correlation is 0 / 0 when one of its variables is constant.
for (col in c(a, b, c3, d4)) {
if (length(unique(df[[col]])) < 2) cs_error("CS_E_CONSTANT", column = col)
}
if (!is.null(g)) {
design <- "independent"
boolean_group <- TRUE
level_1 <- if (boolean_group) sprintf("%s = %s", g, lv[1]) else lv[1]
level_2 <- if (boolean_group) sprintf("%s = %s", g, lv[2]) else lv[2]
d1 <- df[df[[g]] == lv[1], , drop = FALSE]
d2 <- df[df[[g]] == lv[2], , drop = FALSE]
n1 <- nrow(d1); n2 <- nrow(d2)
for (part in list(list(label = level_1, d = d1), list(label = level_2, d = d2))) {
for (col in c(a, b)) {
if (length(unique(part$d[[col]])) < 2) {
cs_error("CS_E_UNDEFINED", what = sprintf("The correlation of %s and %s in %s", a, b, part$label),
reason = sprintf("%s has no variation in this group", col))
}
}
}
r1 <- r_of(d1[[a]], d1[[b]]); r2 <- r_of(d2[[a]], d2[[b]])
res <- cs_cor_compare_independent(r1, n1, r2, n2, alternative = alternative, conf = conf)
allowed <- "fisher"
} else if (!is.null(c3) && is.null(d4)) {
design <- "overlapping"
r1 <- r_of(df[[a]], df[[b]]); r2 <- r_of(df[[a]], df[[c3]]); r_yz <- r_of(df[[b]], df[[c3]])
res <- cs_cor_compare_overlapping(r1, r2, r_yz, nrow(df), alternative = alternative, conf = conf)
allowed <- c("williams", "steiger", "hittner")
} else if (!is.null(c3)) {
design <- "nonoverlapping"
rr <- list(xy = r_of(df[[a]], df[[b]]), zw = r_of(df[[c3]], df[[d4]]), xz = r_of(df[[a]], df[[c3]]), xw = r_of(df[[a]], df[[d4]]),
yz = r_of(df[[b]], df[[c3]]), yw = r_of(df[[b]], df[[d4]]))
r1 <- rr$xy; r2 <- rr$zw
res <- cs_cor_compare_nonoverlapping(rr, nrow(df), alternative = alternative, conf = conf)
allowed <- "steiger"
} else {
stop("Bind Two independent groups (independent samples) or a Third variable (one sample).")
}
n <- nrow(df)
if (test == "auto") test <- allowed[1]
if (!(test %in% allowed)) stop(sprintf("The %s test does not apply to %s correlations; choose one of: %s.", test, design, paste(allowed, collapse = ", ")))
main <- Filter(function(t) t$test == test, res$tests)[[1]]
statistic <- main$statistic; dof <- main$df; p <- main$p
# %% Result
alpha <- 1 - conf
pct <- sprintf("%.0f%%", conf * 100)
first <- if (design == "independent") {
sprintf("r(%s, %s) = %.2f in %s (n = %d) and %.2f in %s (n = %d)", a, b, r1, level_1, n1, r2, level_2, n2)
} else if (design == "overlapping") {
sprintf("%s correlated r = %.2f with %s and r = %.2f with %s (n = %d; r(%s, %s) = %.2f)", a, r1, b, r2, c3, n, b, c3, r_yz)
} else {
sprintf("r(%s, %s) = %.2f and r(%s, %s) = %.2f (n = %d)", a, b, r1, c3, d4, r2, n)
}
verdict <- if (p < alpha) sprintf("The correlations differ (%s).", cs_fmt_p(p)) else sprintf("The data are compatible with equal correlations (%s).", cs_fmt_p(p))
summary <- sprintf("%s: a difference of %.2f, %s CI [%.2f, %.2f]. %s", first, res$diff, pct, res$ci_low, res$ci_high, verdict)
stat_txt <- if (!is.null(dof)) sprintf("t(%s) = %.2f", format(dof), statistic) else sprintf("z = %.2f", statistic)
apa <- sprintf("%s, %s, Δr = %s, %s CI [%s, %s], q = %.2f", stat_txt, cs_fmt_p(p), cs_fmt_num(res$diff, leading_zero = FALSE), pct,
cs_fmt_num(res$ci_low, leading_zero = FALSE), cs_fmt_num(res$ci_high, leading_zero = FALSE), res$q)
rows <- lapply(res$tests, function(t) list(test = t$label, statistic = t$statistic, df = t$df, p = t$p))
cs_publish(list(
method = "correlation.compare",
methodVersion = "1.0.1",
title = c(independent = "Comparing independent correlations", overlapping = "Comparing overlapping correlations",
nonoverlapping = "Comparing non-overlapping correlations")[[design]],
engine = cs_engine_info("stats", "nanoparquet"),
n = n,
summary = summary,
apa = apa,
statistics = list(
list(key = "r1", label = "r₁", value = r1),
list(key = "r2", label = "r₂", value = r2),
list(key = "diff", label = "r₁ − r₂", value = res$diff),
list(key = "statistic", label = if (!is.null(dof)) "t" else "z", value = statistic),
list(key = "p", label = "p", value = p, format = "p"),
list(key = "ci", label = sprintf("%s CI (Zou)", pct), value = c(res$ci_low, res$ci_high))
),
tables = list(list(key = "tests", title = "All applicable tests", columns = list(
list(key = "test", label = "Test", type = "string"), list(key = "statistic", label = "Statistic", type = "number"),
list(key = "df", label = "df", type = "number"), list(key = "p", label = "p", type = "pvalue")), rows = rows)),
effectSizes = list(list(key = "q", label = "Cohen's q", value = res$q, method = "atanh(r₁) − atanh(r₂)"),
list(key = "diff", label = "r₁ − r₂", value = res$diff, ciLow = res$ci_low, ciHigh = res$ci_high,
ciLevel = conf, method = "Zou (2007) interval")),
assumptions = list(
list(key = "normality", label = "Approximately bivariate normal data", status = "info",
detail = "Fisher-z based tests assume normal variables; check scatter plots for curvature and outliers."),
list(key = "matrix", label = "Valid correlation matrix", status = "pass",
detail = if (design != "independent") "The correlations form a valid (positive definite) correlation matrix."
else "Independent samples: each correlation comes from its own group.")
),
charts = list(),
warnings = warnings,
notes = list(sprintf("Pearson correlations; %s; alternative: %s; Zou's (2007) two-sided %s interval for r₁ − r₂.", main$label, alternative, pct)),
values = list(design = design, test = test, r1 = r1, r2 = r2, r_yz = r_yz, n = n, n1 = n1, n2 = n2, diff = res$diff,
statistic = statistic, df = dof, p = p, ci_low = res$ci_low, ci_high = res$ci_high, q = res$q,
level_1 = level_1, level_2 = level_2)
))
Sources
- Fisher, R. A. (1921). On the probable error of a coefficient of correlation deduced from a small sample. Metron, 1, 3–32.
- Williams, E. J. (1959). The comparison of regression variables. Journal of the Royal Statistical Society B, 21, 396–399.
- Steiger, J. H. (1980). Tests for comparing elements of a correlation matrix. Psychological Bulletin, 87, 245–251.
- Hittner, J. B., May, K., & Silver, N. C. (2003). A Monte Carlo evaluation of tests for comparing dependent correlations. Journal of General Psychology, 130, 149–168.
- Zou, G. Y. (2007). Toward using confidence intervals to compare correlations. Psychological Methods, 12, 399–413.
- Diedenhofen, B., & Musch, J. (2015). cocor: A comprehensive solution for the statistical comparison of correlations. PLoS ONE, 10, e0121945.
From the CodeSplash method registry · correlation.compare v1.0.1.