| plot_pvalue_profile | R Documentation |
Draws the signed -\log_{10} per-interval hypergeometric p-value profile,
with bars above the axis marking excess events in group B and bars below
marking excess in group A. Intervals flagged by the Higher Criticism threshold
are highlighted, giving a visual reading of which windows of the follow-up
drive a detection.
plot_pvalue_profile(durations_A, ...)
## Default S3 method:
plot_pvalue_profile(
durations_A,
durations_B,
event_observed_A = NULL,
event_observed_B = NULL,
gamma = 0.2,
hc_version = c("dj2008", "dj2004", "beta", "star"),
t_0 = -1,
n_intervals_to_pool = NULL,
col_flagged = "firebrick",
col_plain = "steelblue",
xlab = "Time",
ylab = "signed -log10(p)",
main = NULL,
...
)
## S3 method for class 'formula'
plot_pvalue_profile(formula, data, subset, na.action, ...)
durations_A, durations_B |
Numeric vectors of event or censoring times.
|
event_observed_A, event_observed_B |
Optional 0/1 vectors, 1 indicating an observed event and 0 a censored observation. Default: all events. |
gamma |
Fraction of the smallest ordered p-values scanned, in (0, 1]. Default 0.2. |
hc_version |
Which Higher Criticism variant to use, matching the named
methods of the Python package |
t_0 |
Restrict the analysis to events at or before |
n_intervals_to_pool |
Number of equal-width intervals to pool event times
into. Strongly recommended for continuous survival data, where each distinct
time carries at most one event and the per-time hypergeometric p-values are too
coarse to be informative. Values between 50 and 200 usually work well.
|
col_flagged |
Colour for intervals at or below the HC threshold. |
col_plain |
Colour for the remaining intervals. |
xlab, ylab, main |
Standard graphical parameters. |
formula |
A two-sided formula |
data |
An optional data frame, list or environment holding the variables
named in |
subset |
An optional vector specifying a subset of observations to use. |
na.action |
A function describing what should happen when the data contain
|
... |
Further arguments passed to |
Two interfaces are available and return the same numbers. The default method
takes the two samples as vectors, mirroring the Python package
lifelines-hc. The formula method takes the usual survival formula
Surv(time, status) ~ group, which needs the survival package for
Surv itself; without it, cbind(time, status) ~ group and
time ~ group also work, the latter treating every observation as an
event.
The grouping variable must take exactly two values. Its first level is group A
and its second is group B, so alternative = "greater" tests for excess
hazard in the second level. Levels are taken in factor order for a factor, and
otherwise in the order sort(unique(.)) gives: numerically for numbers,
alphabetically for strings.
The two interfaces differ only in their treatment of missing values. The
default method rejects NA durations; the formula method applies
na.action, which by default drops incomplete rows.
Invisibly, the data frame returned by suspected_deviations with
alternative = "both".
Kipnis, A., Galili, B. and Yakhini, Z. (2026). Higher criticism for rare and weak non-proportional hazard deviations in survival analysis. Biometrika 113(1), asaf075. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/biomet/asaf075")}
Kipnis, A., Galili, B. and Yakhini, Z. (2026). lifelines-hc: Higher
Criticism testing for sparse non-proportional hazard departures in Python.
\Sexpr[results=rd]{tools:::Rd_expr_doi("10.48550/arXiv.2610.07268")}
suspected_deviations
set.seed(1)
T_A <- rexp(300, 1 / 10)
T_B <- c(rexp(250, 1 / 10), rexp(50, 1 / 2))
plot_pvalue_profile(T_A, T_B, n_intervals_to_pool = 50)
# the same plot through the formula interface
trial <- data.frame(time = c(T_A, T_B), status = 1,
arm = rep(c("A", "B"), c(300, 300)))
plot_pvalue_profile(cbind(time, status) ~ arm, data = trial,
n_intervals_to_pool = 50)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.