# Simulate some data for this example:
populations <- simulatePopulations()
labels <- paste("Data site", LETTERS[1:length(populations)])
# Fit a Cox regression at each data site, and approximate likelihood function:
fitModelInDatabase <- function(population) {
cyclopsData <- Cyclops::createCyclopsData(Surv(time, y) ~ x + strata(stratumId),
data = population,
modelType = "cox"
)
cyclopsFit <- Cyclops::fitCyclopsModel(cyclopsData)
approximation <- approximateLikelihood(cyclopsFit,
parameter = "x",
approximation = "grid with gradients")
return(approximation)
}
approximations <- lapply(populations, fitModelInDatabase)
# At study coordinating center, perform meta-analysis using per-site approximations:
estimate <- computeBayesianMetaAnalysis(approximations)
plotMetaAnalysisForest(approximations, labels, estimate)
# (Estimates in this example will vary due to the random simulation)
Run the code above in your browser using DataLab