Hi All,
I am trying to understand a bit more about the mechanics of shared frailty survival models and I would like to know how I can simulate survival data with shared frailties.
Let's say that for each subject in the study, I have multiple time to event values which means that there the time to event values are dependent.
Below is an example of a STATA dataset and code that can be used as a starting point.
Ideally, I would like to understand how I can simulate data with following parameters
Many thanks
Andrew
I am trying to understand a bit more about the mechanics of shared frailty survival models and I would like to know how I can simulate survival data with shared frailties.
Let's say that for each subject in the study, I have multiple time to event values which means that there the time to event values are dependent.
Below is an example of a STATA dataset and code that can be used as a starting point.
Ideally, I would like to understand how I can simulate data with following parameters
HTML Code:
. streg female, dist(exponential) shared(patient) frailty(gamma) Gamma shared frailty Number of obs = 76 Group variable: patient Number of groups = 38 Obs per group: No. of subjects = 76 min = 2 No. of failures = 58 avg = 2 Time at risk = 7,424 max = 2 LR chi2(1) = 12.07 Log likelihood = -99.658307 Prob > chi2 = 0.0005 ------------------------------------------------------------------------------ _t | Haz. ratio Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- female | .2402041 .0959946 -3.57 0.000 .1097509 .5257175 _cons | .0320384 .0115257 -9.56 0.000 .015829 .0648469 -------------+---------------------------------------------------------------- /lntheta | -1.081838 .4993981 -2.17 0.030 -2.06064 -.1030357 -------------+---------------------------------------------------------------- theta | .3389719 .1692819 .1273724 .9020947 ------------------------------------------------------------------------------
Code:
webuse catheter, clear stset time, fail(infect) streg female, dist(exponential) shared(patient) frailty(gamma) stcox female, shared(patient) stcox, shared(patient) estimate predict nu_cox, effects streg, dist(exponential) shared(patient) frailty(gamma) predict nu_alpha1, alpha1
Andrew
Comment