Hi there, I am an MS student from Bangladesh. I am doing thesis in my MS degree. In my research, I am generating data from weibull distribution and my model is accelerated failure time (AFT) model. I am considering right censoring as well as covariates. Now I have been facing difficulties to generate censoring time controlling censoring proportion. I am attaching my codes here.
Problem. I have generated censoring time using a relationship between scale and covariates from an article for PH model. But my model is AFT. Is it authentic to use it here? Please help!!! Sincerely, Fabiha
library(survival) ##true coefficients b0=.25 ## intercept b1=2 b2=3 ## regression coefficients b3=.5 n=30 ## covariates library(MASS) mu=rep(0,3) sigma=matrix(.7,nrow=3,ncol=3)+diag(3)*.3 x = mvrnorm(n, mu=mu, Sigma=sigma) x1=x[,1] x2=x[,2] x3=x[,3] ## real survival times t = rweibull(n, shape=.5, scale=exp((b0+b1*x1+b2*x2+b3*x3))) ## censoring times c = rweibull(n, shape=.5, scale=exp(-(b0+b1*x1+b2*x2+b3*x3)/.5)) ## observed times time = pmin(t, c) time ## censoring indicator status=as.numeric(c>t) status ## data frame data=data.frame(time,status,x1,x2,x3) data ## model fitting model=survreg(Surv(time, status)~x1+x2+x3, dist="weibull", data=data) summary=summary(model) summary
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.