Adding a predicted hazard coefficient column to a data frame after Cox regression in R

I need to add the columns of the predicted risk factor to the framework after starting the Cox PH regression in R. The data frame is the panel data, where numgvkey, if the company ID and age is the time identifier. You can download a small portion of the date from this link: https://drive.google.com/file/d/0B8usDJAPeV85VFRWd01pb0h1MDA/view?usp=sharing

I have the following:

library(survival)
library(readstata13)
sme <- read.dta13("sme.dta")
reg<-coxph(Surv(age,EVENT2)~L1FETA+frailty(numgvkey), ties=c("efron"),  data=sme)
summary(reg)
hr <- predict(reg, type="risk")

How can I add the 5th Hazard Ratio (hr) column in my sme frame? Also, is there a way to predict the probability of EVENT2 rather than “hr”?

+4
source share
1 answer

predict.coxph "" . "", , "". , 1,0, , " " .

"" "" .

.coxph, . surv, cumhaz.

, :

sme$cumhaz <- survfit(fit, newdata=sme)$cumhaz
+3

All Articles