Assistance with coxph and standard errors
1
0
Entering edit mode
5.4 years ago
roba6848 • 0

Hi,

I am running a cox regression with coxph in R The regression runs fine and reports standard errors on the coefficients too. This is good. But I need to run a number of simulation runs and collect the standard errors. The standard errors are printed when I print the object:but I can find no way of getting them from the coxph.object returned by coxph. There is no mention of them in the coxph.object documentation:

> coxph.result
Call:
coxph(formula = Surv(timeall, event = PatientDeceased) ~ treatment + 
    AgeAtIndexDate + BMI + cellcount)

                     coef  exp(coef)   se(coef)      z      p
treatmentA      5.057e-01  1.658e+00  2.153e-01  2.349 0.0188
treatmentB    8.014e-02  1.083e+00  2.465e-01  0.325 0.7451
AgeAtIndexDate  4.626e-05  1.000e+00  2.258e-05  2.048 0.0405
BMI       -5.023e-03  9.950e-01  1.939e-02 -0.259 0.7956
cellcount         2.113e-02  1.021e+00  9.299e-02  0.227 0.8202

Likelihood ratio test=8.88  on 5 df, p=0.114
n= 137, number of events= 123

Can anyone tell me where to get the standard errors?

cox coxph R stderr error • 3.8k views
ADD COMMENT
0
Entering edit mode

I am not sure how familiar with R you are and I don't have a computer in front of my to check this, but I think you should just be able to go:

result <- coxph.result

to store results in a variable, then you could go:

typeof(result)

to print to the console what type of object it is, then look up indexing/slicing that object on google/stackoverflow. you probably need to make a function to get the specific elements that you want.

EDIT: Sorry I forgot to leave this as a comment not an answer :(

ADD REPLY
1
Entering edit mode
5.4 years ago
Gordon Smyth ★ 7.7k

In statistics, the term "standard error" means an estimated standard deviation. A standard deviation is just the square root of a variance, and the variance matrix of the coefficients is documented in the coxph.object help page.

You can extract the standard errors from coxph.result by

SE <- sqrt( diag( coxph.result$var ))
ADD COMMENT

Login before adding your answer.

Traffic: 2035 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6