rstanarm for adaptive trials

101 views Asked by At

I started exploring the rstanarm package and was curious as how this package could potentially be used in an adaptive trial scenario. The example scenario given within vignette provides a posterior of -0.622 with a credible interval from -0.69 to -0.56.

What would my script look like if I wanted to use this posterior as a prior for my next model when I have additional data from the adaptive trial?

# Code from vignette
t_prior <- student_t(df = 7, location = 0, scale = 2.5)
fit1 <- stan_glm(switch ~ dist100, data = wells, 
             family = binomial(link = "logit"), 
              prior = t_prior, prior_intercept = t_prior,  
              chains = 10, cores = 2, seed = 3245, iter = 100)
1

There are 1 answers

0
Ben Goodrich On

Your question is not so easily answered within the rstanarm framework because it only offers limited choices for the priors.

It is entirely valid to use your original prior with the total data from phase I and phase II combined to obtain a posterior distribution (essentially ignoring the intermediate posterior distribution you had after phase I). Alternatively, you could do as you suggest in phase I, then call draws <- as.matrix(fit1) mu <- colMeans(draws) Sigma <- cov(mu) and use these (estimated) mu and Sigma values as the hyperparameters in a multivariate normal prior over the coefficients in phase II. Unfortunately, such a prior is not supported by rstanarm, so you would need to write your own model with a Bernoulli likelihood, a logit link, and a multivariate normal prior in the Stan language or I think you could accomplish all that using the brm function in the brms package, which generates Stan code from R syntax and draws from the corresponding posterior distribution.

Both approaches conceptually should give you the same posterior distribution after phase II. However, with a finite number of posterior draws they will differ a little bit numerically and the multivariate normal prior might not be a complete description of the posterior distribution you obtained after phase I.