Spike and Slab Regression is a Bayesian variable selection method used in linear regression models. It's particularly useful when you have a large number of predictors, and you want to identify which ones are most relevant for predicting the outcome.
The name "spike and slab" comes from the prior distribution placed on the regression coefficients:
- Spike: A narrow peak (often a Dirac delta function at zero or a normal distribution with very small variance), representing the belief that a coefficient might be exactly zero — i.e., the corresponding variable is irrelevant.
- Slab: A broader distribution (typically a normal distribution with larger variance), representing the belief that the coefficient could take on a range of non-zero values — i.e., the variable is relevant.
📐 Mathematical Formulation
Let’s define the standard linear regression model:
y=Xβ+ϵ
Where:
- y: n×1 vector of responses
- X: n×p matrix of predictors
- β: p×1 vector of regression coefficients
- ϵ∼N(0,σ2I): error term
In spike and slab regression, each regression coefficient βj is modeled with a mixture prior:
βj∣γj∼
Where:
- γj∈{0,1}: latent binary indicator variable; γj means predictor is included in the model.
Also, we often place priors on the other parameters:
- σ2∼Inverse-Gamma(a,b)
- θ∼Beta(α,β)
🧠 Inference
Inference in spike and slab models is typically done using Markov Chain Monte Carlo (MCMC) methods such as Gibbs sampling, since the posterior distributions are not analytically tractable.
Key steps in MCMC inference:
- Sample each γj given all other parameters (i.e., decide whether to include/exclude each variable).
- Sample βj given γ (if , then ; if , sample from the slab).
This iterative process explores the space of possible models and parameter values, allowing estimation of posterior inclusion probabilities (PIPs) for each variable.
🔍 Posterior Inclusion Probabilities (PIPs)
A key output of spike and slab regression is the Posterior Inclusion Probability for each variable:
P(γj=1∣y)
This tells us how likely it is that variable j should be included in the model, given the data. These probabilities can be used for variable selection — e.g., selecting variables with PIP above a threshold like 0.5.
✅ Advantages
- Naturally incorporates uncertainty about variable selection.
- Provides probabilistic interpretation of variable importance.
- Can handle high-dimensional settings where p>n.
- Offers full posterior distributions for coefficients, not just point estimates.
⚠️ Limitations
- Computationally intensive due to MCMC sampling.
- May scale poorly with very large p unless optimized (e.g., stochastic search).
- Requires careful tuning and convergence checks.
📚 Variants & Related Methods
- Stochastic Search Variable Selection (SSVS): Similar idea but uses a single Gaussian mixture prior without exact zeros.
- Bayesian Lasso: Uses continuous shrinkage priors instead of discrete spike/slab.
- Horseshoe Prior: Another continuous shrinkage prior that mimics spike and slab behavior.
- EMVS (Expectation-Maximization for Variable Selection): Fast EM algorithm alternative to MCMC.
🧪 Example Use Case
Suppose you're trying to predict house prices using 100 features (square footage, location, age, etc.). Spike and slab regression would help determine which of those 100 features are actually predictive by estimating their posterior inclusion probabilities.
Would you like an example implementation in Python or R?