Posterior summary statistics for parameters of survextrap models
Source:R/print.R
summary.survextrap.Rd
Posterior summary statistics for parameters of
survextrap models. The summary statistics presented by default
include the posterior median and 95% credible intervals,
alongside the Rhat convergence diagnostic and the bulk effective
sample size (as computed by the posterior
package). For
models fitted by optimisation rather than MCMC, the posterior
mode is always returned.
Any other posterior summary can be computed if the appropriate
function to compute it is supplied in summ_fns
.
Usage
# S3 method for survextrap
summary(object, summ_fns = NULL, ...)
Arguments
- object
A fitted model object as returned by
survextrap
- summ_fns
A list of functions to calculate different posterior summaries from the MCMC sample. This is passed to
posterior::summarise_draws
. If the list is named, then the names will be used for the columns of the output.See the examples below for different ways this can be used.
Defaults to
list(median = median, ~quantile(.x, probs=c(0.025, 0.975)), sd = sd, rhat = posterior::rhat, ess_bulk = posterior::ess_bulk)
Many useful such functions are provided with the
posterior
package.- ...
Summary functions can also be supplied in separate arguments here. They will then be added to those supplied in
summ_fns
.
Value
A data frame (actually a tibble
) of summary
statistics for the model parameters.
The parameters, as indicated in the variable
column, are:
alpha
: Baseline log hazard scale. If there are covariates, this
describes the log hazard scale with continuous covariates set to
zero, and factor covariates set to their baseline levels. Note
that this is not the log hazard, which also depends on the spline
coefficients and basis. See hazard
to extract the
actual hazard.
coefs
: Coefficients of the M-spline basis terms. If a
non-proportional hazards model was fitted, these are with
covariates set to zero or baseline levels.
loghr
: Log hazard ratios for each covariate in the model. For
cure models, this refers to covariates on survival for uncured
people. For non-proportional hazards models, these are the
multiplicative effects of covariates on the hazard scale
parameter. See the methods vignette
for a full description of this model.
hr
: Hazard ratios (the exponentials of loghr
).
pcure
: Probability of cure (for cure models only). If there are
covariates on cure, this parameter describes the probability of
cure with continuous covariates set to zero, and factor covariates
set to their baseline levels.
logor_cure
: Log odds ratio of cure for each covariate on cure.
or_cure
: Odds ratios of cure (the exponentials of logor_cure
).
nperr
: Standardised departures from proportional hazards in the
non-proportional hazards model, defined as \(b^{(np)}_{ks} /
\sigma^{(np)}_s\) (see the methods vignette
for definitions of these).
hrsd
: Smoothness standard deviations \(\tau_s\) for the
non-proportionality effects.
Examples
mod <- survextrap(Surv(years, status) ~ rx, data=colons, fit_method="opt")
summary(mod)
#> # A tibble: 16 × 10
#> variable basis_num term mode median lower upper sd rhat
#> <chr> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 alpha NA NA -0.254 -0.253 -5.75e-1 0.0747 0.164 1.00
#> 2 coefs 1 NA 0.00855 0.00728 3.72e-5 0.0318 0.0102 1.00
#> 3 coefs 2 NA 0.00413 0.00533 2.48e-7 0.494 0.136 1.00
#> 4 coefs 3 NA 0.129 0.0984 1.76e-3 0.245 0.0596 1.00
#> 5 coefs 4 NA 0.0864 0.0687 1.25e-3 0.379 0.0976 1.00
#> 6 coefs 5 NA 0.123 0.0942 1.50e-3 0.242 0.0637 1.00
#> 7 coefs 6 NA 0.140 0.114 1.75e-3 0.298 0.0742 1.00
#> 8 coefs 7 NA 0.0214 0.0238 2.71e-6 0.852 0.210 1.00
#> 9 coefs 8 NA 0.160 0.130 2.88e-3 0.292 0.0722 1.00
#> 10 coefs 9 NA 0.186 0.156 5.24e-3 0.351 0.0844 1.00
#> 11 coefs 10 NA 0.142 0.129 7.25e-3 0.309 0.0957 1.00
#> 12 loghr NA rxLev -0.383 -0.381 -8.99e-1 0.120 0.256 1.00
#> 13 loghr NA rxLev+5FU -0.662 -0.662 -1.20e+0 -0.122 0.279 1.00
#> 14 hr NA rxLev 0.682 0.683 4.07e-1 1.13 0.185 1.00
#> 15 hr NA rxLev+5FU 0.516 0.516 3.02e-1 0.886 0.152 1.00
#> 16 hsd NA NA 2.47 2.47 8.67e-1 7.45 1.70 1.00
#> # ℹ 1 more variable: ess_bulk <dbl>
summary(mod, mean=mean)
#> # A tibble: 16 × 11
#> variable basis_num term mode median lower upper sd rhat
#> <chr> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 alpha NA NA -0.254 -0.253 -5.75e-1 0.0747 0.164 1.00
#> 2 coefs 1 NA 0.00855 0.00728 3.72e-5 0.0318 0.0102 1.00
#> 3 coefs 2 NA 0.00413 0.00533 2.48e-7 0.494 0.136 1.00
#> 4 coefs 3 NA 0.129 0.0984 1.76e-3 0.245 0.0596 1.00
#> 5 coefs 4 NA 0.0864 0.0687 1.25e-3 0.379 0.0976 1.00
#> 6 coefs 5 NA 0.123 0.0942 1.50e-3 0.242 0.0637 1.00
#> 7 coefs 6 NA 0.140 0.114 1.75e-3 0.298 0.0742 1.00
#> 8 coefs 7 NA 0.0214 0.0238 2.71e-6 0.852 0.210 1.00
#> 9 coefs 8 NA 0.160 0.130 2.88e-3 0.292 0.0722 1.00
#> 10 coefs 9 NA 0.186 0.156 5.24e-3 0.351 0.0844 1.00
#> 11 coefs 10 NA 0.142 0.129 7.25e-3 0.309 0.0957 1.00
#> 12 loghr NA rxLev -0.383 -0.381 -8.99e-1 0.120 0.256 1.00
#> 13 loghr NA rxLev+5FU -0.662 -0.662 -1.20e+0 -0.122 0.279 1.00
#> 14 hr NA rxLev 0.682 0.683 4.07e-1 1.13 0.185 1.00
#> 15 hr NA rxLev+5FU 0.516 0.516 3.02e-1 0.886 0.152 1.00
#> 16 hsd NA NA 2.47 2.47 8.67e-1 7.45 1.70 1.00
#> # ℹ 2 more variables: ess_bulk <dbl>, mean <dbl>
summary(mod, list(mean=mean))
#> # A tibble: 16 × 5
#> variable basis_num term mode mean
#> <chr> <dbl> <chr> <dbl> <dbl>
#> 1 alpha NA NA -0.254 -0.254
#> 2 coefs 1 NA 0.00855 0.00982
#> 3 coefs 2 NA 0.00413 0.0443
#> 4 coefs 3 NA 0.129 0.102
#> 5 coefs 4 NA 0.0864 0.0917
#> 6 coefs 5 NA 0.123 0.0986
#> 7 coefs 6 NA 0.140 0.119
#> 8 coefs 7 NA 0.0214 0.110
#> 9 coefs 8 NA 0.160 0.131
#> 10 coefs 9 NA 0.186 0.156
#> 11 coefs 10 NA 0.142 0.138
#> 12 loghr NA rxLev -0.383 -0.383
#> 13 loghr NA rxLev+5FU -0.662 -0.662
#> 14 hr NA rxLev 0.682 0.705
#> 15 hr NA rxLev+5FU 0.516 0.536
#> 16 hsd NA NA 2.47 2.87
summary(mod, list(mean=mean, ess_tail=posterior::ess_tail))
#> # A tibble: 16 × 6
#> variable basis_num term mode mean ess_tail
#> <chr> <dbl> <chr> <dbl> <dbl> <dbl>
#> 1 alpha NA NA -0.254 -0.254 1893.
#> 2 coefs 1 NA 0.00855 0.00982 1880.
#> 3 coefs 2 NA 0.00413 0.0443 1737.
#> 4 coefs 3 NA 0.129 0.102 1845.
#> 5 coefs 4 NA 0.0864 0.0917 1733.
#> 6 coefs 5 NA 0.123 0.0986 1822.
#> 7 coefs 6 NA 0.140 0.119 1885.
#> 8 coefs 7 NA 0.0214 0.110 1811.
#> 9 coefs 8 NA 0.160 0.131 1965.
#> 10 coefs 9 NA 0.186 0.156 1713.
#> 11 coefs 10 NA 0.142 0.138 1920.
#> 12 loghr NA rxLev -0.383 -0.383 1729.
#> 13 loghr NA rxLev+5FU -0.662 -0.662 1806.
#> 14 hr NA rxLev 0.682 0.705 1729.
#> 15 hr NA rxLev+5FU 0.516 0.536 1806.
#> 16 hsd NA NA 2.47 2.87 1587.
summary(mod, mean=mean, ess_tail=posterior::ess_tail)
#> # A tibble: 16 × 12
#> variable basis_num term mode median lower upper sd rhat
#> <chr> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 alpha NA NA -0.254 -0.253 -5.75e-1 0.0747 0.164 1.00
#> 2 coefs 1 NA 0.00855 0.00728 3.72e-5 0.0318 0.0102 1.00
#> 3 coefs 2 NA 0.00413 0.00533 2.48e-7 0.494 0.136 1.00
#> 4 coefs 3 NA 0.129 0.0984 1.76e-3 0.245 0.0596 1.00
#> 5 coefs 4 NA 0.0864 0.0687 1.25e-3 0.379 0.0976 1.00
#> 6 coefs 5 NA 0.123 0.0942 1.50e-3 0.242 0.0637 1.00
#> 7 coefs 6 NA 0.140 0.114 1.75e-3 0.298 0.0742 1.00
#> 8 coefs 7 NA 0.0214 0.0238 2.71e-6 0.852 0.210 1.00
#> 9 coefs 8 NA 0.160 0.130 2.88e-3 0.292 0.0722 1.00
#> 10 coefs 9 NA 0.186 0.156 5.24e-3 0.351 0.0844 1.00
#> 11 coefs 10 NA 0.142 0.129 7.25e-3 0.309 0.0957 1.00
#> 12 loghr NA rxLev -0.383 -0.381 -8.99e-1 0.120 0.256 1.00
#> 13 loghr NA rxLev+5FU -0.662 -0.662 -1.20e+0 -0.122 0.279 1.00
#> 14 hr NA rxLev 0.682 0.683 4.07e-1 1.13 0.185 1.00
#> 15 hr NA rxLev+5FU 0.516 0.516 3.02e-1 0.886 0.152 1.00
#> 16 hsd NA NA 2.47 2.47 8.67e-1 7.45 1.70 1.00
#> # ℹ 3 more variables: ess_bulk <dbl>, mean <dbl>, ess_tail <dbl>