nicholasjclark / mvgam

{mvgam} R 📦 to fit Dynamic Bayesian Generalized Additive Models for time series analysis and forecasting
https://nicholasjclark.github.io/mvgam/
Other
101 stars 12 forks source link

Steps needed to include dynamic functional components #56

Open nicholasjclark opened 3 months ago

nicholasjclark commented 3 months ago
  1. Update args in dynamic() to allow multiple covariates, to use_lv and to set n_lv and trend_model so that existing options still work seamlessly but dynamic functional models are allowed. Would be especially useful if by terms still work for these so that dynamic curves could be estimated for multiple levels of a factor variable
  2. Write constructors that take the call to dynamic() and update the gam formula appropriately, ensuring that all predict() functions will work in post-processing
  3. Write functions to update the Stan code so that GP or AR1 models can be used for the factors and to ensure betas are updated appropriately
  4. Write functions to extract the beta timeseries in a format so that they can be used for prediction and forecasting; will probably need something in generated_quantities to ensure both the latent factors and the time-varying betas are able to be extracted from the rstan object
  5. Write functions to interpolate the betas to any point in time. This will likely require a wiggly spline or some kind of moving average (which will be faster) be applied to each draw of the beta timeseries so that the correct column of the overall beta matrix in predict.mvgam() can be updated before any prediction happens. This is because we will have an estimate of the beta for each discrete timepoint, but we won't have estimates for intermediate timepoints (i.e. 'time' = 1.5)
  6. Write functions to evaluate whether dynamic functional components exist in the model, or update any calls that extract betas using a wrapper that will automatically check for this so that the step above is done automatically
  7. Write methods to extend the betas ahead for forecasting purposes