R: Tidy a flexsurv model object

tidy.flexsurvreg {flexsurv} | R Documentation

## Tidy a flexsurv model object

### Description

Tidy summarizes information about the components of the model into a tidy data frame.

### Usage

    ## S3 method for class 'flexsurvreg'
    tidy(
      x,
      conf.int = FALSE,
      conf.level = 0.95,
      pars = "all",
      transform = "none",
      ...
    )

### Arguments

`x` | Output from `flexsurvreg` or `flexsurvspline`, representing a fitted survival model object.
`conf.int` | Logical. Should confidence intervals be returned? Default is `FALSE`.
`conf.level` | The confidence level to use for the confidence interval if `conf.int = TRUE`. Default is `0.95`.
`pars` | Character vector for one of `"all"`, `"coefs"`, or `"baseline"` for all parameters, covariate effects (i.e. regression betas), or baseline distribution paramaters, respectively. Default is `"all"`.
`transform` | Character vector of transformations to apply to requested `pars`. Default is `"none"`, which returns `pars` as-is. Users can specify one or both types of transformations: `"baseline.real"` which transforms the baseline distribution parameters to the real number line used for estimation. `"coefs.exp"` which exponentiates the covariate effects. See `Details` for a more complete explanation.
`...` | Not currently used.

### Details

`flexsurvreg` models estimate two types of coefficients, baseline distribution parameters, and covariate effects which act on the baseline distribution. By design, `flexsurvreg` returns distribution parameters on the same scale as is found in the relevant `d/p/q/r` functions. Covariate effects are returned on the log-scale, which represents either log-time ratios (accelerated failure time models) or log-hazard ratios for proportional hazard models. By default, `tidy()` will return baseline distribution parameters on their natural scale and covariate effects on the log-scale.

To transform the baseline distribution parameters to the real-value number line (the scale used for estimation), pass the character argument `"baseline.real"` to `transform`. To get time ratios or hazard ratios, pass `"coefs.exp"` to `transform`. These transformations may be done together by submitting both arguments as a character vector.

### Value

A `tibble` containing the columns: `term`, `estimate`, `std.error`, `statistic`, `p.value`, `conf.low`, and `conf.high`, by default.

`statistic` and `p.value` are only provided for covariate effects (`NA` for baseline distribution parameters). These are computed as Wald-type test statistics with p-values from a standard normal distribution.

### Examples

    fitg <- flexsurvreg(formula = Surv(futime, fustat) ~ age, data = ovarian, dist = "gengamma")
    tidy(fitg)
    tidy(fitg, pars = "coefs", transform = "coefs.exp")

[Package flexsurv version 2.0 Index]