AI Glossary / Probabilistic machine learning / Intermediate

Spike-and-slab distribution

Definition

A spike-and-slab distribution is a mixture with one component concentrated at or near zero and another spread over a broader range. In Bayesian modeling, it is often used as a prior for coefficients, representing uncertainty about whether an effect is absent or small, versus substantial enough to belong to the broader component.

What it means

The spike expresses a preference for no effect or a very small effect. The slab allows effects over a wider range. A mixing probability controls how much prior probability is assigned to each possibility.

There are two important versions. A point-mass spike puts positive probability on an exactly zero coefficient. A narrow continuous spike shrinks coefficients toward zero but does not usually make them exactly zero. Both are called spike-and-slab distributions, so an explanation or implementation must specify which version it uses. The slab need not be uniform; a Gaussian slab is one common choice.

How it works

Introduce an indicator z that selects a component. For an exact-zero version, z = 0 sets coefficient beta to zero; z = 1 draws beta from the slab. If P(z = 1) = pi, the prior is a mixture of a zero point mass with weight 1 minus pi and the slab with weight pi.

Observed data update both the component probability and the coefficient distribution within the slab. Posterior inclusion probability means P(z = 1 given data). Predictions can average over inclusion uncertainty rather than select one model immediately.

With many coefficients, there are many possible inclusion configurations. Inference may use sampling or approximation, and the chosen algorithm must accommodate the specified prior. Correlated predictors can divide or exchange evidence for inclusion. Standardizing predictors helps make coefficient scales and slab choices interpretable, but does not remove their dependence.

Three practical examples

1. Demand drivers: assign selection priors to candidate regression coefficients for promotions and calendar variables. Report inclusion uncertainty and predictive performance rather than translating every selected association into a causal demand driver.

2. Sensor selection: assess which candidate measurements contribute to a prediction model. If several sensors are redundant, inspect joint inclusion behavior before interpreting a low individual probability as proof that a sensor is useless.

3. Scientific feature screening: encode a prior belief that relatively few candidate effects are substantial. Examine how results change with the inclusion prior and slab scale, especially when measurements provide weak evidence.

Think of it this way

Think of a switch attached to a dial. The switch can turn an effect off, while the dial controls its size when active. That resembles a point-mass spike and continuous slab. A continuous spike is different: its switch leaves a tiny adjustable effect rather than fully disconnecting it. The analogy does not mean inclusion is observed directly; the model remains uncertain about both switch and dial.

Worked example

Suppose one noisy measurement satisfies y given beta is Normal(beta, variance 1), and the observed value is y = 2. Before seeing it, assign probability 0.8 to beta = 0 and probability 0.2 to a Normal(0, variance 3) slab.

Under the spike, y has a Normal(0, variance 1) distribution. Under the slab, integrating beta gives Normal(0, variance 4). The ratio of the slab's predictive density to the spike's at y = 2 is one half times exp(1.5), approximately 2.2408.

The posterior inclusion probability is (0.2 times 2.2408) divided by (0.8 plus 0.2 times 2.2408), approximately 0.3591. The observation raises inclusion probability from 0.2, but does not make inclusion certain or even more likely than exclusion.

Conditional on slab membership, normal updating gives beta a posterior mean of 1.5 and variance 0.75. Averaging across both components gives an overall posterior mean of approximately 0.3591 times 1.5 = 0.5386.

This posterior mean is nonzero even though the posterior still puts approximately 0.6409 probability on exactly zero. A posterior mean summarizes uncertainty differently from choosing the most probable component. All numbers follow from the stated one-observation model; they are not fitted results from a business dataset.

Illustrative case study

Fictional case: Larch Retail considers many overlapping promotional indicators. Its analyst uses a point-mass spike with a Gaussian slab and publishes the prior inclusion probability and coefficient scale alongside results.

Two indicators frequently move together, and different sampled models select different members of the pair. The analyst examines their combined predictive contribution rather than declaring one universally unimportant. The team also compares predictions averaged over models with a simpler selected model. This fictional example illustrates uncertainty reporting and does not claim that the prior has identified causal promotional effects or guaranteed better sales forecasts.

Common misconceptions and mistakes

Do not compare the height of a continuous density directly with the probability mass at zero. These are different mathematical quantities.

Do not assume every spike-and-slab implementation produces exact zeros. A continuous spike generally does not.

Do not interpret posterior inclusion probability as the probability that a variable causes the outcome. It concerns a specified component assignment within a particular model and prior. A very broad slab is not automatically uninformative: its spread changes the integrated evidence for inclusion and can affect conclusions substantially.

Business use

The method can help communicate which effects have uncertain support while incorporating model uncertainty into predictions. Agree beforehand how inclusion probabilities will inform decisions, since a probability alone does not determine whether collecting or using a feature is worthwhile.

Evaluate sensitivity to the inclusion probability, slab width, predictor scaling and correlated alternatives. Also consider measurement cost and predictive performance on held-out data. Document whether published coefficient summaries average over excluded models or condition on inclusion, because these summaries answer different questions.

People also ask

Must the spike be exactly at zero?

No. Some versions use a narrow continuous distribution around zero.

Is the slab always uniform?

No. Gaussian and other broader distributions are possible.

Can the posterior mean be nonzero while exclusion is more probable?

Yes. The worked example shows precisely that combination.

Check your understanding

Why does the worked example's overall posterior mean differ from 1.5?

Answer: The value 1.5 conditions on slab membership. Averaging also includes the zero component, so the overall mean is approximately 0.5386.

Related terms

  • Mixture distribution
  • Shrinkage
  • Bayes factor
  • Regression coefficients
  • Bayesian variable selection
  • posterior inclusion probability
  • sparsity prior
  • model averaging
  • regression coefficient

Learn next

Repeat the example with a different prior inclusion probability while keeping the likelihood fixed. Then compare a point-mass spike with a narrow Gaussian spike and identify which summaries still represent exact exclusion.

More in Probabilistic machine learning

  • Smoothing inference with twisted objectives - Smoothing inference with twisted objectives, or SIXO, is a method for learning probabilistic sequence models using sequential Monte Carlo targets that...
  • Sparse variational Gaussian process - A sparse variational Gaussian process is an approximate Gaussian process model that represents posterior information using a smaller set of inducing...
  • Spectral mixture kernel - A spectral mixture kernel is a covariance function built by modeling a stationary process's frequency spectrum with a mixture of Gaussian components.
  • Stationary kernel - A stationary kernel is a covariance function whose value depends on the displacement between two inputs, rather than their absolute locations.
  • Statistical linear regression - Statistical linear regression, in nonlinear Bayesian estimation, approximates a relationship between uncertain variables by an affine transformation plus an...
  • Stein discrepancy - A Stein discrepancy measures how strongly a candidate distribution violates identities that should hold under a target probability distribution.

Sources

Malsiner-Walli and Wagner, Comparing Spike and Slab Priors for Bayesian Variable Selection: https://arxiv.org/pdf/1812.07259

The point-mass versus continuous-spike distinction and inclusion interpretation were checked in the primary research paper. The normal-model calculation and fictional case are original illustrations. Independent review consulted Section 2.2 for indicator probabilities and point-mass versus continuous spikes.

Previous: Sphericity Next: Spike-and-slab regression

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer