Spike and slab regression is a Bayesian variable selection method, often used in the context of linear regression to identify which predictors (variables) are relevant. The "spike and slab" refers to a specific prior distribution placed on the regression coefficients. Here’s a breakdown of the math behind it:
1. Linear Regression Model
Suppose you have data ((\mathbf{X}, \mathbf{y})), where (\mathbf{X}) is an (n \times p) matrix of predictors and (\mathbf{y}) is an (n)-dimensional response vector. The standard linear regression model is:
[
\mathbf{y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\epsilon}
]
where (\boldsymbol{\epsilon} \sim \mathcal{N}(0, \sigma^2 \mathbf{I})).
2. The Spike and Slab Prior
The key idea is to place a mixture prior on each regression coefficient (\beta_j):
[
\beta_j \sim (1 - \pi_j) \cdot \delta_0 + \pi_j \cdot \mathcal{N}(0, \tau^2)
]
- Spike: (\delta_0) is a Dirac delta function at zero (i.e., a point mass at zero). This represents the belief that the coefficient is exactly zero (variable is excluded).
- Slab: (\mathcal{N}(0, \tau^2)) is a normal distribution with large variance, representing the belief that the coefficient could be nonzero (variable is included).
- (\pi_j) is the prior probability that variable (j) is included.
Alternatively, you can introduce a latent indicator variable (z_j):
[
z_j \sim \text{Bernoulli}(\pi_j)
]
[
\beta_j \mid z_j \sim (1 - z_j) \cdot \delta_0 + z_j \cdot \mathcal{N}(0, \tau^2)
]
3. Full Model Specification
The full Bayesian model is:
[
\begin{align*}
\mathbf{y} \mid \mathbf{X}, \boldsymbol{\beta}, \sigma^2 &\sim \mathcal{N}(\mathbf{X}\boldsymbol{\beta}, \sigma^2 \mathbf{I}) \
\beta_j \mid z_j, \tau^2 &\sim (1 - z_j) \cdot \delta_0 + z_j \cdot \mathcal{N}(0, \tau^2) \
z_j &\sim \text{Bernoulli}(\pi_j) \
\sigma^2 &\sim \text{Inverse-Gamma}(a, b) \
\tau^2 &\sim \text{Inverse-Gamma}(c, d)
\end{align*}
]
4. Posterior Inference
The goal is to compute the posterior distribution over (\boldsymbol{\beta}), (\mathbf{z}), (\sigma^2), and (\tau^2):
[
p(\boldsymbol{\beta}, \mathbf{z}, \sigma^2, \tau^2 \mid \mathbf{y}, \mathbf{X})
]
This is typically done via Markov Chain Monte Carlo (MCMC) methods, such as Gibbs sampling, because the posterior is not analytically tractable.
- For each variable, the posterior probability that (z_j = 1) (i.e., that variable (j) is included) can be interpreted as the variable's importance.
5. Why is it Useful?
- Variable selection: The spike-and-slab prior encourages sparsity (many coefficients exactly zero).
- Uncertainty quantification: Provides posterior probabilities for inclusion of each variable.
- Flexible: Can be extended to generalized linear models, hierarchical models, etc.
6. Connection to Lasso
- The spike-and-slab prior is a Bayesian analog to the Lasso (which uses an (\ell_1) penalty for sparsity).
- Unlike Lasso, spike-and-slab can set coefficients exactly to zero and provides a probabilistic framework.
References
If you want to see a worked example or code, let me know!