B_slash_
B_slash_

Reputation: 383

How to build a Cox PH model manually (from coefficient found in coxph function)?

I built a cox PH model with the following code:

library(rms)
cox1 <- cph(Surv(survival_time, event) ~ var1 + var2 + var3 + var4, data = myDataBase)
summary(cox1)

Now I want to predict a survival probability at 12/24/36 months for a new individual:

library(pec)
NewPatient <- t(data.frame(c(90, 1, 8, 8)))
colnames(NewPatient) <- c("var1", "var2", "var3", "var4")
predictSurvProb(cox1, NewPatient, times = c(12,24,36))

In the predictSurvProb function from {pec} package, I don't want to use the "cox1" cph model created with the first line of code, but I would rather like to embed a raw cox model with the manually entered coefficients (that I would have taken from the first part of the code).

(ie = I am building a shinyapp in which I want to run the second part of the code without needing the first part, = without the dataBase).

How can I get the cox model equation?

Many thanks!

Upvotes: 0

Views: 344

Answers (0)

Related Questions