broom (version 0.3.7)

survreg_tidiers: Tidiers for a parametric regression survival model

Description

Tidies the coefficients of a parametric survival regression model, from the "survreg" function, adds fitted values and residuals, or summarizes the model statistics.

Usage

## S3 method for class 'survreg':
tidy(x, conf.level = 0.95, ...)

## S3 method for class 'survreg': augment(x, data = model.frame(x), newdata, type.predict = "response", type.residuals = "response", ...)

## S3 method for class 'survreg': glance(x, conf.level = 0.95, ...)

Arguments

x
a "survreg" model
conf.level
confidence level for CI
...
extra arguments (not used)
data
original data; if it is not provided, it is reconstructed as best as possible with model.frame
newdata
New data to use for prediction; optional
type.predict
type of prediction, default "response"
type.residuals
type of residuals to calculate, default "response"

Value

  • All tidying methods return a data.frame without rownames, whose structure depends on the method chosen.

    tidy returns a data.frame with one row for each term

  • termname of term
  • estimateestimate of coefficient
  • stderrorstandard error
  • statisticZ statistic
  • p.valuep-value
  • conf.lowlow end of confidence interval
  • conf.highhigh end of confidence interval
  • augment returns the original data.frame with the following additional columns:
  • .fittedFitted values of model
  • .se.fitStandard errors of fitted values
  • .residResiduals
  • glance returns a one-row data.frame with the columns:
  • iternumber of iterations
  • dfdegrees of freedom
  • statisticchi-squared statistic
  • p.valuep-value from chi-squared test
  • logLiklog likelihood
  • AICAkaike information criterion
  • BICBayesian information criterion
  • df.residualresidual degrees of freedom

Details

When the modeling was performed with na.action = "na.omit" (as is the typical default), rows with NA in the initial data are omitted entirely from the augmented data frame. When the modeling was performed with na.action = "na.exclude", one should provide the original data as a second argument, at which point the augmented data will contain those rows (typically with NAs in place of the new columns). If the original data is not provided to augment and na.action = "na.exclude", a warning is raised and the incomplete rows are dropped.

See Also

na.action

Examples

Run this code
if (require("survival", quietly = TRUE)) {
    sr <- survreg(Surv(futime, fustat) ~ ecog.ps + rx, ovarian,
           dist="exponential")

    td <- tidy(sr)
    augment(sr, ovarian)
    augment(sr)
    glance(td)

    # coefficient plot
    library(ggplot2)
    ggplot(td, aes(estimate, term)) + geom_point() +
        geom_errorbarh(aes(xmin = conf.low, xmax = conf.high), height = 0) +
        geom_vline()
}

Run the code above in your browser using DataLab