config-i1 / greybox

Regression model building and forecasting in R
30 stars 7 forks source link

Introduce heteroscedasticity model #46

Closed config-i1 closed 3 years ago

config-i1 commented 3 years ago

This can be a new parameter in alm(), determining the formula for the scale, e.g. sigma^2_j = a_0 + a_1 x_j + a_2 x_j^2:

scaleFormula = ~x+x^2

This is relatively easy to implement and it can be estimated together with the parameters for the location (that are already in place) via the maximisation of likelihood. This probably does not make sense for the other losses.

Steviey commented 3 years ago

+1

config-i1 commented 3 years ago

Things to do in alm:

  1. scale parameter, accepting formula;
  2. model.matrix for scale;
  3. Estimation of scale, after getting the location correctly;
  4. Return scale formula if it was provided in scale;
  5. Also return either fixed scale or scale for each observation;
  6. Return estimated parameters for scale;
  7. Accept initial parameters for scale;
  8. Modify all methods that use scale;
  9. Summary for scale part.

While step 3 can be done simultaneously, this would complicate and slow down the estimation process. Check how this is done in GAMLSS.

A better option for the scale is to implement it in the style of occurrence part of the model (i.e. separate model of a separate class). This way the same scale model can be used together with different location models.

config-i1 commented 3 years ago

Ths stuff currently works for Normal distribution and might work for others (needs checking). (1) - (9) are done (ignoring 9). Estimation is done simultaneously.

Things left to do:

  1. Substitute constant sigma() with the time varying stdev for all in-sample functions (hatvalues, rstandard, rstudent);
  2. Get variances from time varying scale in predict and other methods (use connection between scale and variance in distributions).
  3. Make sure that the thing works with all distributions
  4. Develop scaleModel + occurrence
  5. Decide how to improve the work of optimiser (make it faster and more efficient)
  6. Make coefbootstrap() work with scaleModel
config-i1 commented 3 years ago

(1) is done.

config-i1 commented 3 years ago

A new model and a new approach is being developed in ac1c75999f660c6830d7a1389f3acba0f3e3ad23

config-i1 commented 3 years ago

sm method for the scale model based on any other linear model.

Things left:

  1. Get variances from time varying scale in different methods (use connection between scale and variance in distributions) - need to check if this is needed anywhere else.
  2. Make sure that the thing works with all distributions
  3. Develop scaleModel + occurrence
  4. Make coefbootstrap() work with scaleModel
config-i1 commented 3 years ago

(4) is done.

config-i1 commented 3 years ago

Looks like only (3) is left

config-i1 commented 3 years ago

All done. Now I need to update the vignette.

config-i1 commented 3 years ago

Done.