[R] Extracting approximate Wald test (Chisq) from coxph(..frailty)
Charles C. Berry
cberry at tajo.ucsd.edu
Tue Apr 17 18:43:19 CEST 2007
On Tue, 17 Apr 2007, Mohammad Ehsanul Karim wrote:
> Dear List,
>
> How do I extract the approximate Wald test for the
> frailty (in the following example 17.89 value)?
The example you give silently invokes print.coxph() to produce that
output.
You _can_ use
tmp <- capture.output( print( <your example> ) )
and then further process tmp.
A _better_ solution for most purposes is to look at the object produced by
coxph() and figure out how to calculate the Wald statistic from that
object. See
?coxph.object
and
?str
Another tactic is to look at how print.coxph() does its work and use the
code in it to produce just the output you desire. Look at
page( survival:::print.coxph, "print" )
>
> What about the P-values, other Chisq, DF, se(coef) and
> se2? How can they be extracted?
>
> ######################################################>
> kfitm1
> Call:
> coxph(formula = Surv(time, status) ~ age + sex +
> disease + frailty(id,
> dist = "gauss"), data = kidney)
>
> coef se(coef)
> age 0.00489 0.0150
> sex -1.69703 0.4609
> diseaseGN 0.17980 0.5447
> diseaseAN 0.39283 0.5447
> diseasePKD -1.13630 0.8250
> frailty(id, dist = "gauss
> se2 Chisq DF
> age 0.0106 0.11 1.0
> sex 0.3617 13.56 1.0
> diseaseGN 0.3927 0.11 1.0
> diseaseAN 0.3982 0.52 1.0
> diseasePKD 0.6173 1.90 1.0
> frailty(id, dist = "gauss 17.89 12.1
> p
> age 0.74000
> sex 0.00023
> diseaseGN 0.74000
> diseaseAN 0.47000
> diseasePKD 0.17000
> frailty(id, dist = "gauss 0.12000
>
> Iterations: 6 outer, 30 Newton-Raphson
> Variance of random effect= 0.493
> Degrees of freedom for terms= 0.5 0.6 1.7 12.1
> Likelihood ratio test=47.5 on 14.9 df, p=2.82e-05 n=
> 76
>
> ######################################################
>
> Thank you for your time.
> Thanks in advance.
>
> Mohammad Ehsanul Karim
> wildscop at yahoo dot com
> Institute of Statistical Research and Training
> University of Dhaka
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu UC San Diego
http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901
More information about the R-help
mailing list