[R] (coxph, se) Obtaining standard errors of coefficients from coxph to store

joris.dewolf at cropdesign.com joris.dewolf at cropdesign.com
Mon Aug 27 09:36:51 CEST 2007



David,

It would be helpful to give an example of what you would like to extract.

I guess you know how to extract elements from vectors and lists.
However, sometimes the objects returned by functions can be rather complex
(output of coxph() is...)
A general method to capture printed output is via capture.output(). Maybe
not fast, but if you have no other solution...

Joris

> a <- rnorm(10,1,1)
> b <- rnorm(10,1,1)
> mod <- lm(a~b)
> smod <- summary(mod)
> smod

Call:
lm(formula = a ~ b)

Residuals:
    Min      1Q  Median      3Q     Max
-1.7482 -0.5991  0.1211  0.8341  1.4975

Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept)   1.6210     0.5332   3.040   0.0161 *
b            -0.7667     0.5037  -1.522   0.1664
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.142 on 8 degrees of freedom
Multiple R-Squared: 0.2246,     Adjusted R-squared: 0.1277
F-statistic: 2.317 on 1 and 8 DF,  p-value: 0.1664

> output <- capture.output(print(smod))
> output
 [1] ""
 [2] "Call:"
 [3] "lm(formula = a ~ b)"
 [4] ""
 [5] "Residuals:"
 [6] "    Min      1Q  Median      3Q     Max "
 [7] "-1.7482 -0.5991  0.1211  0.8341  1.4975 "
 [8] ""
 [9] "Coefficients:"
[10] "            Estimate Std. Error t value Pr(>|t|)  "
[11] "(Intercept)   1.6210     0.5332   3.040   0.0161 *"
[12] "b            -0.7667     0.5037  -1.522   0.1664  "
[13] "---"
[14] "Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 "
[15] ""
[16] "Residual standard error: 1.142 on 8 degrees of freedom"
[17] "Multiple R-Squared: 0.2246,\tAdjusted R-squared: 0.1277 "
[18] "F-statistic: 2.317 on 1 and 8 DF,  p-value: 0.1664 "
[19] ""





                                                                           
             "David Lloyd"                                                 
             <DavidLloyd at mail2                                             
             lloyd.com>                                                 To 
             Sent by:                  <r-help at stat.math.ethz.ch>          
             r-help-bounces at st                                          cc 
             at.math.ethz.ch                                               
                                                                   Subject 
                                       [R] (coxph,  se) Obtaining standard 
             16/08/2007 11:31          errors of coefficients from coxph   
                                       to store                            
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Hi all,

I'm wanting to be able to find and store the z-score of coxph below: -

modz=coxph(Surv(TSURV,STATUS)~RAGE+DAGE+REG_WTIME_M+CLD_ISCH+POLY_VS,
data=kidneyT,method="breslow")


I know summary(modz) will give me this, but how do i extract the
standard error or z-score values in a similar way to obtaining the
coefficients by coef(modz) ? I think it must be something to do with
modz$var but I'm having a complete mental blank.

I need this info so I can write a function to use within a bootstrap so
I can record the number of times (proportion) each variable in the Cox
PH model is actually significant over all the bootstrap resamples.

Any assistance is greatly appreciated

DL


Click to find local singles for dating, romance and fun.
<http://tagline.bidsystem.com/fc/Ioyw36XJJVs581mfqGSywy0Z69Mq8VM03oVytPu
8otqP84CBZmNX2G/>



<span id=m2wTl><p><font face="Arial, Helvetica, sans-serif" size="2"
style="font-size:13.5
px">_______________________________________________________________<BR>Get
the Free email that has everyone talking at <a
href=http://www.mail2world.com target=new>http://www.mail2world.com</a><br>
<font color=#999999>Unlimited Email Storage &#150; POP3 &#150; Calendar
&#150; SMS &#150; Translator &#150; Much More!</font></font></span>
             [[alternative HTML version deleted]]

______________________________________________
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.



More information about the R-help mailing list