library(psborrow2)
In this article, you'll learn how to specify prior distributions in psborrow2
.
Because psborrow2
creates fully-parametrized Bayesian models,
proper prior distributions on all parameters must be specified. \bold{psborrow2
does not provide any default prior distributions by design: users must
specify these.}
Prior distributions are needed for several parameters, depending on the analysis:
add_covariates()
outcome_surv_weibull_ph()
treatment_details()
borrowing_hierarchical_commensurate()
See the documentation of these functions for more information.
The currently supported prior distributions are created with the prior_
constructors below:
prior_bernoulli()
prior_beta()
prior_cauchy()
prior_exponential()
prior_gamma()
prior_half_cauchy()
prior_half_normal()
prior_normal()
prior_poisson()
For example, we can create an uninformative normal distribution by specifying a normal prior centered around 0 with a very large standard deviation:
uninformative_normal <- prior_normal(0, 10000) uninformative_normal # Normal Distribution # Parameters: # Stan R Value # mu mean 0 # sigma sd 10000
See the documentation for the respective functions above for additional information.
You may sometimes find it useful to visualize prior distributions. In these
scenarios, you can call plot()
on the prior object to visualize the
distribution:
plot(uninformative_normal)
plot of chunk unnamed-chunk-3
plot()
chooses the default axes for you, but you can change these to
make differences more obvious. Let's compare
a conservative gamma(0.001, 0.001)
hyperprior distribution on the
commensurability parameter tau
to an more aggressive gamma(1, 0.001)
distribution with greater density at higher values of tau
(which
will lead to more borrowing in a BDB analysis):
conservative_tau <- prior_gamma(0.001, 0.001) aggressive_tau <- prior_gamma(1, 0.001) plot(aggressive_tau, xlim = c(0, 2000), col = "blue", ylim = c(0, 1e-03)) plot(conservative_tau, xlim = c(0, 2000), col = "red", add = TRUE)
plot of chunk unnamed-chunk-4
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.