Skip to contents

Specify prior distributions and predictors for MCMC methods

Usage

set_prior(pred, prior, r0, alpha, sigma)

Arguments

pred

Predictors to include in the weibull distribution. No covariates except for treatment indicator is included if pred = NULL. Only propensity score generated using a logistic regression model on all covariates and treatment indicator are included if pred = ps. All covariates and treatment indicator are included if pred = all

prior

Prior distribution for the precision parameter that controls the degree of borrowing. Half-cauchy distribution if prior = "cauchy". No external data is included in the data if prior = "no_ext". External control arm is assumed to have the same baseline hazards as internal control arm if prior = "full_ext". Other options include "gamma" and "unif"

r0

Initial values for the shape of the weibull distribution for time-to-events

alpha

Initial values for log of baseline hazard rate for external and internal control arms. Length of alpha should be 1 if prior = "full_ext" or prior = "no_ext", and equal to 2 otherwise

sigma

Initial values for precision parameter if prior = "cauchy". If left NULL, default value 0.03 is used

Value

a .priorClass class containing survival data and prior information

Examples

# hierachical Bayesian model with precision parameter follows a half-cauchy distribution
set_prior(pred = "none", prior = "cauchy", r0 = 1, alpha = c(0, 0), sigma = 0.03)
#> An object of class ".priorClass"
#> Slot "pred":
#> [1] "none"
#> 
#> Slot "prior":
#> [1] "cauchy"
#> 
#> Slot "r0":
#> [1] 1
#> 
#> Slot "alpha":
#> [1] 0 0
#> 
#> Slot "sigma":
#> [1] 0.03
#> 

# hierachical Bayesian model with precision parameter follows a gamma distribution
set_prior(pred = "none", prior = "gamma", r0 = 1, alpha = c(0, 0))
#> An object of class ".priorClass"
#> Slot "pred":
#> [1] "none"
#> 
#> Slot "prior":
#> [1] "gamma"
#> 
#> Slot "r0":
#> [1] 1
#> 
#> Slot "alpha":
#> [1] 0 0
#> 
#> Slot "sigma":
#> NULL
#> 

# conventional Bayesian model to not borrow from external control arm
set_prior(pred = "none", prior = "no_ext", alpha = 0)
#> No initial values for the shape of the weibull distribution (r0) is detected. Default value 1 is used
#> An object of class ".priorClass"
#> Slot "pred":
#> [1] "none"
#> 
#> Slot "prior":
#> [1] "no_ext"
#> 
#> Slot "r0":
#> [1] 1
#> 
#> Slot "alpha":
#> [1] 0
#> 
#> Slot "sigma":
#> NULL
#> 

# conventional Bayesian model to fully borrow from external control arm
set_prior(pred = "none", prior = "full_ext", alpha = 0)
#> No initial values for the shape of the weibull distribution (r0) is detected. Default value 1 is used
#> An object of class ".priorClass"
#> Slot "pred":
#> [1] "none"
#> 
#> Slot "prior":
#> [1] "full_ext"
#> 
#> Slot "r0":
#> [1] 1
#> 
#> Slot "alpha":
#> [1] 0
#> 
#> Slot "sigma":
#> NULL
#>