I am doing work on AIC comparisons. For this purpose, I am trying to understand how log-likelihood is calculated for exponential smoothing models (ETS models) in different R packages.
ets in R forecast and
es in R smooth appear to give very different log-likelihood values for the same model fitted to the same data set, as follows.
# data simulation y as ETS(A,N,N) set.seed(546) n = 300 y <- smooth::sim.es("ANN", obs = n) # fit E(A,N,N) and ARIMA(0,1,1) models to simulated data with R packages smooth and forecast es_smooth_model <- smooth::es(y$data, model = "ANN", initial ="optimal") es_forecast_model <- forecast::ets(y$data, model = "ANN", lambda = NULL)
Not surprisingly, both models give near identical fitted values, residuals, forecasts, coefficients, error variances, etc.
However, their log-likelihood estimates give very different values
# comparing loglikelihoods es_smooth_model$logLik # -1215.57 es_forecast_model$loglik # -1645.456
Manual calculation for both models (assuming Gaussian error distributions) gives:
#manual loglikelihoods: # es_smooth_model : -1215.578 - 0.5 * (n * (log(2) + log(pi) + log(es_smooth_model$s2)) + 1/ es_smooth_model$s2 * sum(es_smooth_model$residuals^2)) # es_smooth_model : -1215.574 - 0.5 * (n * (log(2) + log(pi) + log(es_forecast_model$sigma2)) + 1/ es_forecast_model$sigma2 * sum(es_forecast_model$residuals^2))
Can somebody help me to understand why
forecast::ets gives a different log-likelihood value? And which of the two log-likelihoods is the correct value?