[R] Extracting approximate Wald test (Chisq) from coxph(..frailty)
Dear List, How do I extract the approximate Wald test for the frailty (in the following example 17.89 value)? 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) age0.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 se2Chisq 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 diseasePKD0.6173 1.90 1.0 frailty(id, dist = gauss17.89 12.1 p age 0.74000 sex 0.00023 diseaseGN 0.74000 diseaseAN 0.47000 diseasePKD0.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@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.
Re: [R] Extracting approximate Wald test (Chisq) from coxph(..frailty)
Assign the output of coxph to some object, and use the $ extractor function to obtain what you need. ie: rtfm - coxph(formula = Surv(time, status) ~ age + sex + disease + frailty(id, dist = gauss), data = kidney) Age - coef(rtfm)[age] OR Sex - rtfm$coef[sex] Hope this helps. Paul Mohammad Ehsanul Karim wrote: Dear List, How do I extract the approximate Wald test for the frailty (in the following example 17.89 value)? 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) age0.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 se2Chisq 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 diseasePKD0.6173 1.90 1.0 frailty(id, dist = gauss17.89 12.1 p age 0.74000 sex 0.00023 diseaseGN 0.74000 diseaseAN 0.47000 diseasePKD0.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@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. -- View this message in context: http://www.nabble.com/Extracting-approximate-Wald-test-%28Chisq%29-from-coxph%28..frailty%29-tf3589257.html#a10038426 Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Extracting approximate Wald test (Chisq) from coxph(..frailty)
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) age0.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 se2Chisq 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 diseasePKD0.6173 1.90 1.0 frailty(id, dist = gauss17.89 12.1 p age 0.74000 sex 0.00023 diseaseGN 0.74000 diseaseAN 0.47000 diseasePKD0.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@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:[EMAIL PROTECTED] UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901 __ R-help@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.
Re: [R] Extracting approximate Wald test (Chisq) from coxph(..frailty)
Dear list, I need to extract the approximate Wald test (Chisq) so that I can put it in a loop. str seemed like a great idea, but I cannot seem to find the approximate Wald test for frailty (in the example data below: 17.89 and its p-value 0.12000) there. I cannot seem to find it in capture.output either as numeric form. Do I need to modify some given values? If yes, please give me a clue for the example: library(survival) kfitm1-coxph(formula = Surv(time, status) ~ age + sex +disease + frailty(id, dist = gauss), data = kidney) str(kfitm1) capture.output( print(kfitm1) ) Mohammad Ehsanul Karim (R - 2.3.1 on windows) wildscop at yahoo dot com Institute of Statistical Research and Training University of Dhaka On Tue, 17 Apr 2007, Mohammad Ehsanul Karim wrote: 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 ) Assign the output of coxph to some object, and use the $ extractor function to obtain what you need. ie: rtfm - coxph(formula = Surv(time, status) ~ age + sex + disease + frailty(id, dist = gauss), data = kidney) Age - coef(rtfm)[age] OR Sex - rtfm$coef[sex] Mohammad Ehsanul Karim wrote: Dear List, How do I extract the approximate Wald test for the frailty (in the following example 17.89 value)? 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) age0.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 se2Chisq 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 diseasePKD0.6173 1.90 1.0 frailty(id, dist = gauss17.89 12.1 p age 0.74000 sex 0.00023 diseaseGN 0.74000 diseaseAN 0.47000 diseasePKD0.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 __ R-help@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.