Solution (source code)

= Solution

For a model with maximized log likelihood $\ell(\widehat\theta)$, $k$ fitted parameters, and $n$ observations,
$$
\boxed{\operatorname{AIC}=-2\ell(\widehat\theta)+2k,}
\qquad
\boxed{\operatorname{BIC}=-2\ell(\widehat\theta)+k\log n.}
$$
Both combine goodness of fit with a complexity penalty; smaller values are preferred.