as.data.frame() gives one row per parameter, the spline terms (gamma0, gamma1, ...) first
and then the covariates: the estimate, its standard error, the Wald statistic, the two-sided
p-value, and the confidence limits. A covariate's estimate is a log hazard ratio on the hazard
scale and a log odds ratio on the odds scale.
Usage
# S3 method for class 'royston_parmar'
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
...,
exponentiate = FALSE,
conf_level = x$conf_level
)Arguments
- x
A
royston_parmar()fit.- row.names, optional
Unused, for compatibility with the generic.
- ...
Unused.
- exponentiate
Give
exp()of the estimates and limits (hazard ratios or odds ratios for the covariates). The standard error, the statistic, and the p-value are those of the coefficient either way. The default isFALSE.- 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, 144,
613, 707, 61, 88),
status = c(2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 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, 67, 70, 63, 56, 57),
sex = c(1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1)
)
fit <- royston_parmar(Surv(time, status) ~ age + sex, data = lung, df = 2)
as.data.frame(fit)
#> term estimate std_error statistic p_value conf_low conf_high
#> 1 gamma0 -7.42768526 3.94425229 -1.8831669 0.059677757 -15.1582777 0.30290718
#> 2 gamma1 1.72829757 0.63252607 2.7323737 0.006287978 0.4885693 2.96802588
#> 3 gamma2 0.13371271 0.16345365 0.8180466 0.413330563 -0.1866506 0.45407599
#> 4 age -0.04682996 0.04176431 -1.1212914 0.262163842 -0.1286865 0.03502658
#> 5 sex 0.17392149 0.63919766 0.2720934 0.785550168 -1.0788829 1.42672588