Bernoulli model
Description
The Bernoulli model is a model of binary data.
Definition
For binary outcome \(y\) and predictors \(x\), the model is:
\[ \begin{align} y_i &\sim \text{Bernoulli}(\text{logit}^{-1}(\eta_i)) \\ \eta_i &= \alpha + \beta \cdot x_i \end{align} \]
Parameters needing priors
- \(\alpha\) (intercept)
- \(\beta\) (predictor weights)
Prior on \(\alpha\)
Weakly informative logistic prior
Greenland and Mansournia (2015) found that a logistic function prior provided a good default.
\(\alpha \sim \text{logistic}(\sigma)\)
Boonstra, Barbaro, and Sen (2019) suggests that \(\sigma\) should be chosen by:
choose constant \(0 \lt q \lt 1\) which is prior mass outside extreme boundaries. e.g. 0.01
calculate \(s_n = \exp{-1 / (2n)}\), where \(n\) is number of observations
select \(\sigma = \sigma_n\) such that \(P(1 - s_n < \text{logit}^{-1}(\alpha) < s_n | \sigma = \sigma_n) = 1 - q\).
<- function(n, q) {
logis_sigma
<- exp(-1 / (2 * n))
s_n
<- uniroot(
root plogis(q = qlogis(s_n), scale = sigma,
\(sigma) lower.tail = FALSE) - q/2,
interval = c(0.1, 10))
$root
root }
Weakly informative exponential power prior
Boonstra, Barbaro, and Sen (2019) suggested an exponential power prior:
\(p(\alpha) \propto \exp{(-\text{abs}({\alpha / \sqrt(2) \sigma})^\gamma)}\)
target += -abs((alpha) / (sqrt(2.0) * alpha_scale))^(alpha_power);
Similar to the method for the logistic prior, choosing \(\sigma\) can be done with the following function:
<- function(gamma, n, q) {
ep_sigma
<- exp(-1 / (2 * n))
s_n
<- uniroot(
root pgamma(q = (qlogis(s_n) / (sqrt(2) * sigma))^gamma,
\(sigma) shape = 1 / gamma, lower.tail = FALSE) - q,
interval = c(0, 10))
$root
root }
Prior on \(\beta\)
Weakly informative Student-t prior
Ghosh, Li, and Mitra (2018) suggested a Student-t prior on scaled predictors.
\(\beta \sim \text{StudentT}(\nu, 0, \sigma)\)
With \(\nu\) between 3 and 7, and \(\nu = 7\), \(\sigma\) = 2.5 sensible defaults.