Skip to contents

Construct the typed "will not fit" token survestimand() returns when on_underpowered = "abstain" and the events-per-variable gate (sest_power()) flags the model as under-powered. Not signalled as a condition – returned as an ordinary value, so a caller inspects it with is_sest_refusal() and needs no tryCatch().

Usage

sest_refusal(power)

Arguments

power

A power-gate result from sest_power(), already flagged underpowered.

Value

A classed list with class c("sest_refusal_underpowered", "sest_refusal", "orchestra_refusal", "error", "condition") and elements reason, n, n_events, n_predictors, events_per_variable, min_epv, underpowered (always TRUE), message.

Reason codes

Every refusal carries a reason. The value this function returns has reason = "underpowered". The other refusals are signalled as errors of class sest_refusal_<reason> and sest_refusal, so a caller can catch one reason, for example tryCatch(expr, sest_refusal_no_events = function(e) NULL).

ReasonRaised when
underpoweredthe events-per-variable gate flags the model
bad_argumentan argument has the wrong type, length or range
bad_responsethe response is not a survival::Surv() object of the type the function takes, or its times are infinite or negative
no_datadata has no complete rows
no_eventsthe response has no events
not_estimableno coefficient of the model can be estimated
unknown_methodthe method is not in the registry (sest_methods())
backend_missingthe package the method needs is not installed
backend_errorthe backend stopped; the message carries its error
not_supportedthe function does not answer for this kind of fit or option
not_coxsest_ph_check() was given a fit that is not method = "cox"
no_coefficientsthe fit has no coefficients to draw from
no_covariancethe fit has no usable covariance matrix to draw from
arm_not_in_modelthe arm is not a term of the formula
horizon_beyond_datathe horizon is past the last observed time in an arm
empty_windowa window of sest_ph_check() has no events
one_groupthe log-rank test was given a single group
singular_variancea log-rank group has no events at risk
rank_deficientthe pseudo-observation design matrix is rank deficient
bootstrap_faileda bootstrap refit failed; the message gives the first error
different_datasest_ic() was given fits on different numbers of rows
name_clashdata already has a column sest_stack() adds
truth_routes_disagreesest_simulate()'s exact and Monte Carlo truths disagree

Examples

set.seed(1)
df <- data.frame(time = rexp(20), status = rbinom(20, 1, 0.2),
                 x1 = rnorm(20), x2 = rnorm(20))
p <- sest_power(survival::Surv(time, status) ~ x1 + x2, df)
r <- sest_refusal(p)
is_sest_refusal(r)
#> [1] TRUE