Posterior summary statistics for parameters of survextrap models
Source:R/print.R
summary.survextrap.RdPosterior 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 class '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
posteriorpackage.- ...
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.250 -0.238 -0.546 0.0910 0.165 1.00
#> 2 coefs 1 NA 0.00710 0.00734 0.000109 0.0382 0.0225 1.000
#> 3 coefs 2 NA 0.0175 0.0173 0.000668 0.0839 0.0263 1.00
#> 4 coefs 3 NA 0.0897 0.0783 0.0250 0.263 0.0665 1.00
#> 5 coefs 4 NA 0.119 0.106 0.0119 0.224 0.0532 1.000
#> 6 coefs 5 NA 0.114 0.0994 0.0186 0.221 0.0486 1.000
#> 7 coefs 6 NA 0.112 0.101 0.0269 0.250 0.0595 1.00
#> 8 coefs 7 NA 0.0692 0.0650 0.00445 0.205 0.0541 1.000
#> 9 coefs 8 NA 0.136 0.122 0.0346 0.298 0.0679 1.000
#> 10 coefs 9 NA 0.188 0.172 0.0422 0.375 0.0835 1.000
#> 11 coefs 10 NA 0.148 0.148 0.0397 0.372 0.0853 1.00
#> 12 loghr NA rxLev -0.384 -0.391 -0.906 0.119 0.261 1.00
#> 13 loghr NA rxLev+5FU -0.664 -0.668 -1.21 -0.130 0.280 1.00
#> 14 hr NA rxLev 0.681 0.676 0.404 1.13 0.185 1.00
#> 15 hr NA rxLev+5FU 0.515 0.513 0.299 0.878 0.152 1.00
#> 16 hsd NA NA 3.04 3.02 1.14 8.28 1.89 1.000
#> # ℹ 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.250 -0.238 -0.546 0.0910 0.165 1.00
#> 2 coefs 1 NA 0.00710 0.00734 0.000109 0.0382 0.0225 1.000
#> 3 coefs 2 NA 0.0175 0.0173 0.000668 0.0839 0.0263 1.00
#> 4 coefs 3 NA 0.0897 0.0783 0.0250 0.263 0.0665 1.00
#> 5 coefs 4 NA 0.119 0.106 0.0119 0.224 0.0532 1.000
#> 6 coefs 5 NA 0.114 0.0994 0.0186 0.221 0.0486 1.000
#> 7 coefs 6 NA 0.112 0.101 0.0269 0.250 0.0595 1.00
#> 8 coefs 7 NA 0.0692 0.0650 0.00445 0.205 0.0541 1.000
#> 9 coefs 8 NA 0.136 0.122 0.0346 0.298 0.0679 1.000
#> 10 coefs 9 NA 0.188 0.172 0.0422 0.375 0.0835 1.000
#> 11 coefs 10 NA 0.148 0.148 0.0397 0.372 0.0853 1.00
#> 12 loghr NA rxLev -0.384 -0.391 -0.906 0.119 0.261 1.00
#> 13 loghr NA rxLev+5FU -0.664 -0.668 -1.21 -0.130 0.280 1.00
#> 14 hr NA rxLev 0.681 0.676 0.404 1.13 0.185 1.00
#> 15 hr NA rxLev+5FU 0.515 0.513 0.299 0.878 0.152 1.00
#> 16 hsd NA NA 3.04 3.02 1.14 8.28 1.89 1.000
#> # ℹ 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.250 -0.239
#> 2 coefs 1 NA 0.00710 0.0108
#> 3 coefs 2 NA 0.0175 0.0229
#> 4 coefs 3 NA 0.0897 0.0954
#> 5 coefs 4 NA 0.119 0.108
#> 6 coefs 5 NA 0.114 0.105
#> 7 coefs 6 NA 0.112 0.111
#> 8 coefs 7 NA 0.0692 0.0736
#> 9 coefs 8 NA 0.136 0.133
#> 10 coefs 9 NA 0.188 0.181
#> 11 coefs 10 NA 0.148 0.160
#> 12 loghr NA rxLev -0.384 -0.392
#> 13 loghr NA rxLev+5FU -0.664 -0.668
#> 14 hr NA rxLev 0.681 0.699
#> 15 hr NA rxLev+5FU 0.515 0.533
#> 16 hsd NA NA 3.04 3.46
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.250 -0.239 1637.
#> 2 coefs 1 NA 0.00710 0.0108 1876.
#> 3 coefs 2 NA 0.0175 0.0229 1670.
#> 4 coefs 3 NA 0.0897 0.0954 2043.
#> 5 coefs 4 NA 0.119 0.108 1848.
#> 6 coefs 5 NA 0.114 0.105 1727.
#> 7 coefs 6 NA 0.112 0.111 1971.
#> 8 coefs 7 NA 0.0692 0.0736 1938.
#> 9 coefs 8 NA 0.136 0.133 1713.
#> 10 coefs 9 NA 0.188 0.181 1856.
#> 11 coefs 10 NA 0.148 0.160 1810.
#> 12 loghr NA rxLev -0.384 -0.392 1881.
#> 13 loghr NA rxLev+5FU -0.664 -0.668 1866.
#> 14 hr NA rxLev 0.681 0.699 1881.
#> 15 hr NA rxLev+5FU 0.515 0.533 1866.
#> 16 hsd NA NA 3.04 3.46 1711.
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.250 -0.238 -0.546 0.0910 0.165 1.00
#> 2 coefs 1 NA 0.00710 0.00734 0.000109 0.0382 0.0225 1.000
#> 3 coefs 2 NA 0.0175 0.0173 0.000668 0.0839 0.0263 1.00
#> 4 coefs 3 NA 0.0897 0.0783 0.0250 0.263 0.0665 1.00
#> 5 coefs 4 NA 0.119 0.106 0.0119 0.224 0.0532 1.000
#> 6 coefs 5 NA 0.114 0.0994 0.0186 0.221 0.0486 1.000
#> 7 coefs 6 NA 0.112 0.101 0.0269 0.250 0.0595 1.00
#> 8 coefs 7 NA 0.0692 0.0650 0.00445 0.205 0.0541 1.000
#> 9 coefs 8 NA 0.136 0.122 0.0346 0.298 0.0679 1.000
#> 10 coefs 9 NA 0.188 0.172 0.0422 0.375 0.0835 1.000
#> 11 coefs 10 NA 0.148 0.148 0.0397 0.372 0.0853 1.00
#> 12 loghr NA rxLev -0.384 -0.391 -0.906 0.119 0.261 1.00
#> 13 loghr NA rxLev+5FU -0.664 -0.668 -1.21 -0.130 0.280 1.00
#> 14 hr NA rxLev 0.681 0.676 0.404 1.13 0.185 1.00
#> 15 hr NA rxLev+5FU 0.515 0.513 0.299 0.878 0.152 1.00
#> 16 hsd NA NA 3.04 3.02 1.14 8.28 1.89 1.000
#> # ℹ 3 more variables: ess_bulk <dbl>, mean <dbl>, ess_tail <dbl>