R Under development (unstable) (2024-12-12 r87438 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 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. > options(na.action=na.exclude) # preserve missings > options(contrasts=c('contr.treatment', 'contr.poly')) #ensure constrast type > library(survival) > > # > # Test on the ovarian data > > fit1 <- coxph(Surv(futime, fustat) ~ rx + age, ovarian) > fit2 <- coxph(Surv(futime, fustat) ~ rx + pspline(age, df=2), + data=ovarian) > fit2$iter [1] 2 8 > > fit2$df [1] 0.9426611 1.9293051 > > fit2$history $`pspline(age, df = 2)` $`pspline(age, df = 2)`$theta [1] 0.4468868 $`pspline(age, df = 2)`$done [1] TRUE $`pspline(age, df = 2)`$history thetas dfs [1,] 1.0000000 1.000000 [2,] 0.0000000 5.000000 [3,] 0.6000000 1.734267 [4,] 0.4845205 1.929305 $`pspline(age, df = 2)`$half [1] 0 > > fit4 <- coxph(Surv(futime, fustat) ~ rx + pspline(age, df=4), + data=ovarian) > fit4 Call: coxph(formula = Surv(futime, fustat) ~ rx + pspline(age, df = 4), data = ovarian) coef se(coef) se2 Chisq DF p rx -0.373 0.761 0.749 0.241 1.00 0.6238 pspline(age, df = 4), lin 0.139 0.044 0.044 9.978 1.00 0.0016 pspline(age, df = 4), non 2.592 2.93 0.4457 Iterations: 3 outer, 14 Newton-Raphson Theta= 0.242 Degrees of freedom for terms= 1.0 3.9 Likelihood ratio test=19.4 on 4.9 df, p=0.001 n= 26, number of events= 12 > > > > proc.time() user system elapsed 0.84 0.10 0.93