tidyverts / fabletools

General fable features useful for extension packages
http://fabletools.tidyverts.org/
89 stars 31 forks source link

Calculation of combination weights in the combination_ensemble function #320

Open xqnwang opened 3 years ago

xqnwang commented 3 years ago

In the combination_ensemble() function, the inverse variances weights are calculated using innovation residuals (residuals on the transformed scale) obtained from individual models rather than response residuals. I think that's a mistake especially if it's a multiplicative error model for ETS. This may be fixed by replacing the original code in the combination_ensemble() function inv_var <- map_dbl(x, function(x) 1/var(residuals(x)$.resid, na.rm = TRUE)) with inv_var <- map_dbl(x, function(x) 1/var(residuals(x, type = "response")[[".resid"]], na.rm = TRUE)).