Skip to content

Commit 1df1949

Browse files
author
Nicholas Clark
committed
update readme
1 parent ac39524 commit 1df1949

15 files changed

+39
-24
lines changed

README.Rmd

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ knitr::opts_chunk$set(
2121
<img src="man/figures/mvgam_logo.png" width = 120 alt="mvgam R package logo"/>[<img src="https://raw.githubusercontent.com/stan-dev/logos/master/logo_tm.png" align="right" width=120 alt="Stan Logo"/>](https://mc-stan.org/)
2222

2323

24-
*mvgam*
25-
================
24+
# mvgam
25+
26+
> **M**ulti**V**ariate (Dynamic) **G**eneralized **A**ddivite **M**odels
27+
2628
[![R-CMD-check](https://github.com/nicholasjclark/mvgam/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nicholasjclark/mvgam/actions/)
2729
[![Test status](https://github.com/nicholasjclark/mvgam/actions/workflows/test-coverage.yaml/badge.svg)](https://github.com/nicholasjclark/mvgam/actions/workflows/test-coverage.yaml)
2830
[![Coverage status](https://codecov.io/gh/nicholasjclark/mvgam/graph/badge.svg?token=RCJ2B7S0BL)](https://app.codecov.io/gh/nicholasjclark/mvgam)
31+
[![Documentation](https://img.shields.io/badge/documentation-mvgam-orange.svg?colorB=E91E63)](https://nicholasjclark.github.io/mvgam/)
2932
[![CRAN Version](https://www.r-pkg.org/badges/version/mvgam)](https://cran.r-project.org/package=mvgam)
3033
[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/grand-total/mvgam?color=brightgreen)](https://cran.r-project.org/package=mvgam)
3134

32-
The goal of `mvgam` is to fit Bayesian Dynamic Generalized Additive Models to time series data. The 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.
35+
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.
3336

3437
## Resources
3538
A series of [vignettes cover data formatting, forecasting and several extended case studies of DGAMs](https://nicholasjclark.github.io/mvgam/){target="_blank"}. A number of other examples have also been compiled:

README.md

+33-21
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,33 @@
33

44
<img src="man/figures/mvgam_logo.png" width = 120 alt="mvgam R package logo"/>[<img src="https://raw.githubusercontent.com/stan-dev/logos/master/logo_tm.png" align="right" width=120 alt="Stan Logo"/>](https://mc-stan.org/)
55

6-
# *mvgam*
6+
# mvgam
7+
8+
> **M**ulti**V**ariate (Dynamic) **G**eneralized **A**ddivite **M**odels
79
810
[![R-CMD-check](https://github.com/nicholasjclark/mvgam/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nicholasjclark/mvgam/actions/)
911
[![Test
1012
status](https://github.com/nicholasjclark/mvgam/actions/workflows/test-coverage.yaml/badge.svg)](https://github.com/nicholasjclark/mvgam/actions/workflows/test-coverage.yaml)
1113
[![Coverage
1214
status](https://codecov.io/gh/nicholasjclark/mvgam/graph/badge.svg?token=RCJ2B7S0BL)](https://app.codecov.io/gh/nicholasjclark/mvgam)
15+
[![Documentation](https://img.shields.io/badge/documentation-mvgam-orange.svg?colorB=E91E63)](https://nicholasjclark.github.io/mvgam/)
1316
[![CRAN
1417
Version](https://www.r-pkg.org/badges/version/mvgam)](https://cran.r-project.org/package=mvgam)
1518
[![CRAN
1619
Downloads](https://cranlogs.r-pkg.org/badges/grand-total/mvgam?color=brightgreen)](https://cran.r-project.org/package=mvgam)
1720

18-
The goal of `mvgam` is to fit Bayesian Dynamic Generalized Additive
19-
Models to time series data. The motivation for the package is described
20-
in <a
21+
The goal of `mvgam` is to fit Bayesian (Dynamic) Generalized Additive
22+
Models. This package constructs State-Space models that can include
23+
highly flexible nonlinear predictor effects for both process and
24+
observation components by leveraging functionalities from the impressive
25+
<a href="https://paulbuerkner.com/brms/"
26+
target="_blank"><code>brms</code></a> and
27+
<a href="https://cran.r-project.org/web/packages/mgcv/index.html"
28+
target="_blank"><code>mgcv</code></a> packages. This allows `mvgam` to
29+
fit a wide range of models, including hierarchical ecological models
30+
such as N-mixture or Joint Species Distribution models, as well as
31+
univariate and multivariate time series models with imperfect detection.
32+
The original motivation for the package is described in <a
2133
href="https://besjournals.onlinelibrary.wiley.com/doi/10.1111/2041-210X.13974"
2234
target="_blank">Clark &amp; Wells 2022</a> (published in *Methods in
2335
Ecology and Evolution*), with additional inspiration on the use of
@@ -226,28 +238,28 @@ summary(lynx_mvgam)
226238
#>
227239
#> GAM coefficient (beta) estimates:
228240
#> 2.5% 50% 97.5% Rhat n_eff
229-
#> (Intercept) 6.400 6.60 6.900 1.00 910
230-
#> s(season).1 -0.640 -0.13 0.360 1.00 1169
231-
#> s(season).2 0.760 1.40 1.900 1.01 850
232-
#> s(season).3 1.300 1.90 2.500 1.01 953
233-
#> s(season).4 -0.018 0.55 1.200 1.00 1102
234-
#> s(season).5 -1.300 -0.70 -0.069 1.00 1019
235-
#> s(season).6 -1.200 -0.56 0.093 1.00 1011
236-
#> s(season).7 0.039 0.73 1.400 1.00 1006
237-
#> s(season).8 0.580 1.40 2.200 1.00 1041
238-
#> s(season).9 -0.360 0.23 0.820 1.00 735
239-
#> s(season).10 -1.400 -0.88 -0.380 1.00 908
241+
#> (Intercept) 6.400 6.60 6.900 1.00 821
242+
#> s(season).1 -0.640 -0.12 0.390 1.00 1356
243+
#> s(season).2 0.780 1.30 1.900 1.00 1241
244+
#> s(season).3 1.300 1.90 2.500 1.00 889
245+
#> s(season).4 -0.062 0.53 1.200 1.00 1119
246+
#> s(season).5 -1.300 -0.72 -0.099 1.01 1113
247+
#> s(season).6 -1.300 -0.57 0.092 1.00 1101
248+
#> s(season).7 0.023 0.70 1.400 1.00 1355
249+
#> s(season).8 0.640 1.40 2.100 1.01 1111
250+
#> s(season).9 -0.370 0.21 0.830 1.01 847
251+
#> s(season).10 -1.400 -0.87 -0.370 1.00 1108
240252
#>
241253
#> Approximate significance of GAM smooths:
242254
#> edf Ref.df Chi.sq p-value
243-
#> s(season) 9.99 10 48.3 <2e-16 ***
255+
#> s(season) 9.97 10 48.8 <2e-16 ***
244256
#> ---
245257
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
246258
#>
247259
#> Latent trend parameter AR estimates:
248260
#> 2.5% 50% 97.5% Rhat n_eff
249-
#> ar1[1] 0.60 0.83 0.98 1 592
250-
#> sigma[1] 0.39 0.48 0.60 1 855
261+
#> ar1[1] 0.61 0.83 0.99 1.01 666
262+
#> sigma[1] 0.38 0.48 0.60 1.00 688
251263
#>
252264
#> Stan MCMC diagnostics:
253265
#> n_eff / iter looks reasonable for all parameters
@@ -256,7 +268,7 @@ summary(lynx_mvgam)
256268
#> 0 of 2000 iterations saturated the maximum tree depth of 12 (0%)
257269
#> E-FMI indicated no pathological behavior
258270
#>
259-
#> Samples were drawn using NUTS(diag_e) at Mon Sep 30 3:06:32 PM 2024.
271+
#> Samples were drawn using NUTS(diag_e) at Thu Oct 24 1:32:39 PM 2024.
260272
#> For each parameter, n_eff is a crude measure of effective sample size,
261273
#> and Rhat is the potential scale reduction factor on split MCMC chains
262274
#> (at convergence, Rhat = 1)
@@ -393,7 +405,7 @@ series (testing and training)
393405
``` r
394406
plot(lynx_mvgam, type = 'forecast', newdata = lynx_test)
395407
#> Out of sample DRPS:
396-
#> 2398.60613875
408+
#> 2470.51814475
397409
```
398410

399411
<img src="man/figures/README-unnamed-chunk-21-1.png" alt="Plotting forecast distributions using mvgam in R" width="60%" style="display: block; margin: auto;" />
@@ -554,7 +566,7 @@ summary(mod, include_betas = FALSE)
554566
#> 0 of 2000 iterations saturated the maximum tree depth of 12 (0%)
555567
#> E-FMI indicated no pathological behavior
556568
#>
557-
#> Samples were drawn using NUTS(diag_e) at Mon Sep 30 3:07:18 PM 2024.
569+
#> Samples were drawn using NUTS(diag_e) at Thu Oct 24 1:33:28 PM 2024.
558570
#> For each parameter, n_eff is a crude measure of effective sample size,
559571
#> and Rhat is the potential scale reduction factor on split MCMC chains
560572
#> (at convergence, Rhat = 1)
113 Bytes
Loading
-525 Bytes
Loading
297 Bytes
Loading
-1.35 KB
Loading
273 Bytes
Loading
70 Bytes
Loading
-51 Bytes
Loading
-87 Bytes
Loading
-313 Bytes
Loading
41 Bytes
Loading
199 Bytes
Loading
319 Bytes
Loading
1.28 KB
Loading

0 commit comments

Comments
 (0)