svgcombine-compare
Combination methods compared
Would other combination methods have reached a different answer on these p-values?
How to read it
- Read each bar as one method's combined p-value, on a scale where longer means smaller.
- Find the highlighted method: the one you fixed in advance.
- If the methods disagree, say so: they are sensitive to different patterns of evidence.
Watch out
- This is a sensitivity check. Picking the method with the smallest p after looking is p-hacking.
Defaults
- Reference p
- 0.05
- Draws a reference line. The conclusion rests on the method fixed in advance.
- Range 0.001 to 0.2, step 0.005
Pinned in the code
- Rows keep the engine's order; only the method fixed before results counts as the test.
- Draws the meta-analysis engine's numbers as given (codesplash.stats.meta in Python ≡ codesplashr in R); the chart computes nothing statistical.
# Combination methods compared — Codesplash Chart Lab (recipe "combine-compare")
# controls: alpha=0.05
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
try:
import codesplash as cs # optional: the app's chart theme
except ImportError:
cs = None
if cs:
cs.use_codesplash(dark=False)
PALETTE = cs.palette(dark=False)["categorical"] if cs else plt.rcParams["axes.prop_cycle"].by_key()["color"]
df = pd.read_csv("combine-compare-demo.csv", keep_default_na=False, na_values=[""]) # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
_tokens = cs.palette(dark=False) if cs else {}
SEQ = _tokens.get("sequential", ["#eff6fd", "#1a469d"]) # sequential ramp (low → high)
DIV = _tokens.get("diverging", ["#c13e2e", "#f3f5f8", "#0859ac"]) # negative, midpoint, positive
REF = _tokens.get("reference", "#4e5661")
GREY = _tokens.get("dim", "#ced1d6")
METHOD = "method"
P = "p"
CHOSEN = "chosen"
ALPHA = 0.05
d = df.dropna(subset=[METHOD, P]).reset_index(drop=True)
d["_chosen"] = d[CHOSEN].astype(str).eq("chosen") if CHOSEN else False
d["_sig"] = -np.log10(d[P].clip(lower=1e-300))
y = np.arange(len(d))[::-1] # the app's order: the rows as given
fig, ax = plt.subplots(figsize=(7.5, max(3, 0.34 * len(d) + 1.2)))
ax.axvline(-np.log10(ALPHA), color=REF, linestyle="--", linewidth=1, label=f"p = {ALPHA:g}")
ax.hlines(y, 0, d["_sig"], color=GREY, linewidth=1.2)
ax.scatter(d["_sig"], y, s=[60 if x else 30 for x in d["_chosen"]], c=[PALETTE[0] if x else REF for x in d["_chosen"]], zorder=3)
ax.set_yticks(y, d[METHOD].astype(str))
ax.set_xlabel("−log10 p (the highlighted method was fixed in advance)")
ax.legend(fontsize=8, loc="lower right")
fig.tight_layout()
plt.show()Needs pandas, numpy, matplotlib · reads combine-compare-demo.csv · app theme from the optional codesplash helper
# Combination methods compared — Codesplash Chart Lab (recipe "combine-compare")
# controls: alpha=0.05
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
try:
import codesplash as cs # optional: the app's chart theme
except ImportError:
cs = None
if cs:
cs.use_codesplash(dark=False)
PALETTE = cs.palette(dark=False)["categorical"] if cs else px.colors.qualitative.Plotly
df = pd.read_csv("combine-compare-demo.csv", keep_default_na=False, na_values=[""]) # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
_tokens = cs.palette(dark=False) if cs else {}
SEQ = _tokens.get("sequential", ["#eff6fd", "#1a469d"]) # sequential ramp (low → high)
DIV = _tokens.get("diverging", ["#c13e2e", "#f3f5f8", "#0859ac"]) # negative, midpoint, positive
REF = _tokens.get("reference", "#4e5661")
GREY = _tokens.get("dim", "#ced1d6")
METHOD = "method"
P = "p"
CHOSEN = "chosen"
ALPHA = 0.05
d = df.dropna(subset=[METHOD, P]).reset_index(drop=True)
d["_chosen"] = d[CHOSEN].astype(str).eq("chosen") if CHOSEN else False
d["_sig"] = -np.log10(d[P].clip(lower=1e-300))
labels = d[METHOD].astype(str)
fig = go.Figure(go.Scatter(x=d["_sig"], y=labels, mode="markers", text=[f"p = {v:.3g}" for v in d[P]],
marker=dict(size=[13 if x else 8 for x in d["_chosen"]], color=[PALETTE[0] if x else REF for x in d["_chosen"]])))
fig.add_vline(x=-np.log10(ALPHA), line=dict(color=REF, dash="dash", width=1))
fig.update_yaxes(categoryorder="array", categoryarray=list(labels)[::-1])
fig.update_layout(xaxis_title="−log10 p (the highlighted method was fixed in advance)")
fig.show()Needs pandas, numpy, plotly · reads combine-compare-demo.csv · app theme from the optional codesplash helper
# Combination methods compared — Codesplash Chart Lab (recipe "combine-compare")
# controls: alpha=0.05
library(ggplot2)
has_cs <- isTRUE(requireNamespace("codesplashr", quietly = TRUE)) # optional: the app's chart theme
theme_cs <- if (has_cs) codesplashr::theme_codesplash(dark = FALSE) else theme_minimal()
cs_cat <- if (has_cs) codesplashr::cs_palette(dark = FALSE)$categorical else grDevices::palette.colors(8, "Okabe-Ito")
if (has_cs) update_geom_defaults("text", list(colour = codesplashr::cs_palette(dark = FALSE)$foreground))
df <- read.csv("combine-compare-demo.csv", check.names = FALSE, stringsAsFactors = FALSE, na.strings = "") # empty cells are missing; Chart Lab → Code → Download demo CSV
df[["method"]] <- factor(df[["method"]])
df[["chosen"]] <- factor(df[["chosen"]])
tok <- if (has_cs) codesplashr::cs_palette(dark = FALSE) else list()
seq_ramp <- if (is.null(tok$sequential)) c("#eff6fd", "#1a469d") else tok$sequential # low → high
div_ramp <- if (is.null(tok$diverging)) c("#c13e2e", "#f3f5f8", "#0859ac") else tok$diverging # −, 0, +
ref_col <- if (is.null(tok$reference)) "#4e5661" else tok$reference
grey_col <- if (is.null(tok$dim)) "#ced1d6" else tok$dim
method_col <- "method"
p_col <- "p"
chosen_col <- "chosen"
alpha_level <- 0.05
d <- df[!is.na(df[[method_col]]) & !is.na(df[[p_col]]), ]
d$method <- factor(as.character(d[[method_col]]), levels = rev(unique(as.character(d[[method_col]]))))
d$chosen <- if (is.null(chosen_col)) FALSE else as.character(d[[chosen_col]]) == "chosen"
d$sig <- -log10(pmax(d[[p_col]], 1e-300))
p <- ggplot(d, aes(sig, method)) +
geom_vline(xintercept = -log10(alpha_level), colour = ref_col, linetype = "dashed") +
geom_segment(aes(x = 0, xend = sig, yend = method), colour = grey_col) +
geom_point(aes(colour = chosen, size = chosen)) +
scale_colour_manual(values = c("FALSE" = ref_col, "TRUE" = cs_cat[1]), guide = "none") +
scale_size_manual(values = c("FALSE" = 1.8, "TRUE" = 3.2), guide = "none") +
labs(x = "−log10 p (the highlighted method was fixed in advance)", y = NULL) + theme_cs
print(p)Needs ggplot2 · reads combine-compare-demo.csv · app theme from the optional codesplashr helper