search for: train_sampl

Displaying 1 result from an estimated 1 matches for "train_sampl".

Did you mean: train_sample
2012 Jan 17
1
Scoring using cox model: probability of survival before time t
...#################################### library(survival) n = 100 beta1 = 3; beta2 = -2; lambdaT = .01 lambdaC = .6 x1 = rnorm(n,0) x2 = rnorm(n,0) T = rweibull(n, shape=1, scale=lambdaT*exp(-beta1*x1-beta2*x2)) C = rweibull(n, shape=1, scale=lambdaC) time = pmin(T,C) event = time==T train_sample=data.frame(time,event,x1,x2) rm(time,event,x1,x2) fit_coxph <- coxph(Surv(time, event)~ x1 + x2, data= train_sample, method="breslow") #Save model to some directory save(fit_coxph, file = file.path("C:/Desktop","fit_coxph.RData")) #I can get probabilities on...