vmonaco / frailtySurv

General Semiparametric Shared Frailty Model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

binary covariates and negative time

ChuangshiWang opened this issue · comments

Hi I am trying to simulate correlated survival data with this package. I found it's really helpful. Thanks for all the efforts. But I was wondering can I generate covariates following other distributions like Bernoulli. Actually, I tried to generate such covariates first and pass it to "covar.matrix" but found I got negative time values...which didn't make sense. So I was wondering if I did something wrong? To make it clear, I attached my code below and am looking for the answers. Thanks!

Here is my code:
covarm<-rbinom(NK,1,0.5)
covarm2<-matrix(covarm,N
K,1)
dat.1<-genfrail(N,K,beta=c(log(2/3)),frailty="gamma",theta=c(0.5),covar.distr="uniform",covar.param=c(0,1),covar.matrix = covarm2, censor.rate=0.3,Lambda_0_inv=function(t,p=2)(t)^(1/p))

In my case, I used N=6 and K=48, specifying a Weibull baseline hazard function.