For reference, I am using rstanarm to analyse my data using a Bayesian framework. I am working with the stan_glm function. The package version I am using is 2.19.2, and my R version is 3.6.2.
Below are examples of 2 dataframes I am using:
dat <- structure(list(heading = c(2, 0.5, 2, 1.5, 2, 1.5, 2, 1.5, 2, 0.5, 2, 2, 2, 2, 2, 1.5, 1.5,
1.5, 2, 0, 2, 1, 1.5, 2, 1, 0.5, 1, 0.5, 1.5, 0.5), FirstSteeringTime = c(0.433389999999999,
0.449999999999989, 0.383199999999988, 0.499899999999997, 0.566800000000001,
0.58329999999998, 0.5, 0.449799999999982, 0.566600000000022, 0.466700000000003,
0.433499999999981, 0.466799999999978, 0.549900000000036, 0.483499999999992,
0.533399999999972, 0.433400000000006, 0.533200000000022, 0.450799999999999,
0.45022, 0.48342000000001, 0.46651, 0.68336, 0.483400000000003, 0.5167,
0.383519999999997, 0.583200000000005, 0.449999999999989, 0.58329999999998,
0.4999, 0.5334)), row.names = c(NA, 30L), class = "data.frame")
I have 2 experiments that I aim to analyse. The second is a small iteration of the first, and thus I aim to use the Bayesian analysis of the first to inform my priors of the second. In my first experiment, I use default priors to analyse my data:
fit_1 <- stan_glm(FirstSteeringTime ~ heading, family = Gamma(link = "identity"), prior =
normal(0, 0.3), adapt_delta = 0.999, data = dat)
Using this model I can compute Bayes factors, investigate the posterior distribution by implementing ROPEs etc (I do this using the bayestestR
package). However I am wondering how I can use the posteriors of the fit_1 model to inform priors of my second model.
On suggestion I have had is to sample the posterior mean and standard deviation and use these as location and scale parameters for the prior distribution of my second analysis.
library(bayestestR)
posteriors <- insight::get_parameters(fit_1)
describe_posterior(posteriors, centrality = "all", dispersion = TRUE, test = "all")
However, how can I specify the overall shape of the distribution so that it matches that of my posteriors from the first analysis?
Any help is most appreciated, thank you!