The definition of the Bayesian information criterion is usually given as $$\operatorname{BIC} = -2 \text{ln}(L) + k\text{ln}(n)\,,$$ where $\ln(L)$ is the maximized log-likelihood of the data given a particular model, $k$ is the number of free parameters that this model has, and finally $n$ is the number of data points that the model is being fit to.

If I had a model which predicts the number of correct responses in two experimental conditions with 100 trials each, and my data consisted of the number of correct responses in each of the two conditions (e.g., 34 out of 100), then what exactly should I use for $n$, 2 or 200?


Nameless is wrong.

Math example

Raw Data: (1,1,0,0,1,1) (first three entries are Item 1 (repeated three times), last three Item 2 (likewise repeated 3 times)

corresponding predictions Model 1: (.5,.5,.5,.6,.6,.6)
corresponding predictions Model 2: (.9,.9,.9,.5,.5,.5)
-loglikelihood of Model 1: 4.01
-loglikelihood of Model 2: 4.59

The BIC penalty for each additional parameter would be ln(6)=1.79

BIC Model 1 (2 parameters): 11.62
BIC Model 2: (4 parameters): 16.35
Difference: 4.73 (rounded)

Aggregated Data (else same data): data=(2,2) (first entry is Item 1 (counted 2 times of 3), second one is Item 2 (likewise counted 2 out of 3 times) (same as before:)

corresponding predictions Model 1: (.5,.6)
corresponding predictions Model 2: (.9,.5)
-loglikelihood of Model 1: 1.82
-loglikelihood of Model 2: 2.39

When using n=2 (instead of 6 as with raw data) the BIC penalty for each additional parameter would be ln(2)=.69

BIC Model 1 (2 parameters): 5.03
BIC Model 2: (4 parameters): 7.56
Difference: 2.53

Note: this is a different result, than with the raw data above and underestimates the penalty!

When using n=6 in this case,
BIC Model 1 (2 parameters): 7.22
BIC Model 2: (4 parameters): 11.96
Difference: 4.73!

Note: This is the same BIC difference as with using raw data, although the data was aggregated and the loglikelihoods differ.

The reason is: althoug summing up 6 estimated -loglikelihoods instead of 2 (aggregated) leads to higher loglikelihoods in total for each model, but the difference between the -logliklehoods of both models is totally the same, no matter whether you are using raw or aggregated data, as long at is is the same data, and the same model prediction.

Use TOTAL SAMPLE SIZE (or underestimate the penalty) I wonder how many people did this wrong until now... :)


That depends on how you set up your data. If you have a binary variable that gives you 1's and 0's for correct and incorrect responses, and use these for estimation (e.g., with logistic regression) then you have $n=200$ observations.

If you don't use those 0's and 1's, but just use condition means (e.g., 34/100), then $n=2$. This should be clearly visible from your data set.

By the way: almost every statistical software package reports the number of observations that have been used to obtain estimates. You can use that.

  • $\begingroup$ Thanks. Can possibly point me to any literature which explains why exactly this is so? $\endgroup$ – Pavel May 15 '13 at 0:38
  • $\begingroup$ I don't think there is a book that tells you how many observations you have. Why don't you give an excerpt of your data, then it might become clearer. Or tell us what model you estimate. $\endgroup$ – Nameless May 15 '13 at 8:56
  • $\begingroup$ I'm afraid I failed to communicate my actual question. I know how many data points I have. I was actually asking for literature which contains a good explanation of why the number of data points enters the calculation of BIC in exactly the way it does. $\endgroup$ – Pavel May 15 '13 at 12:56
  • $\begingroup$ You could look at the original article and go from there: Schwarz, Gideon E. (1978). "Estimating the dimension of a model". Annals of Statistics 6 (2): 461–464. $\endgroup$ – Nameless May 16 '13 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.