# [R] aftreg vs survreg loglogistic aft model (different intercept term)

Terry Therneau therneau at mayo.edu
Mon Nov 29 14:35:04 CET 2010

``` Survreg maximizes the log-likelihood to a relative tolerance of 1e-9
(?survreg.control).  The printout shows -379503.5, to see the rest of
the digits you need something like:
fit <- survreg(....
print(fit\$loglik, digits=9)

Aftreg printed even less digits; you would have to do the same with it
to see which routine got closer to maximizing the actual log-likelihood.
That is of survreg showed -37903.5392 and  aftreg -37903.6123 then
survreg "wins".

Likley all this means is that the default iteration tolerance is smaller
for one routine than for the other.  When you consider that
"significant" changes in a log-likihood are on the order of 3.94/2 =2
units, I do not get very excited by a .08 difference in convergence.

Terry Therneau

---------- begin included message --------------
I add an example , all the variables are mutually excluding dummy
variables,
notice the different intercept: 5.627 vs 5.545:
survreg:
Value Std. Error     z        p
(Intercept)   5.627    0.00887 634.3 0.00e+00
Var1.recR2 -0.108    0.01026 -10.5 1.00e-25
Var1.recR3 -0.490    0.01099 -44.5 0.00e+00
Var1.recR4 -0.542    0.01303 -41.6 0.00e+00
Var1.recR5 -0.891    0.01095 -81.3 0.00e+00
Log(scale)   -0.324    0.00350 -92.7 0.00e+00

Scale= 0.723

Log logistic distribution
Loglik(model)= -379503.5   Loglik(intercept only)= -383388.9
Chisq= 7770.76 on 4 degrees of freedom, p= 0

aftreg:
Covariate          W.mean      Coef Exp(Coef)  se(Coef)    Wald p
Var1.recR
1    0.253     0         1           (reference)
2    0.330     0.108     1.114     0.010     0.000
3    0.191     0.490     1.632     0.011     0.000
4    0.106     0.542     1.720     0.013     0.000
5    0.120     0.891     2.437     0.011     0.000

log(scale)                    5.545   256.029     0.008     0.000
log(shape)                    0.324     1.383     0.003     0.000

Max. log. likelihood      -379504

-------- end inclusion -----------

```