One interface over the established survival stack. method selects an
estimator from the registry (sest_methods()); the appropriate backend is
checked, a small-sample power gate runs (sest_power()), and the fit is
returned as a single typed object (sest_fit) with consistent print,
summary, coef, vcov, predict and tidy() methods.
Usage
survestimand(
formula,
data,
method = "cox",
...,
check_power = TRUE,
warn_underpowered = TRUE,
on_underpowered = c("warn", "abstain")
)Arguments
- formula
A model formula, e.g.
survival::Surv(time, status) ~ x.- data
A data frame.
- method
Character registry key (default
"cox"); seesest_methods().- ...
Passed to the backend estimator.
weights,id,cluster,istateandsubsetare read as the backend reads them: a bare name or expression is evaluated indata, and a vector is used as given.subsetis applied todatabefore the power gate, so the counts describe the rows fitted.fine_grayrefuses the four row arguments.- check_power
Logical; run the events-per-variable gate (default
TRUE).- warn_underpowered
Logical; warn when the gate flags the model under-powered (default
TRUE). Ignored whenon_underpowered = "abstain".- on_underpowered
One of
"warn"(default) or"abstain". With"warn"the model is fitted, with a warning whenwarn_underpoweredisTRUE. With"abstain"a model the gate flags under-powered is not fitted, and asest_refusal()is returned instead.
Value
A sest_fit object, or a sest_refusal() when
on_underpowered = "abstain" and the power gate is not satisfied.
Details
The left-hand side of formula is a survival::Surv() response. Extra
arguments in ... pass to the backend estimator.
See also
sest_methods() for the registry, sest_power() for the gate.
Other model-fitting:
is_sest_refusal(),
sest_cuminc(),
sest_ic(),
sest_power(),
sest_refusal(),
sest_rmst(),
sest_score(),
sest_stack()
Examples
fit <- survestimand(survival::Surv(time, status) ~ age + sex, survival::lung)
fit
#> <sest_fit> method = cox (cox, via survival)
#> n = 228 events = 165
#> power: ok (82.5 events/predictor)
#> coefficients:
#> age sex
#> 0.0170 -0.5132
coef(fit)
#> age sex
#> 0.01704533 -0.51321852
if (requireNamespace("flexsurv", quietly = TRUE)) {
survestimand(survival::Surv(time, status) ~ age + sex, survival::lung,
method = "weibull")
}
#> <sest_fit> method = weibull (parametric, via flexsurv)
#> n = 228 events = 165
#> power: ok (82.5 events/predictor)
#> coefficients:
#> shape scale age sex
#> 0.2823 6.2749 -0.0123 0.3821
