Skip to contents

as.data.frame() gives one row per coefficient, including the intercept: the estimate (on the log-time scale, or a time ratio with exponentiate = TRUE), its standard error, the Wald statistic, the two-sided p-value, and the confidence limits.

Usage

# S3 method for class 'aft'
as.data.frame(
  x,
  row.names = NULL,
  optional = FALSE,
  ...,
  exponentiate = FALSE,
  conf_level = x$conf_level
)

Arguments

x

An aft() fit.

row.names, optional

Unused, for compatibility with the generic.

...

Unused.

exponentiate

Give time ratios instead of coefficients on the log-time scale. The standard error, the statistic, and the p-value are those of the coefficient either way. The default is FALSE.

conf_level

The confidence level. The default is the level the model was fit with.

Value

A data frame with the columns term, estimate, std_error, statistic, p_value, conf_low, and conf_high.

Examples

lung <- data.frame(
  time = c(306, 455, 1010, 210, 883, 1022, 310, 361, 218, 166, 170, 654, 728, 71, 567),
  status = c(2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2),
  age = c(74, 68, 56, 57, 60, 74, 68, 71, 53, 61, 57, 68, 68, 60, 57),
  sex = c(1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2, 1, 1)
)
fit <- aft(Surv(time, status) ~ age + sex, data = lung)
as.data.frame(fit)
#>          term    estimate  std_error  statistic    p_value    conf_low
#> 1 (Intercept)  4.89736276 1.98677674  2.4649789 0.01370213  1.00335190
#> 2         age  0.02868227 0.03527749  0.8130474 0.41619091 -0.04046034
#> 3         sex -0.29724811 0.50251440 -0.5915216 0.55417100 -1.28215824
#>    conf_high
#> 1 8.79137361
#> 2 0.09782489
#> 3 0.68766201
as.data.frame(fit, exponentiate = TRUE)
#>          term    estimate  std_error  statistic    p_value  conf_low  conf_high
#> 1 (Intercept) 133.9360915 1.98677674  2.4649789 0.01370213 2.7274085 6577.26057
#> 2         age   1.0290976 0.03527749  0.8130474 0.41619091 0.9603472    1.10277
#> 3         sex   0.7428597 0.50251440 -0.5915216 0.55417100 0.2774379    1.98906