data.type <- "Bernoulli"
data.link <- "Logistic"
# Simulate current data
set.seed(1)
p <- 3
n_total <- 100
y <- rbinom(n_total,size=1,prob=0.6)
# The first column of x is the treatment indicator.
x <- cbind(rbinom(n_total,size=1,prob=0.5),
matrix(rnorm(p*n_total),ncol=p,nrow=n_total))
# Simulate two historical datasets
# Note that x0 does not have the treatment indicator
historical <- list(list(y0=rbinom(n_total,size=1,prob=0.2),
x0=matrix(rnorm(p*n_total),ncol=p,nrow=n_total), a0=0.2),
list(y0=rbinom(n_total, size=1, prob=0.5),
x0=matrix(rnorm(p*n_total),ncol=p,nrow=n_total), a0=0.3))
# Set parameters of the slice sampler
lower.limits <- rep(-100, 5) # The dimension is the number of columns of x plus 1 (intercept)
upper.limits <- rep(100, 5)
slice.widths <- rep(1, 5)
nMC <- 1000 # nMC should be larger in practice
nBI <- 250
result <- glm.fixed.a0(data.type=data.type, data.link=data.link, y=y, x=x, historical=historical,
lower.limits=lower.limits, upper.limits=upper.limits,
slice.widths=slice.widths, nMC=nMC, nBI=nBI)
summary(result)
Run the code above in your browser using DataLab