I am trying to implement your function in the coxed package to simulate some survival data. In particular time-varying effects data. I find the function and the package very useful and straightforward. I however want to use binary covariates and not continuous covariates. This isn’t explicitly described in the vignette, so I tried a little hack. The code is below; after some trial and error, I’m nearly certain the error is because of the binary covariate. Any advice would be greatly appreciated.
From a user:
I am trying to implement your function in the coxed package to simulate some survival data. In particular time-varying effects data. I find the function and the package very useful and straightforward. I however want to use binary covariates and not continuous covariates. This isn’t explicitly described in the vignette, so I tried a little hack. The code is below; after some trial and error, I’m nearly certain the error is because of the binary covariate. Any advice would be greatly appreciated.
pseudo <- data.frame(x=rep(c(0,1),each=50)) x.pseudo <- dplyr::select(pseudo,x) my.hazard <- function(t){0.8(0.5^0.8)t^(-0.2)} beta.mat <- data.frame(beta1=-0.4*log(1:100+1))
simdata <- sim.survdata(T=100, num.data.frames=1, hazard.fun=my.hazard, X=x.pseudo, type="tvbeta", beta=beta.mat, censor = 0.2)