goranbrostrom / eha

eha
6 stars 1 forks source link

Small bug in the print.phreg function? #14

Open pdeninis opened 1 year ago

pdeninis commented 1 year ago

First I would like to say that I really appreciate your book, both because it gives me an unusual perspective on the subject and because the synergy with the R package has great educational value.

During my exploration I noted that this code,

library(eha)
fit <-phreg(Surv(enter,exit,event)~1,data=mort)
fit
Call:
phreg(formula = Surv(enter, exit, event) ~ 1, data = mort)

Covariate          W.mean      Coef Exp(Coef)  se(Coef)    Wald p
log(scale)                    3.785               0.066     0.000 
log(shape)                    0.332               0.058     0.000 

Events                    276 
Total time at risk         17038 
Max. log. likelihood      -1399.3 

I derived from pag. 240, didn't actually show the Exp(Coef), although it was announced in the header.

I thought it might also be a wanted behaviour, in that it doesn't refer to a coefficient of a term included in the right side of the equation. However, the book on pag. 241 reports the R output showing the exponentiated value too, albeit in a transposed format, so I believe it could not be working as intended.

            log(scale) log(shape)
Coef             3.785      0.332
se(Coef)         0.066      0.058
exp(Coef)       44.015      1.393

Thank you for sharing your knowledge and your experience in the field.

Paolo

> R.version
               _                                
platform       x86_64-w64-mingw32               
arch           x86_64                           
os             mingw32                          
crt            ucrt                             
system         x86_64, mingw32                  
status                                          
major          4                                
minor          2.2                              
year           2022                             
month          10                               
day            31                               
svn rev        83211                            
language       R                                
version.string R version 4.2.2 (2022-10-31 ucrt)
nickname       Innocent and Trusting            

> packageVersion("eha")
[1] ‘2.10.1’