1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use crateOlsFit;
/// Gaussian log-likelihood of the fitted OLS model at its maximum-likelihood
/// residual variance.
///
/// `ℓ = −(n/2)·[ln(2π) + 1 + ln(RSS / n)]`
///
/// This is the log-likelihood **under the standard OLS normality assumption**
/// on the residuals — it is a modeling assumption, not a property of arbitrary
/// data, and the value is only meaningful to the extent that assumption holds.
/// Note the divisor is `n` (the MLE of the error variance), not `n − p`.
/// Akaike Information Criterion, `AIC = −2ℓ + 2k`.
///
/// **Parameter-count convention:** `k` is the number of regression parameters
/// (design-matrix columns, intercept included), matching `statsmodels`'
/// `OLSResults.aic`. The error variance `σ²` is *not* counted as an extra
/// parameter here. This is a convention choice — some references use `k + 1` —
/// and it is fixed this way so values line up with the `statsmodels` output this
/// crate validates against.
/// Bayesian (Schwarz) Information Criterion, `BIC = −2ℓ + ln(n)·k`.
///
/// Uses the same `k` convention as [`aic`] (regression parameters only), again
/// matching `statsmodels`' `OLSResults.bic`.