R version 4.4.0 beta (2024-04-12 r86413 ucrt) -- "Puppy Cup" 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 out the t-distribution > # > # First, a t-dist with 500 df should be nearly identical to the Gaussian > > fitig <- survreg(Surv(time, status)~voltage, + dist = "gaussian", data = capacitor) > fit1 <- survreg(Surv(time, status) ~ voltage, + dist='t', parms=500, capacitor) > fitig Call: survreg(formula = Surv(time, status) ~ voltage, data = capacitor, dist = "gaussian") Coefficients: (Intercept) voltage 1917.431558 -4.087366 Scale= 314.4748 Loglik(model)= -249.2 Loglik(intercept only)= -258.7 Chisq= 18.97 on 1 degrees of freedom, p= 1.32e-05 n= 64 > summary(fit1, corr=F) Call: survreg(formula = Surv(time, status) ~ voltage, data = capacitor, dist = "t", parms = 500) Value Std. Error z p (Intercept) 1918.329 219.536 8.74 < 2e-16 voltage -4.091 0.778 -5.26 1.5e-07 Log(scale) 5.749 0.133 43.12 < 2e-16 Scale= 314 Student-t distribution: parmameters= 500 Loglik(model)= -249.2 Loglik(intercept only)= -258.7 Chisq= 19.01 on 1 degrees of freedom, p= 1.3e-05 Number of Newton-Raphson Iterations: 5 n= 64 > > # A more realistic fit > fit2 <- survreg(Surv(time, status) ~ voltage, + dist='t', parms=5, capacitor) > print(fit2) Call: survreg(formula = Surv(time, status) ~ voltage, data = capacitor, dist = "t", parms = 5) Coefficients: (Intercept) voltage 1975.155951 -4.315492 Scale= 276.799 Loglik(model)= -250.2 Loglik(intercept only)= -261 Chisq= 21.65 on 1 degrees of freedom, p= 3.27e-06 n= 64 > > if (FALSE) { + resid(fit2, type='response') + resid(fit2, type='deviance') + resid(fit2, type='working') + resid(fit2, type='dfbeta') + resid(fit2, type='dfbetas') + resid(fit2, type='ldresp') + resid(fit2, type='ldshape') + resid(fit2, type='ldcase') + resid(fit2, type='matrix') + + predict(fit2, type='link') + predict(fit2, type='terms') + predict(fit2, type='quantile') + } > > proc.time() user system elapsed 0.78 0.14 0.86