Skip to content

Commit

Permalink
fix one bad test; update site
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasjclark committed Nov 18, 2024
1 parent 698fe0c commit a537853
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 25 deletions.
3 changes: 2 additions & 1 deletion R/globals.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ utils::globalVariables(c("y", "year", "smooth_vals", "smooth_num",
"horizon", "target", "Series", "evd", "mean_evd",
"total_evd", "smooth_label", "by_variable",
"gr", "tot_subgrs", "subgr", "lambda",
"level", "sim_hilbert_gp", "trend_model"))
"level", "sim_hilbert_gp", "trend_model",
"jags_path"))
8 changes: 4 additions & 4 deletions docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ always_allow_html: true
## mvgam
**M**ulti**V**ariate (Dynamic) **G**eneralized **A**ddivite **M**odels

The goal of `mvgam` is to use a Bayesian framework to estimate parameters of Dynamic Generalized Additive Models (DGAMs) for time series with dynamic trend components. The package provides an interface to fit Bayesian DGAMs using `Stan` as the backend. The formula syntax is based on that of the package `mgcv` to provide a familiar GAM modelling interface. The motivation for the package and some of its primary objectives are described in detail by [Clark & Wells 2022](https://besjournals.onlinelibrary.wiley.com/doi/10.1111/2041-210X.13974) (published in *Methods in Ecology and Evolution*). An introduction to the package and some worked examples are shown in this seminar: [Ecological Forecasting with Dynamic Generalized Additive Models](https://www.youtube.com/watch?v=0zZopLlomsQ){target="_blank"}.
The goal of `mvgam` is to fit Bayesian (Dynamic) Generalized Additive Models. This package constructs State-Space models that can include highly flexible nonlinear predictor effects for both process and observation components by leveraging functionalities from the impressive [`brms`](https://paulbuerkner.com/brms/){target="_blank"} and [`mgcv`](https://cran.r-project.org/web/packages/mgcv/index.html){target="_blank"} packages. This allows `mvgam` to fit a wide range of models, including hierarchical ecological models such as N-mixture or Joint Species Distribution models, as well as univariate and multivariate time series models with imperfect detection. The original motivation for the package is described in [Clark & Wells 2022](https://besjournals.onlinelibrary.wiley.com/doi/10.1111/2041-210X.13974){target="_blank"} (published in *Methods in Ecology and Evolution*), with additional inspiration on the use of Bayesian probabilistic modelling coming from [Michael Betancourt](https://betanalpha.github.io/writing/){target="_blank"}, [Michael Dietze](https://www.bu.edu/earth/profiles/michael-dietze/){target="_blank"} and [Sarah Heaps](https://www.durham.ac.uk/staff/sarah-e-heaps/){target="_blank"}, among many others.

## Installation
Install the stable version from CRAN using: `install.packages('mvgam')`, or install the development version from `GitHub` using:
Expand Down Expand Up @@ -58,7 +58,7 @@ plot_mvgam_series(data = data$data_train, series = 'all')
```
![Simulating and analysing multivariate time series with Dynamic Generalized Additive Models](man/figures/README-beta_sim-1.png)

Fit a DGAM to these series that uses a hierarchical cyclic seasonal smooth term to capture variation in seasonality among series. The model also includes series-specific latent Gaussian Processes with squared exponential covariance functions to capture temporal dynamics
Fit a State-Space GAM to these series that uses a hierarchical cyclic seasonal smooth term to capture variation in seasonality among series. The model also includes series-specific latent Gaussian Processes with squared exponential covariance functions to capture temporal dynamics
```{r, eval = FALSE}
mod <- mvgam(y ~ s(season, bs = 'cc', k = 7) +
s(season, by = series, m = 1, k = 5),
Expand Down
43 changes: 26 additions & 17 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,28 @@

**M**ulti**V**ariate (Dynamic) **G**eneralized **A**ddivite **M**odels

The goal of `mvgam` is to use a Bayesian framework to estimate
parameters of Dynamic Generalized Additive Models (DGAMs) for time
series with dynamic trend components. The package provides an interface
to fit Bayesian DGAMs using `Stan` as the backend. The formula syntax is
based on that of the package `mgcv` to provide a familiar GAM modelling
interface. The motivation for the package and some of its primary
objectives are described in detail by [Clark & Wells
2022](https://besjournals.onlinelibrary.wiley.com/doi/10.1111/2041-210X.13974)
(published in *Methods in Ecology and Evolution*). An introduction to
the package and some worked examples are shown in this seminar:
<a href="https://www.youtube.com/watch?v=0zZopLlomsQ"
target="_blank">Ecological Forecasting with Dynamic Generalized Additive
Models</a>.
The goal of `mvgam` is to fit Bayesian (Dynamic) Generalized Additive
Models. This package constructs State-Space models that can include
highly flexible nonlinear predictor effects for both process and
observation components by leveraging functionalities from the impressive
<a href="https://paulbuerkner.com/brms/"
target="_blank"><code>brms</code></a> and
<a href="https://cran.r-project.org/web/packages/mgcv/index.html"
target="_blank"><code>mgcv</code></a> packages. This allows `mvgam` to
fit a wide range of models, including hierarchical ecological models
such as N-mixture or Joint Species Distribution models, as well as
univariate and multivariate time series models with imperfect detection.
The original motivation for the package is described in <a
href="https://besjournals.onlinelibrary.wiley.com/doi/10.1111/2041-210X.13974"
target="_blank">Clark &amp; Wells 2022</a> (published in *Methods in
Ecology and Evolution*), with additional inspiration on the use of
Bayesian probabilistic modelling coming from
<a href="https://betanalpha.github.io/writing/" target="_blank">Michael
Betancourt</a>,
<a href="https://www.bu.edu/earth/profiles/michael-dietze/"
target="_blank">Michael Dietze</a> and
<a href="https://www.durham.ac.uk/staff/sarah-e-heaps/"
target="_blank">Sarah Heaps</a>, among many others.

## Installation

Expand Down Expand Up @@ -103,10 +112,10 @@ alt="Simulating and analysing multivariate time series with Dynamic Generalized
time series with Dynamic Generalized Additive Models</figcaption>
</figure>

Fit a DGAM to these series that uses a hierarchical cyclic seasonal
smooth term to capture variation in seasonality among series. The model
also includes series-specific latent Gaussian Processes with squared
exponential covariance functions to capture temporal dynamics
Fit a State-Space GAM to these series that uses a hierarchical cyclic
seasonal smooth term to capture variation in seasonality among series.
The model also includes series-specific latent Gaussian Processes with
squared exponential covariance functions to capture temporal dynamics

``` r
mod <- mvgam(y ~ s(season, bs = 'cc', k = 7) +
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-mvgam.R
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ test_that("JAGS setups should work", {
expect_true(inherits(get_mvgam_priors(y ~ s(season),
trend_model = 'RW',
data = simdat$data_train,
family = Gamma(),
family = gaussian(),
use_stan = FALSE),
'data.frame'))
mod <- mvgam(y ~ s(season),
Expand Down

0 comments on commit a537853

Please sign in to comment.