mvgam icon indicating copy to clipboard operation
mvgam copied to clipboard

Future enhancement wishlist

Open nicholasjclark opened this issue 1 year ago • 6 comments

  • Matern covariance functions for GP effects / trends
  • 2d FFT GPs (or even 1d) for complex but stationary GP effects (https://arxiv.org/pdf/2301.08836.pdf)
  • Multivariate normal observation models
  • Move all plots to ggplot2 for broader customisability
  • RW MRF basis for inclusion in dynamic terms and time-varying seasonality
  • Stepwise flat trends (https://github.com/facebook/prophet/pull/1794/files)
  • Linear predictors for other observation parameters (distributional regression)
  • Some easy to follow guidelines on hypothesis testing for ecological models
  • Correlated random effects (add cor option in bs = 're' smooths to estimate random intercepts or slopes from a noncentered mvnormal); handy for 'residual' correlations such as JSDMs

nicholasjclark avatar Dec 12 '23 21:12 nicholasjclark

Apologies if this is the wrong place (happy to move) to ask this: would it be possible to add the binomial family into the supported families?

Example use case:

Given binary data [0, 1] of absence/presence of a disease, we expect the positivity to change in a sampled population over time, and would like to extract this from the logistic regression while taking the temporal trend into account (currently just doing an mgcv spline, but would prefer a GP, AR, RW).

Love the package, planning to dig more into the forecasting aspect now winter has ended in our northern hemisphere and considering whether we can nowcast as well.

jonathonmellor avatar Mar 14 '24 20:03 jonathonmellor

Thanks @jonathonmellor, yes absolutely. I'm planning to include Binomial and Beta-Binomial. Happy to make that a first priority if it can be useful to you

nicholasjclark avatar Mar 15 '24 02:03 nicholasjclark

That would be amazing thank you @nicholasjclark ! For awareness I am also exploring upgrading our RSV age-region stratified forecasting model to mvgam. Great to see how much progress has been made with the package, well done!

jonathonmellor avatar Mar 15 '24 09:03 jonathonmellor

Hi again @jonathonmellor, I've pushed a new release that brings support for Binomial, Bernoulli and Beta-Binomial. Still working on documentation to show how these work but you can try them out now if you like. The examples I use in the test script give an idea of how they should function: https://github.com/nicholasjclark/mvgam/blob/master/tests/testthat/test-binomial.R. Thanks again for the suggestion, and do let me know if I can be of help to upgrade your models

nicholasjclark avatar Mar 22 '24 05:03 nicholasjclark

Amazing, thanks @nicholasjclark! I've had a look for my use case and got the modelling working on a subset of the data. I think I have an additional challenge as this is a survey cohort with irregular temporal sampling - as a result I needed to do 1 series per participant, which makes the majority of the data empty because of the time x series requirement. The end product would be an MRP, with a postratification to the whole population.

Model formula roughly:

is_positive ~ s(time) + s(time, by=age_group) + s(time, by=region), bernoulli family. Was hoping to do a GP instead of a cubic regression with mvgam. Each participant gives a survey response every month, with testing windows opening and closing. So multiple data points (survey responses) per time, the question of "what is a series in this case" became difficult due to the pooling used. I think due to the size of the data (400,000 records) this might not be the best use case, but I am still planning on upgrading our gam forecasting approaches away from smoother extrapolation to the more principled approaches in this package.

jonathonmellor avatar Mar 24 '24 12:03 jonathonmellor

Thanks @jonathonmellor for the explanation. That does sound interesting and challenging. Would you mind sharing an example of what the data might look like so I can think about whether anything else could be done?

nicholasjclark avatar Mar 25 '24 03:03 nicholasjclark