Spatial Survival areal data

How can I simulate spatial areal survival data in R? please help me with example .

Following code is simulate data from this model
enter image description here

num_studies <- 50
 num_patients <- 200
 tot_patients <- num_studies * num_patients
 cov <- data.frame(id = 1:tot_patients,
 study = rep(1:num_studies, each = num_patients),
 treat = rbinom(tot_patients, 1, 0.5))

 pop_treat_effect <- -0.5
 study_treat_effect <- pop_treat_effect + rnorm(num_studies, 0, 0.5)
pars <- data.frame(treat = rep(study_treat_effect, each = num_patients))
 set.seed(908070)
dat <- simsurv(dist = "gompertz", lambdas = 0.1, gammas = 0.05,
 x = cov, betas = pars)
 dat <- merge(cov, dat)

But i want to simulate from following model

enter image description here

Leave a Comment