R Under development (unstable) (2023-08-12 r84939 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Verify the values found in the Royston paper > library(survival) > > pbc2 <- na.omit(pbc[,-1]) # no id variable, no missings > > pfit1 <- coxph(Surv(time, status==2) ~ . + log(bili) - bili, pbc2, + ties="breslow") > # backwards elimination was used to eliminate all but 8 > pfit2 <- coxph(Surv(time, status==2) ~ age + log(bili) + edema + albumin + + stage + copper, data=pbc2, ties="breslow") > > temp <- rbind(royston(pfit1), royston(pfit1, adjust=TRUE), + royston(pfit2), royston(pfit2, adjust=TRUE)) > all.equal(round(temp[,1], 2), c(2.86, 2.56, 2.69, 2.59)) [1] TRUE > > proc.time() user system elapsed 0.85 0.12 0.96