-
Notifications
You must be signed in to change notification settings - Fork 22
Likelihood and Information Criteria
This page documents methods for evaluating model fit, comparing models, and assessing forecast accuracy in smooth models.
Note: In Python,
loglik,aic,aicc,bic, andbiccare available as properties. Other methods (pointLik, pAIC, pBIC, accuracy) are not yet implemented.
Extracts the log-likelihood value from the fitted model.
model <- adam(AirPassengers, "MMM", lags=12)
# Get log-likelihood
ll <- logLik(model)
print(ll)
# Access the value
as.numeric(ll)
# Degrees of freedom
attr(ll, "df")from smooth import ADAM
model = ADAM(model="MMM", lags=12)
model.fit(y)
# Get log-likelihood
ll = model.loglikR: Returns an object of class "logLik" containing:
- The log-likelihood value
- Degrees of freedom (number of estimated parameters)
- Number of observations
Python: Returns a float with the log-likelihood value.
Returns a vector of point log-likelihoods for each in-sample observation. Useful for identifying observations that contribute most to the likelihood.
Read the paper about this: DOI 10.1080/01605682.2026.2620516 or on github.
Python: Not yet implemented.
library(greybox) # Required for pointLik functions
model <- adam(AirPassengers, "MMM", lags=12)
# Point log-likelihoods
pll <- pointLik(model)
# Sum equals total log-likelihood
sum(pll)
logLik(model)
# Identify problematic observations
which.min(pll) # Worst fitting observation
# Plot
plot(pll, type="h", main="Point Log-Likelihoods")
abline(h=0, col="red")- Identify outliers (observations with very low likelihood)
- Diagnostic for model specification
- Used in point information criteria (pAIC, pBIC etc)
Standard information criteria for model selection.
model <- adam(AirPassengers, "MMM", lags=12)
# Individual criteria
AIC(model) # Akaike Information Criterion
AICc(model) # Corrected AIC (for small samples)
BIC(model) # Bayesian Information Criterion
BICc(model) # Corrected BICfrom smooth import ADAM
model = ADAM(model="MMM", lags=12)
model.fit(y)
# Individual criteria
model.aic # Akaike Information Criterion
model.aicc # Corrected AIC (for small samples)
model.bic # Bayesian Information Criterion
model.bicc # Corrected BICR: Returns numeric values for each criterion.
Python: Each property returns a float.
| Criterion | Formula | Best For |
|---|---|---|
| AIC | -2·logLik + 2·k | General use |
| AICc | AIC + 2k(k+1)/(n-k-1) | Small samples (n/k < 40) |
| BIC | -2·logLik + k·log(n) | Large samples, parsimony |
| BICc | BIC + k·(log(n)+1)·k/(n-k-1) | Small samples, parsimony |
Where k = number of parameters, n = number of observations.
# Fit different models
model1 <- adam(AirPassengers, "ANN", lags=12)
model2 <- adam(AirPassengers, "AAN", lags=12)
model3 <- adam(AirPassengers, "AAA", lags=12)
# Compare using AICc
AICc(model1)
AICc(model2)
AICc(model3)
# Lower is better
models <- list(model1, model2, model3)
sapply(models, AICc)Point versions of information criteria based on pointLik(). These help identify observations that contribute most to model complexity.
Python: Not yet implemented.
library(greybox) # Required for point IC functions
model <- adam(AirPassengers, "MMM", lags=12)
# Point information criteria
pAIC(model)
pAICc(model)
pBIC(model)
pBICc(model)These return vectors (one value per observation) rather than single values.
Computes various accuracy measures for the model's forecasts.
Python: Not yet implemented.
model <- adam(AirPassengers, "MMM", lags=12, h=12, holdout=TRUE)
# Compute accuracy measures
accuracy(model)See greybox::measured for the full list.
- Svetunkov, I. et al. (2026). Statistical and Business Analytics with R. Online: https://openforecast.org/sba/.
- Information criteria: Section 16.4.
- Svetunkov, I. (2023). Forecasting and Analytics with the Augmented Dynamic Adaptive Model (ADAM). Online: https://openforecast.org/adam/.
- ADAM - Main ADAM function
- AutoADAM - Automatic model selection
- Residuals-and-Errors - Forecast error analysis
- Coefficients-and-Parameters - Parameter extraction