Skip to contents

Introduction

This vignette describes an implementation of a Bayesian analysis that pools the source and target study data.

Posterior distribution

With pooling, the prior distribution of θT\theta_T is given by:

p(θT)=𝒩(θT|θ̂S,σS2/NS) p(\theta_T) = \mathcal{N}(\theta_T | \hat{\theta}_S, \sigma^2_S/N_S)

We observe NTN_T data points with sample mean θ̂T\hat{\theta}_T and known variance σT2\sigma^2_T. This implies the likelihood is given by:

p(θ̂T|θT)=𝒩(θ̂T|θT,σT2/NT) p(\hat{\theta}_T | \theta_T) = \mathcal{N}(\hat{\theta}_T | \theta_T, \sigma^2_T/N_T)

Since both the prior and the likelihood are Gaussian distributions, the posterior will also be a Gaussian distribution.

The posterior distribution p(θT|θ̂T)p(\theta_T | \hat{\theta}_T) is :

θT|θ̂T∼𝒩(μpost,σpost2) \theta_T | \hat{\theta}_T \sim \mathcal{N}(\mu_{\text{post}}, \sigma^2_{\text{post}})

Posterior Mean:

μpost=σpost2(θ̂SNSσS2+θ̂TNTσT2) \mu_{\text{post}} = \sigma_{\text{post}}^2 \left( \frac{\hat{\theta}_S N_S}{\sigma^2_S} + \frac{\hat{\theta}_T N_T}{\sigma^2_T} \right)

Posterior Variance:

σpost2=(NSσS2+NTσT2)−1 \sigma_{\text{post}}^2 = \left( \frac{N_S}{\sigma^2_S} + \frac{N_T}{\sigma^2_T} \right)^{-1}

Thus, the posterior distribution p(θT|θ̂T)p(\theta_T | \hat{\theta}_T) is:

θT|θ̂T∼N((NSσS2+NTσT2)−1(θ̂SNSσS2+θ̂TNTσT2),(NSσS2+NTσT2)−1) \theta_T | \hat{\theta}_T \sim N\left( \left( \frac{N_S}{\sigma^2_S} + \frac{N_T}{\sigma^2_T} \right)^{-1} \left( \frac{\hat{\theta}_S N_S}{\sigma^2_S} + \frac{\hat{\theta}_T N_T}{\sigma^2_T} \right), \left( \frac{N_S}{\sigma^2_S} + \frac{N_T}{\sigma^2_T} \right)^{-1} \right)

In the limit where σT\sigma_T goes to infinity:

σpost2→σS2NS \sigma_{\text{post}}^2 \rightarrow \frac{\sigma^2_S}{N_S}

μpost→θ̂S \mu_{\text{post}} \rightarrow \hat{\theta}_S

That is, the target study data are discarded because the likelihood becomes flat, and the posterior is the same as the prior.

Pooling the data is equivalent to defining a Gaussian prior with mean and standard deviation corresponding to the treatment effect estimate and standard error on the treatment effect in the source study.

Set working directory and load packages

Load the case study configuration

Load the simulation configuration and the Belimumab case study configuration from YAML files.

set.seed(42)
case_study_config <- yaml::yaml.load_file(system.file("conf/case_studies/belimumab.yml", package = "BExTE"))

Create data objects

Create a source_data instance, where information about the source data is stored

source_data <- ObservedSourceData$new(case_study_config)

Set the observed target data (in the paediatrics population)

target_data <- ObservedTargetData$new(treatment_effect_estimate = case_study_config$target$treatment_effect, treatment_effect_standard_error = case_study_config$target$standard_error, target_sample_size_per_arm = as.integer(case_study_config$target$total / 2), summary_measure_likelihood = case_study_config$summary_measure_likelihood)

Create model

method <- "pooling"
method_parameters <- list(
  initial_prior = "noninformative" # This corresponds to the fact that the posterior for the adults data is derived from an uninformative prior (for consistency with other methods).
)

Now, we define the model we want to use for inferring the treatment effect in the target study.

model <- Model$new()

model <- model$create(
  case_study_config = case_study_config,
  method = method,
  method_parameters = method_parameters,
  source_data = source_data
)

This model calls RBesT in the backend, leveraging the fact that it is a special case of a Robust Mixture Prior.

Inference

# Perform Bayesian inference based on observed target data.
model$inference(target_data = target_data)
## [1] "Success"
model$plot_pdfs(xmin = 0, xmax = 1, resolution = 100)