Dear R-users, I would like to determine the probability of event at specific time using cox model fit. On the development sample data I am able to get the probability of a event at time point(t). I need probability score of a event at specific time, using scoring scoring dataset which will have only covariates and not the response variables.
Here is the sample code: n = 1000 beta1 = 2; beta2 = -1; lambdaT = .02 # baseline hazard lambdaC = .4 # hazard of censoring x1 = rnorm(n,0) x2 = rnorm(n,0) # true event time T = rweibull(n, shape=1, scale=lambdaT*exp(-beta1*x1-beta2*x2)) C = rweibull(n, shape=1, scale=lambdaC) #censoring time time = pmin(T,C) #observed time is min of censored and true event = time==T # set to 1 if event is observed dataphr=data.frame(time,event,x1,x2) library(survival) fit_coxph <- coxph(Surv(time, event)~ x1 + x2 , method="breslow") library(peperr) predictProb.coxph(fit_coxph, Surv(dataphr$time, dataphr$event), dataphr, 0.003) # Using predictProb.coxph function, probability of event at time (t) is estimated for cox fit models, I want to estimate this probability on scoring dataset score_data as below with covariate x1 and x2. Is it possible/ is there any way to get these probabilities? since in predictProb.coxph function it requires response, which is not preseent on scoring sample. n = 10000 set.seed(1) x1 = rnorm(n,0) x2 = rnorm(n,0) score_data <- data.frame(x1,x2) Thanks in advance!! ~ Ajit -- View this message in context: http://r.789695.n4.nabble.com/Calculating-the-probability-of-an-event-at-time-t-from-a-Cox-model-fit-tp4213318p4213318.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org 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.