TL;DR
The Bayesian information criterion (BIC) is a score for comparing models fitted to the same data. It takes the model's best log-likelihood, which can only improve when you add parameters, and subtracts a penalty of for each parameter, where is the number of observations. The lowest score marks the model with the highest approximate posterior probability, provided every candidate started equally likely. It makes extra parameters earn their place.
Builds on: Model Selection, Marginal Likelihood, Maximum Likelihood Estimation · Leads to: Bayesian Model Averaging, Bayes Factor
Where it's used
Choosing how flexible a regression should be. Suppose you predict house prices from floor area for 200 houses. Your candidates are a straight line, a curve with a squared term, and a curve with a cubic term. Each added term lowers the training error, so training error alone always picks the cubic. BIC scores all three on the same 200 houses and says whether the extra terms pay for themselves. This is the everyday use in Linear Regression work.
Deciding how many groups a mixture has. A Mixture Model of customer spending must be told how many groups to fit. Fitting one group, two groups, or three groups each gives a different likelihood, and more groups always fit the training data at least as well. BIC compares the fits and charges each extra group its share of parameters, so the analyst does not have to guess the number from the histogram.
Approximating model averaging. Bayesian model averaging weights each candidate by its marginal likelihood, which is often an integral with no closed form. BIC gives a quick approximation that is good enough to compute those weights, as used in Bayesian Model Averaging.
How it works
Take one tiny instance from start to finish. There are ten observations, so . Model A has no free parameters: it predicts the same thing whatever the data look like. Model B has one free parameter that is fitted to the data. Both models are fitted by Maximum Likelihood Estimation.
- Fit each model and record its best log-likelihood. For A there is nothing to fit, and its best log-likelihood is . For B the fit gives . Check: B fits better, as it must, because it has the extra freedom.
- Count the free parameters. and . Check: both models are scored on the same ten observations, so the comparison is fair.
- Compute the penalty per parameter. . Check: this is a fixed number for the whole comparison, because is the same for both models.
- Multiply the penalty by the parameter count. A pays . B pays . Check: a model with no parameters pays nothing.
- Turn the fit into a cost and add the penalty. BIC is the penalty minus twice the log-likelihood. For A: . For B: . Check: and .
- Pick the lowest score. , so B wins. The extra parameter improved by 4 units and cost 2.303, so it paid its way. Had B's log-likelihood been , its score would be , which loses to A.
The steps can be drawn as a flow:
flowchart LR A[Fit each model by maximum likelihood] --> B[Record the best log-likelihood] B --> C[Count the free parameters d] C --> D["Score = d ln n minus 2 times log-likelihood"] D --> E[Pick the lowest score]
The penalty per parameter is what separates BIC from its close cousin AIC. The plot shows how the two penalties grow with the sample size .
- BIC: ln n
- AIC: 2
The math
Here is the number of observations, is the number of free parameters in the model, is the natural logarithm, and is the best log-likelihood the model reaches on the data. Lower is better.
The formula is a direct restatement of the walkthrough. is the value at the maximiser , that is , where is the log of the likelihood function.
Steps 1 to 3 in symbols
Fitting means finding , the parameter value that makes the data most probable. Then . For model A in the walkthrough, , and . The penalty term needs , which is 10 here, and
Steps 4 to 6 in symbols
For model B, , so the penalty is . The score is
For A, . The rule is to pick , which is B.
Where the formula comes from
BIC is an approximation to the marginal likelihood, the probability of the data averaged over the model's prior on its parameters:
Here is the prior density. The integral is hard to evaluate. The Laplace approximation replaces the integrand with a Gaussian bump centred on its peak, at . The bump gets narrower as grows, and its volume depends on and on . Keeping only the terms that grow with gives
Multiplying by gives . The dropped terms do not grow with , so they matter less and less as data accumulate. This is why the approximation is good for large samples and rough for small ones.
If the candidates start with equal prior probability, the posterior probability of model is proportional to , so it is roughly proportional to . That is how the lowest BIC turns into a probability ranking, and how differences in BIC turn into weights.
Worked examples
Model A has and . Model B has and . Both are fitted to 100 observations, and .
- Penalty for A: . Score: .
- Penalty for B: . Score: .
- Compare: , so A has the lower score.
Interpretation: B's extra parameter raised the log-likelihood by only , which is worth on the scale. That is less than the penalty, so A is kept.
A regression of a response on one predictor is compared with and without a squared term. The linear model has (intercept and slope) and . The quadratic has and . Again and .
- Linear penalty: . Linear score: .
- Quadratic penalty: . Quadratic score: .
- Compare: , so the quadratic wins by .
Interpretation: the squared term improved by . The penalty for the one extra parameter is , and is the net gain in favour of the quadratic.
A survey of customers records two numbers per customer. A two-dimensional Gaussian group has two means, three covariance entries and one mixing weight, so six parameters. Subtracting one for the weights, which must sum to one, gives for groups. Here , and for , and . The best log-likelihoods are , and . Also .
- One group: . Score: .
- Two groups: . Score: .
- Three groups: . Score: .
- Lowest score: two groups, at .
Interpretation: going from one group to two improves by , which far exceeds the extra penalty of about . Going from two groups to three improves it by only , less than the penalty of about , so the third group is not supported.
Try it: suppose the three-group log-likelihood were instead of . Which does BIC choose now? Answer: the three-group score becomes , which is lower than , so BIC chooses three groups. Measured against the two-group fit, the three-group fit improves by (from to ), which outweighs the extra penalty of about .
Common mistakes and tradeoffs
It is tempting to think that the model with the lowest BIC is the true model. In fact BIC only ranks the candidates it was given. If the truth is not among them, the winner is merely the least bad. Its approximation is about posterior probability among the candidates, not about truth in the world.
It is tempting to think that a BIC value is a probability. In fact the absolute value means nothing; only differences matter. A difference between two models corresponds to a ratio of approximate posterior probabilities of under equal priors. A difference of 2 is a ratio of about .
It is tempting to compare BIC values across datasets. In fact the comparison is valid only when both models are fitted to the same observations with the same response. Dropping a row with a missing value changes , and the scores are no longer comparable.
It is tempting to count parameters loosely. In fact must be counted the same way for every model, and the count must include every free parameter that was fitted. Forgetting a variance in one model and including it in another silently favours the model with the smaller count.
Finally, the approximation depends on being large compared with . With small samples the dropped terms matter, and a held-out check is safer.
| Situation | BIC is a good choice | Use something else |
|---|---|---|
| Large sample, a true structure is among the candidates | Yes: BIC tends to find the smaller true model | |
| Prediction is the goal and data are plentiful | Often picks too small a model | AIC or held-out error |
| Very few observations | Penalty approximation is weak | Cross-Validation |
| Models are far from the truth | Approximations break down | Held-out scoring |
History
Gideon Schwarz published the criterion in 1978 in a short paper on estimating the dimension of a model. He derived it as a large-sample approximation to the posterior probability of each model, which is why it carries the Bayesian name. Hirotugu Akaike had proposed a different penalised score in 1974, the AIC, which starts from prediction error instead.
The criterion's appeal was that it turned a judgement about which model to trust into a calculation with a clear penalty. In the 1990s Adrian Raftery and colleagues promoted BIC as a practical approximation to the marginal likelihood, which made it a common shortcut for model averaging.
Recap
- A fitted model's best log-likelihood always improves when parameters are added, so raw fit cannot choose a model.
- BIC subtracts a penalty of from the fit, scored as .
- The penalty comes from a Laplace approximation to the marginal likelihood, and it is accurate for large .
- The lowest BIC is the model with the highest approximate posterior probability, when the candidates start equally likely.
- Read next: Bayesian Model Averaging for weighting models by BIC, and Bayes Factor for the exact comparison that BIC approximates.
Check yourself
QuestionRecall: what does the BIC penalty per parameter grow with, and what does that mean for large datasets?Show answer
The penalty per parameter is , which grows with the sample size . With more data, each parameter costs more, so BIC increasingly favours simpler models. A model's extra parameters must improve the fit by a larger amount as grows.
QuestionComputation: a model has , , and . Compute its BIC. Use .Show answer
The penalty is . The fit term is . Adding them gives .
QuestionWhy: why can't you pick the best model by comparing training log-likelihoods alone?Show answer
Adding a parameter never lowers the best training log-likelihood, because the larger model contains the smaller one as a special case. So training fit always favours the most flexible model, including one that fits the noise. The penalty is what offsets this bias.
QuestionApplied: two models are fitted to the same 1000 observations. Model X has BIC 500.0 and model Y has BIC 502.0. Which is preferred, and roughly how much more probable is it under equal prior probabilities?Show answer
Model X is preferred, since it has the lower score. The difference is 2.0, so the approximate posterior probability ratio is . X is roughly 2.7 times as probable as Y, which is a real but modest preference, not a certainty.