Skip to contents

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.255   -0.253    -5.84e-1  0.0678 0.162   1.00
#>  2 coefs            1 NA         0.00855  0.00731   5.05e-5  0.0336 0.0124  1.00
#>  3 coefs            2 NA         0.00413  0.00406   1.09e-6  0.468  0.124   1.00
#>  4 coefs            3 NA         0.129    0.0988    4.02e-3  0.227  0.0599  1.00
#>  5 coefs            4 NA         0.0865   0.0711    1.39e-3  0.362  0.0904  1.00
#>  6 coefs            5 NA         0.122    0.0935    2.99e-3  0.245  0.0628  1.00
#>  7 coefs            6 NA         0.140    0.115     4.36e-3  0.307  0.0815  1.00
#>  8 coefs            7 NA         0.0214   0.0195    3.53e-6  0.855  0.199   1.00
#>  9 coefs            8 NA         0.160    0.132     4.78e-3  0.310  0.0744  1.00
#> 10 coefs            9 NA         0.186    0.153     7.74e-3  0.347  0.0857  1.00
#> 11 coefs           10 NA         0.142    0.133     7.79e-3  0.379  0.0986  1.00
#> 12 loghr           NA rxLev     -0.383   -0.389    -9.18e-1  0.115  0.261   1.00
#> 13 loghr           NA rxLev+5FU -0.662   -0.649    -1.22e+0 -0.130  0.279   1.00
#> 14 hr              NA rxLev      0.682    0.678     3.99e-1  1.12   0.185   1.00
#> 15 hr              NA rxLev+5FU  0.516    0.522     2.95e-1  0.878  0.151   1.00
#> 16 hsd             NA NA         2.46     2.47      8.90e-1  6.91   1.62    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.255   -0.253    -5.84e-1  0.0678 0.162   1.00
#>  2 coefs            1 NA         0.00855  0.00731   5.05e-5  0.0336 0.0124  1.00
#>  3 coefs            2 NA         0.00413  0.00406   1.09e-6  0.468  0.124   1.00
#>  4 coefs            3 NA         0.129    0.0988    4.02e-3  0.227  0.0599  1.00
#>  5 coefs            4 NA         0.0865   0.0711    1.39e-3  0.362  0.0904  1.00
#>  6 coefs            5 NA         0.122    0.0935    2.99e-3  0.245  0.0628  1.00
#>  7 coefs            6 NA         0.140    0.115     4.36e-3  0.307  0.0815  1.00
#>  8 coefs            7 NA         0.0214   0.0195    3.53e-6  0.855  0.199   1.00
#>  9 coefs            8 NA         0.160    0.132     4.78e-3  0.310  0.0744  1.00
#> 10 coefs            9 NA         0.186    0.153     7.74e-3  0.347  0.0857  1.00
#> 11 coefs           10 NA         0.142    0.133     7.79e-3  0.379  0.0986  1.00
#> 12 loghr           NA rxLev     -0.383   -0.389    -9.18e-1  0.115  0.261   1.00
#> 13 loghr           NA rxLev+5FU -0.662   -0.649    -1.22e+0 -0.130  0.279   1.00
#> 14 hr              NA rxLev      0.682    0.678     3.99e-1  1.12   0.185   1.00
#> 15 hr              NA rxLev+5FU  0.516    0.522     2.95e-1  0.878  0.151   1.00
#> 16 hsd             NA NA         2.46     2.47      8.90e-1  6.91   1.62    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.255   -0.255 
#>  2 coefs            1 NA         0.00855  0.0101
#>  3 coefs            2 NA         0.00413  0.0397
#>  4 coefs            3 NA         0.129    0.102 
#>  5 coefs            4 NA         0.0865   0.0924
#>  6 coefs            5 NA         0.122    0.0993
#>  7 coefs            6 NA         0.140    0.123 
#>  8 coefs            7 NA         0.0214   0.0993
#>  9 coefs            8 NA         0.160    0.135 
#> 10 coefs            9 NA         0.186    0.154 
#> 11 coefs           10 NA         0.142    0.144 
#> 12 loghr           NA rxLev     -0.383   -0.393 
#> 13 loghr           NA rxLev+5FU -0.662   -0.658 
#> 14 hr              NA rxLev      0.682    0.698 
#> 15 hr              NA rxLev+5FU  0.516    0.538 
#> 16 hsd             NA NA         2.46     2.86  
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.255   -0.255     1847.
#>  2 coefs            1 NA         0.00855  0.0101    1706.
#>  3 coefs            2 NA         0.00413  0.0397    1882.
#>  4 coefs            3 NA         0.129    0.102     1942.
#>  5 coefs            4 NA         0.0865   0.0924    1962.
#>  6 coefs            5 NA         0.122    0.0993    1993.
#>  7 coefs            6 NA         0.140    0.123     1951.
#>  8 coefs            7 NA         0.0214   0.0993    1892.
#>  9 coefs            8 NA         0.160    0.135     1845.
#> 10 coefs            9 NA         0.186    0.154     1617.
#> 11 coefs           10 NA         0.142    0.144     1871.
#> 12 loghr           NA rxLev     -0.383   -0.393     2007.
#> 13 loghr           NA rxLev+5FU -0.662   -0.658     1992.
#> 14 hr              NA rxLev      0.682    0.698     2007.
#> 15 hr              NA rxLev+5FU  0.516    0.538     1992.
#> 16 hsd             NA NA         2.46     2.86      1889.
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.255   -0.253    -5.84e-1  0.0678 0.162   1.00
#>  2 coefs            1 NA         0.00855  0.00731   5.05e-5  0.0336 0.0124  1.00
#>  3 coefs            2 NA         0.00413  0.00406   1.09e-6  0.468  0.124   1.00
#>  4 coefs            3 NA         0.129    0.0988    4.02e-3  0.227  0.0599  1.00
#>  5 coefs            4 NA         0.0865   0.0711    1.39e-3  0.362  0.0904  1.00
#>  6 coefs            5 NA         0.122    0.0935    2.99e-3  0.245  0.0628  1.00
#>  7 coefs            6 NA         0.140    0.115     4.36e-3  0.307  0.0815  1.00
#>  8 coefs            7 NA         0.0214   0.0195    3.53e-6  0.855  0.199   1.00
#>  9 coefs            8 NA         0.160    0.132     4.78e-3  0.310  0.0744  1.00
#> 10 coefs            9 NA         0.186    0.153     7.74e-3  0.347  0.0857  1.00
#> 11 coefs           10 NA         0.142    0.133     7.79e-3  0.379  0.0986  1.00
#> 12 loghr           NA rxLev     -0.383   -0.389    -9.18e-1  0.115  0.261   1.00
#> 13 loghr           NA rxLev+5FU -0.662   -0.649    -1.22e+0 -0.130  0.279   1.00
#> 14 hr              NA rxLev      0.682    0.678     3.99e-1  1.12   0.185   1.00
#> 15 hr              NA rxLev+5FU  0.516    0.522     2.95e-1  0.878  0.151   1.00
#> 16 hsd             NA NA         2.46     2.47      8.90e-1  6.91   1.62    1.00
#> # ℹ 3 more variables: ess_bulk <dbl>, mean <dbl>, ess_tail <dbl>