diff --git a/docs/reference/Rplot001.png b/docs/reference/Rplot001.png index fa3dfa5c..08d1d778 100644 Binary files a/docs/reference/Rplot001.png and b/docs/reference/Rplot001.png differ diff --git a/docs/reference/Rplot002.png b/docs/reference/Rplot002.png index ef121d2d..3adae0bc 100644 Binary files a/docs/reference/Rplot002.png and b/docs/reference/Rplot002.png differ diff --git a/docs/reference/Rplot003.png b/docs/reference/Rplot003.png index 397c9c88..82ac21b8 100644 Binary files a/docs/reference/Rplot003.png and b/docs/reference/Rplot003.png differ diff --git a/docs/reference/Rplot004.png b/docs/reference/Rplot004.png index 3b13e986..8372e9f3 100644 Binary files a/docs/reference/Rplot004.png and b/docs/reference/Rplot004.png differ diff --git a/docs/reference/Rplot005.png b/docs/reference/Rplot005.png index 9748b9e0..44457094 100644 Binary files a/docs/reference/Rplot005.png and b/docs/reference/Rplot005.png differ diff --git a/docs/reference/Rplot006.png b/docs/reference/Rplot006.png index 371d33a3..3bffeafe 100644 Binary files a/docs/reference/Rplot006.png and b/docs/reference/Rplot006.png differ diff --git a/docs/reference/Rplot007.png b/docs/reference/Rplot007.png index 567205f0..33c017bc 100644 Binary files a/docs/reference/Rplot007.png and b/docs/reference/Rplot007.png differ diff --git a/docs/reference/Rplot008.png b/docs/reference/Rplot008.png index f9eb49e4..a72b2b67 100644 Binary files a/docs/reference/Rplot008.png and b/docs/reference/Rplot008.png differ diff --git a/docs/reference/Rplot009.png b/docs/reference/Rplot009.png index d865cc3d..9a8bbe0b 100644 Binary files a/docs/reference/Rplot009.png and b/docs/reference/Rplot009.png differ diff --git a/docs/reference/Rplot010.png b/docs/reference/Rplot010.png index a17fc228..a28b8c8a 100644 Binary files a/docs/reference/Rplot010.png and b/docs/reference/Rplot010.png differ diff --git a/docs/reference/Rplot011.png b/docs/reference/Rplot011.png index bcec02ea..1fc3dd28 100644 Binary files a/docs/reference/Rplot011.png and b/docs/reference/Rplot011.png differ diff --git a/docs/reference/Rplot012.png b/docs/reference/Rplot012.png index 2f0af5c2..36508e70 100644 Binary files a/docs/reference/Rplot012.png and b/docs/reference/Rplot012.png differ diff --git a/docs/reference/Rplot013.png b/docs/reference/Rplot013.png index 15c948f5..c1c3e96b 100644 Binary files a/docs/reference/Rplot013.png and b/docs/reference/Rplot013.png differ diff --git a/docs/reference/Rplot014.png b/docs/reference/Rplot014.png index e7647112..acf3ee19 100644 Binary files a/docs/reference/Rplot014.png and b/docs/reference/Rplot014.png differ diff --git a/docs/reference/Rplot015.png b/docs/reference/Rplot015.png index 8c88a0d9..53c008cd 100644 Binary files a/docs/reference/Rplot015.png and b/docs/reference/Rplot015.png differ diff --git a/docs/reference/Rplot016.png b/docs/reference/Rplot016.png index a75ba579..6fe4c62d 100644 Binary files a/docs/reference/Rplot016.png and b/docs/reference/Rplot016.png differ diff --git a/docs/reference/Rplot018.png b/docs/reference/Rplot018.png index e3531744..5adb5c59 100644 Binary files a/docs/reference/Rplot018.png and b/docs/reference/Rplot018.png differ diff --git a/docs/reference/Rplot019.png b/docs/reference/Rplot019.png index b2e6ded0..b328b858 100644 Binary files a/docs/reference/Rplot019.png and b/docs/reference/Rplot019.png differ diff --git a/docs/reference/Rplot020.png b/docs/reference/Rplot020.png index c8968eb8..ae9822f6 100644 Binary files a/docs/reference/Rplot020.png and b/docs/reference/Rplot020.png differ diff --git a/docs/reference/Rplot021.png b/docs/reference/Rplot021.png index 8af604c3..9a658b30 100644 Binary files a/docs/reference/Rplot021.png and b/docs/reference/Rplot021.png differ diff --git a/docs/reference/Rplot022.png b/docs/reference/Rplot022.png index 739deb1f..0ee5b91c 100644 Binary files a/docs/reference/Rplot022.png and b/docs/reference/Rplot022.png differ diff --git a/docs/reference/Rplot023.png b/docs/reference/Rplot023.png index de871599..1349debf 100644 Binary files a/docs/reference/Rplot023.png and b/docs/reference/Rplot023.png differ diff --git a/docs/reference/Rplot024.png b/docs/reference/Rplot024.png index f2151ffc..bdb0530c 100644 Binary files a/docs/reference/Rplot024.png and b/docs/reference/Rplot024.png differ diff --git a/docs/reference/Rplot025.png b/docs/reference/Rplot025.png index 383c6362..d6c5521d 100644 Binary files a/docs/reference/Rplot025.png and b/docs/reference/Rplot025.png differ diff --git a/docs/reference/Rplot026.png b/docs/reference/Rplot026.png index b47bd789..9948abfa 100644 Binary files a/docs/reference/Rplot026.png and b/docs/reference/Rplot026.png differ diff --git a/docs/reference/Rplot027.png b/docs/reference/Rplot027.png index 6e090ef6..4bacd27b 100644 Binary files a/docs/reference/Rplot027.png and b/docs/reference/Rplot027.png differ diff --git a/docs/reference/Rplot028.png b/docs/reference/Rplot028.png index 0fa97a48..b444dc79 100644 Binary files a/docs/reference/Rplot028.png and b/docs/reference/Rplot028.png differ diff --git a/docs/reference/code.html b/docs/reference/code.html index 4635609d..973b12a6 100644 --- a/docs/reference/code.html +++ b/docs/reference/code.html @@ -66,13 +66,13 @@

Usage
code(object)
 
 # S3 method for mvgam_prefit
-stancode(object, ...)
+stancode(object, ...)
 
 # S3 method for mvgam
-stancode(object, ...)
+stancode(object, ...)
 
 # S3 method for mvgam_prefit
-standata(object, ...)
+standata(object, ...)
@@ -98,14 +98,14 @@

Value

Examples

simdat <- sim_mvgam()
-mod <- mvgam(y ~ s(season) +
-               s(time, by = series),
+mod <- mvgam(y ~ s(season) +
+               s(time, by = series),
              family = poisson(),
              data = simdat$data_train,
              run_model = FALSE)
 
 # View Stan model code
-stancode(mod)
+stancode(mod)
 #> // Stan model code generated by package mvgam
 #> data {
 #>   int<lower=0> total_obs; // total number of observations
@@ -186,7 +186,7 @@ 

Examples#> # View Stan model data -sdata <- standata(mod) +sdata <- standata(mod) str(sdata) #> List of 21 #> $ y : num [1:75, 1:3] 1 1 3 0 0 0 0 0 0 2 ... @@ -195,7 +195,7 @@

Examples#> ..- attr(*, "dimnames")=List of 2 #> .. ..$ : NULL #> .. ..$ : chr [1:37] "X.Intercept." "V2" "V3" "V4" ... -#> $ S1 : num [1:9, 1:18] 3.758 -0.625 -1.816 0.191 2.357 ... +#> $ S1 : num [1:9, 1:18] 3.819 0.796 1.727 -0.323 2.686 ... #> $ zero : num [1:37] 0 0 0 0 0 0 0 0 0 0 ... #> $ S2 : num [1:9, 1:18] 8.555 -1.22 4.352 0.822 -5.594 ... #> $ S3 : num [1:9, 1:18] 8.555 -1.22 4.352 0.822 -5.594 ... diff --git a/docs/reference/ensemble.mvgam_forecast-2.png b/docs/reference/ensemble.mvgam_forecast-2.png index f1ba4c56..fc9d831b 100644 Binary files a/docs/reference/ensemble.mvgam_forecast-2.png and b/docs/reference/ensemble.mvgam_forecast-2.png differ diff --git a/docs/reference/ensemble.mvgam_forecast-3.png b/docs/reference/ensemble.mvgam_forecast-3.png index 77b8a9e9..a8618108 100644 Binary files a/docs/reference/ensemble.mvgam_forecast-3.png and b/docs/reference/ensemble.mvgam_forecast-3.png differ diff --git a/docs/reference/ensemble.mvgam_forecast-4.png b/docs/reference/ensemble.mvgam_forecast-4.png index 2fcc047c..508b4b90 100644 Binary files a/docs/reference/ensemble.mvgam_forecast-4.png and b/docs/reference/ensemble.mvgam_forecast-4.png differ diff --git a/docs/reference/ensemble.mvgam_forecast.html b/docs/reference/ensemble.mvgam_forecast.html index 4fce3a98..cd779799 100644 --- a/docs/reference/ensemble.mvgam_forecast.html +++ b/docs/reference/ensemble.mvgam_forecast.html @@ -128,13 +128,26 @@

Examples m1 <- mvgam(y ~ 1, trend_formula = ~ time + - s(season, bs = 'cc', k = 9), + s(season, bs = 'cc', k = 9), trend_model = AR(p = 1), noncentred = TRUE, data = simdat$data_train, newdata = simdat$data_test) #> Compiling Stan program using cmdstanr #> +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f869091ff5.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory #> Start sampling #> Running MCMC with 4 parallel chains... #> @@ -143,57 +156,57 @@

Examples#> Chain 3 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 4 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 3 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 3 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) +#> Chain 3 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 4 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 3 Iteration: 300 / 1000 [ 30%] (Warmup) -#> Chain 3 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) -#> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 3 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 4 Iteration: 200 / 1000 [ 20%] (Warmup) -#> Chain 3 Iteration: 500 / 1000 [ 50%] (Warmup) -#> Chain 3 Iteration: 501 / 1000 [ 50%] (Sampling) +#> Chain 3 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 4 Iteration: 300 / 1000 [ 30%] (Warmup) -#> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) -#> Chain 3 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 4 Iteration: 400 / 1000 [ 40%] (Warmup) -#> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) +#> Chain 3 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) -#> Chain 3 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 3 Iteration: 800 / 1000 [ 80%] (Sampling) -#> Chain 4 Iteration: 500 / 1000 [ 50%] (Warmup) +#> Chain 3 Iteration: 501 / 1000 [ 50%] (Sampling) +#> Chain 4 Iteration: 400 / 1000 [ 40%] (Warmup) +#> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup) +#> Chain 3 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) -#> Chain 4 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) +#> Chain 4 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 3 Iteration: 900 / 1000 [ 90%] (Sampling) +#> Chain 3 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 4 Iteration: 501 / 1000 [ 50%] (Sampling) +#> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 3 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 4 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 3 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 4 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) +#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 3 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 3 finished in 11.1 seconds. +#> Chain 3 finished in 5.2 seconds. +#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) +#> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 4 Iteration: 800 / 1000 [ 80%] (Sampling) -#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) +#> Chain 2 finished in 5.7 seconds. +#> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) +#> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) #> Chain 4 Iteration: 900 / 1000 [ 90%] (Sampling) +#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 4 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 4 finished in 12.4 seconds. +#> Chain 4 finished in 6.2 seconds. +#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) -#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) -#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 1 finished in 14.0 seconds. -#> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 2 finished in 14.2 seconds. +#> Chain 1 finished in 7.0 seconds. #> #> All 4 chains finished successfully. -#> Mean chain execution time: 13.0 seconds. -#> Total execution time: 14.4 seconds. +#> Mean chain execution time: 6.0 seconds. +#> Total execution time: 7.1 seconds. #> m2 <- mvgam(y ~ time, @@ -203,6 +216,19 @@

Examples newdata = simdat$data_test) #> Compiling Stan program using cmdstanr #> +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f8254fb78.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory #> Start sampling #> Running MCMC with 4 parallel chains... #> @@ -219,49 +245,49 @@

Examples#> Chain 3 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 3 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 3 Iteration: 800 / 1000 [ 80%] (Sampling) +#> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 3 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 3 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 3 finished in 3.5 seconds. +#> Chain 3 finished in 1.4 seconds. #> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup) +#> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) +#> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) -#> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 4 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) -#> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) -#> Chain 4 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) -#> Chain 4 Iteration: 300 / 1000 [ 30%] (Warmup) -#> Chain 4 Iteration: 400 / 1000 [ 40%] (Warmup) -#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) +#> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 4 Iteration: 100 / 1000 [ 10%] (Warmup) +#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) +#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) +#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) +#> Chain 4 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 4 Iteration: 300 / 1000 [ 30%] (Warmup) +#> Chain 4 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 4 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 4 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 4 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) -#> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) +#> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) #> Chain 4 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 4 Iteration: 800 / 1000 [ 80%] (Sampling) -#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) +#> Chain 1 finished in 1.8 seconds. +#> Chain 2 finished in 1.8 seconds. #> Chain 4 Iteration: 900 / 1000 [ 90%] (Sampling) -#> Chain 1 finished in 5.0 seconds. -#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) -#> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) #> Chain 4 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 2 finished in 5.2 seconds. -#> Chain 4 finished in 5.1 seconds. +#> Chain 4 finished in 1.9 seconds. #> #> All 4 chains finished successfully. -#> Mean chain execution time: 4.7 seconds. -#> Total execution time: 5.2 seconds. +#> Mean chain execution time: 1.7 seconds. +#> Total execution time: 2.1 seconds. #> # Calculate forecast distributions for each model @@ -274,188 +300,188 @@

Examples# Plot forecasts plot(fc1) #> Out of sample DRPS: -#> 54.0632615 +#> 53.167638 plot(fc2) #> Out of sample DRPS: -#> 51.26894275 +#> 50.908428 plot(ensemble_fc) #> Out of sample DRPS: -#> 46.72201688 +#> 45.89366292 # Score forecasts score(fc1) #> $series_1 #> score in_interval interval_width eval_horizon score_type -#> 1 0.8143275 1 0.9 1 crps -#> 2 0.4279998 1 0.9 2 crps -#> 3 1.6240035 1 0.9 3 crps -#> 4 0.9180020 1 0.9 4 crps -#> 5 1.8852135 1 0.9 5 crps -#> 6 4.0027665 1 0.9 6 crps -#> 7 3.3081108 1 0.9 7 crps -#> 8 2.5482525 1 0.9 8 crps -#> 9 1.2880938 1 0.9 9 crps -#> 10 2.5379395 1 0.9 10 crps -#> 11 2.2626678 1 0.9 11 crps -#> 12 0.6289923 1 0.9 12 crps -#> 13 0.8154938 1 0.9 13 crps -#> 14 0.7501920 1 0.9 14 crps -#> 15 0.8248095 1 0.9 15 crps -#> 16 1.6553963 1 0.9 16 crps -#> 17 4.3406725 1 0.9 17 crps -#> 18 1.2399425 1 0.9 18 crps -#> 19 3.1618508 1 0.9 19 crps -#> 20 6.2502788 1 0.9 20 crps -#> 21 3.7396068 1 0.9 21 crps -#> 22 5.7143398 1 0.9 22 crps -#> 23 1.1730595 1 0.9 23 crps -#> 24 1.3452073 1 0.9 24 crps -#> 25 0.8060430 1 0.9 25 crps +#> 1 0.8890420 1 0.9 1 crps +#> 2 0.4492823 1 0.9 2 crps +#> 3 1.5185570 1 0.9 3 crps +#> 4 0.8989273 1 0.9 4 crps +#> 5 1.8055245 1 0.9 5 crps +#> 6 3.9993945 0 0.9 6 crps +#> 7 3.4538378 1 0.9 7 crps +#> 8 2.4664340 1 0.9 8 crps +#> 9 1.3232315 1 0.9 9 crps +#> 10 2.5988078 1 0.9 10 crps +#> 11 2.2445383 1 0.9 11 crps +#> 12 0.5999212 1 0.9 12 crps +#> 13 0.8349463 1 0.9 13 crps +#> 14 0.7671573 1 0.9 14 crps +#> 15 0.8676385 1 0.9 15 crps +#> 16 1.7038020 1 0.9 16 crps +#> 17 4.3611705 1 0.9 17 crps +#> 18 1.2247887 1 0.9 18 crps +#> 19 3.0207840 1 0.9 19 crps +#> 20 6.0145475 1 0.9 20 crps +#> 21 3.5215620 1 0.9 21 crps +#> 22 5.4205837 1 0.9 22 crps +#> 23 1.0779020 1 0.9 23 crps +#> 24 1.3068293 1 0.9 24 crps +#> 25 0.7984283 1 0.9 25 crps #> #> $all_series #> score eval_horizon score_type -#> 1 0.8143275 1 sum_crps -#> 2 0.4279998 2 sum_crps -#> 3 1.6240035 3 sum_crps -#> 4 0.9180020 4 sum_crps -#> 5 1.8852135 5 sum_crps -#> 6 4.0027665 6 sum_crps -#> 7 3.3081108 7 sum_crps -#> 8 2.5482525 8 sum_crps -#> 9 1.2880938 9 sum_crps -#> 10 2.5379395 10 sum_crps -#> 11 2.2626678 11 sum_crps -#> 12 0.6289923 12 sum_crps -#> 13 0.8154938 13 sum_crps -#> 14 0.7501920 14 sum_crps -#> 15 0.8248095 15 sum_crps -#> 16 1.6553963 16 sum_crps -#> 17 4.3406725 17 sum_crps -#> 18 1.2399425 18 sum_crps -#> 19 3.1618508 19 sum_crps -#> 20 6.2502788 20 sum_crps -#> 21 3.7396068 21 sum_crps -#> 22 5.7143398 22 sum_crps -#> 23 1.1730595 23 sum_crps -#> 24 1.3452073 24 sum_crps -#> 25 0.8060430 25 sum_crps +#> 1 0.8890420 1 sum_crps +#> 2 0.4492823 2 sum_crps +#> 3 1.5185570 3 sum_crps +#> 4 0.8989273 4 sum_crps +#> 5 1.8055245 5 sum_crps +#> 6 3.9993945 6 sum_crps +#> 7 3.4538378 7 sum_crps +#> 8 2.4664340 8 sum_crps +#> 9 1.3232315 9 sum_crps +#> 10 2.5988078 10 sum_crps +#> 11 2.2445383 11 sum_crps +#> 12 0.5999212 12 sum_crps +#> 13 0.8349463 13 sum_crps +#> 14 0.7671573 14 sum_crps +#> 15 0.8676385 15 sum_crps +#> 16 1.7038020 16 sum_crps +#> 17 4.3611705 17 sum_crps +#> 18 1.2247887 18 sum_crps +#> 19 3.0207840 19 sum_crps +#> 20 6.0145475 20 sum_crps +#> 21 3.5215620 21 sum_crps +#> 22 5.4205837 22 sum_crps +#> 23 1.0779020 23 sum_crps +#> 24 1.3068293 24 sum_crps +#> 25 0.7984283 25 sum_crps #> score(fc2) #> $series_1 #> score in_interval interval_width eval_horizon score_type -#> 1 0.7433395 1 0.9 1 crps -#> 2 1.6796785 1 0.9 2 crps -#> 3 3.2520813 1 0.9 3 crps -#> 4 1.9027748 1 0.9 4 crps -#> 5 1.8418340 1 0.9 5 crps -#> 6 2.0997740 1 0.9 6 crps -#> 7 1.1650383 1 0.9 7 crps -#> 8 1.7061112 1 0.9 8 crps -#> 9 1.3908383 1 0.9 9 crps -#> 10 1.2300728 1 0.9 10 crps -#> 11 2.4948715 1 0.9 11 crps -#> 12 2.1891583 1 0.9 12 crps -#> 13 1.7893270 1 0.9 13 crps -#> 14 1.8230665 1 0.9 14 crps -#> 15 1.6008420 1 0.9 15 crps -#> 16 1.5409188 1 0.9 16 crps -#> 17 3.7453850 1 0.9 17 crps -#> 18 2.1944927 1 0.9 18 crps -#> 19 2.2025950 1 0.9 19 crps -#> 20 1.6104808 1 0.9 20 crps -#> 21 1.7263915 1 0.9 21 crps -#> 22 2.4336692 1 0.9 22 crps -#> 23 1.9008523 1 0.9 23 crps -#> 24 3.9485318 1 0.9 24 crps -#> 25 3.0568180 1 0.9 25 crps +#> 1 0.6874878 1 0.9 1 crps +#> 2 1.6471578 1 0.9 2 crps +#> 3 3.0363160 1 0.9 3 crps +#> 4 1.7709870 1 0.9 4 crps +#> 5 1.7643665 1 0.9 5 crps +#> 6 1.9566545 1 0.9 6 crps +#> 7 1.1733258 1 0.9 7 crps +#> 8 1.7089578 1 0.9 8 crps +#> 9 1.3833360 1 0.9 9 crps +#> 10 1.2870628 1 0.9 10 crps +#> 11 2.6310383 1 0.9 11 crps +#> 12 2.1334693 1 0.9 12 crps +#> 13 1.7572383 1 0.9 13 crps +#> 14 1.8325305 1 0.9 14 crps +#> 15 1.6366635 1 0.9 15 crps +#> 16 1.5081563 1 0.9 16 crps +#> 17 3.9940062 1 0.9 17 crps +#> 18 2.3000615 1 0.9 18 crps +#> 19 2.2467020 1 0.9 19 crps +#> 20 1.6397138 1 0.9 20 crps +#> 21 1.7773023 1 0.9 21 crps +#> 22 2.4609862 1 0.9 22 crps +#> 23 1.9270123 1 0.9 23 crps +#> 24 3.8463365 1 0.9 24 crps +#> 25 2.8015595 1 0.9 25 crps #> #> $all_series #> score eval_horizon score_type -#> 1 0.7433395 1 sum_crps -#> 2 1.6796785 2 sum_crps -#> 3 3.2520813 3 sum_crps -#> 4 1.9027748 4 sum_crps -#> 5 1.8418340 5 sum_crps -#> 6 2.0997740 6 sum_crps -#> 7 1.1650383 7 sum_crps -#> 8 1.7061112 8 sum_crps -#> 9 1.3908383 9 sum_crps -#> 10 1.2300728 10 sum_crps -#> 11 2.4948715 11 sum_crps -#> 12 2.1891583 12 sum_crps -#> 13 1.7893270 13 sum_crps -#> 14 1.8230665 14 sum_crps -#> 15 1.6008420 15 sum_crps -#> 16 1.5409188 16 sum_crps -#> 17 3.7453850 17 sum_crps -#> 18 2.1944927 18 sum_crps -#> 19 2.2025950 19 sum_crps -#> 20 1.6104808 20 sum_crps -#> 21 1.7263915 21 sum_crps -#> 22 2.4336692 22 sum_crps -#> 23 1.9008523 23 sum_crps -#> 24 3.9485318 24 sum_crps -#> 25 3.0568180 25 sum_crps +#> 1 0.6874878 1 sum_crps +#> 2 1.6471578 2 sum_crps +#> 3 3.0363160 3 sum_crps +#> 4 1.7709870 4 sum_crps +#> 5 1.7643665 5 sum_crps +#> 6 1.9566545 6 sum_crps +#> 7 1.1733258 7 sum_crps +#> 8 1.7089578 8 sum_crps +#> 9 1.3833360 9 sum_crps +#> 10 1.2870628 10 sum_crps +#> 11 2.6310383 11 sum_crps +#> 12 2.1334693 12 sum_crps +#> 13 1.7572383 13 sum_crps +#> 14 1.8325305 14 sum_crps +#> 15 1.6366635 15 sum_crps +#> 16 1.5081563 16 sum_crps +#> 17 3.9940062 17 sum_crps +#> 18 2.3000615 18 sum_crps +#> 19 2.2467020 19 sum_crps +#> 20 1.6397138 20 sum_crps +#> 21 1.7773023 21 sum_crps +#> 22 2.4609862 22 sum_crps +#> 23 1.9270123 23 sum_crps +#> 24 3.8463365 24 sum_crps +#> 25 2.8015595 25 sum_crps #> score(ensemble_fc) #> $series_1 #> score in_interval interval_width eval_horizon score_type -#> 1 0.7595093 1 0.9 1 crps -#> 2 0.7922652 1 0.9 2 crps -#> 3 2.2211150 1 0.9 3 crps -#> 4 1.3336568 1 0.9 4 crps -#> 5 1.8597782 1 0.9 5 crps -#> 6 2.9674017 1 0.9 6 crps -#> 7 1.8333617 1 0.9 7 crps -#> 8 1.6352802 1 0.9 8 crps -#> 9 1.2077633 1 0.9 9 crps -#> 10 1.6902492 1 0.9 10 crps -#> 11 2.2163758 1 0.9 11 crps -#> 12 1.1881601 1 0.9 12 crps -#> 13 0.9893994 1 0.9 13 crps -#> 14 0.9830449 1 0.9 14 crps -#> 15 0.9830781 1 0.9 15 crps -#> 16 1.4820704 1 0.9 16 crps -#> 17 3.9777785 1 0.9 17 crps -#> 18 1.5867608 1 0.9 18 crps -#> 19 2.0606823 1 0.9 19 crps -#> 20 3.2035984 1 0.9 20 crps -#> 21 2.5161035 1 0.9 21 crps -#> 22 3.9363800 1 0.9 22 crps -#> 23 1.4755001 1 0.9 23 crps -#> 24 2.3872868 1 0.9 24 crps -#> 25 1.4354171 1 0.9 25 crps +#> 1 0.7546147 1 0.9 1 crps +#> 2 0.8195527 1 0.9 2 crps +#> 3 2.1283856 1 0.9 3 crps +#> 4 1.2097069 1 0.9 4 crps +#> 5 1.7376459 1 0.9 5 crps +#> 6 2.8649248 1 0.9 6 crps +#> 7 1.8178390 1 0.9 7 crps +#> 8 1.5547210 1 0.9 8 crps +#> 9 1.1941840 1 0.9 9 crps +#> 10 1.7886700 1 0.9 10 crps +#> 11 2.3734945 1 0.9 11 crps +#> 12 1.1552394 1 0.9 12 crps +#> 13 0.9968969 1 0.9 13 crps +#> 14 0.9847705 1 0.9 14 crps +#> 15 1.0202320 1 0.9 15 crps +#> 16 1.4975177 1 0.9 16 crps +#> 17 4.1781860 1 0.9 17 crps +#> 18 1.6047802 1 0.9 18 crps +#> 19 2.0475912 1 0.9 19 crps +#> 20 3.0501099 1 0.9 20 crps +#> 21 2.3956491 1 0.9 21 crps +#> 22 3.7320900 1 0.9 22 crps +#> 23 1.4265935 1 0.9 23 crps +#> 24 2.2222251 1 0.9 24 crps +#> 25 1.3380422 1 0.9 25 crps #> #> $all_series #> score eval_horizon score_type -#> 1 0.7595093 1 sum_crps -#> 2 0.7922652 2 sum_crps -#> 3 2.2211150 3 sum_crps -#> 4 1.3336568 4 sum_crps -#> 5 1.8597782 5 sum_crps -#> 6 2.9674017 6 sum_crps -#> 7 1.8333617 7 sum_crps -#> 8 1.6352802 8 sum_crps -#> 9 1.2077633 9 sum_crps -#> 10 1.6902492 10 sum_crps -#> 11 2.2163758 11 sum_crps -#> 12 1.1881601 12 sum_crps -#> 13 0.9893994 13 sum_crps -#> 14 0.9830449 14 sum_crps -#> 15 0.9830781 15 sum_crps -#> 16 1.4820704 16 sum_crps -#> 17 3.9777785 17 sum_crps -#> 18 1.5867608 18 sum_crps -#> 19 2.0606823 19 sum_crps -#> 20 3.2035984 20 sum_crps -#> 21 2.5161035 21 sum_crps -#> 22 3.9363800 22 sum_crps -#> 23 1.4755001 23 sum_crps -#> 24 2.3872868 24 sum_crps -#> 25 1.4354171 25 sum_crps +#> 1 0.7546147 1 sum_crps +#> 2 0.8195527 2 sum_crps +#> 3 2.1283856 3 sum_crps +#> 4 1.2097069 4 sum_crps +#> 5 1.7376459 5 sum_crps +#> 6 2.8649248 6 sum_crps +#> 7 1.8178390 7 sum_crps +#> 8 1.5547210 8 sum_crps +#> 9 1.1941840 9 sum_crps +#> 10 1.7886700 10 sum_crps +#> 11 2.3734945 11 sum_crps +#> 12 1.1552394 12 sum_crps +#> 13 0.9968969 13 sum_crps +#> 14 0.9847705 14 sum_crps +#> 15 1.0202320 15 sum_crps +#> 16 1.4975177 16 sum_crps +#> 17 4.1781860 17 sum_crps +#> 18 1.6047802 18 sum_crps +#> 19 2.0475912 19 sum_crps +#> 20 3.0501099 20 sum_crps +#> 21 2.3956491 21 sum_crps +#> 22 3.7320900 22 sum_crps +#> 23 1.4265935 23 sum_crps +#> 24 2.2222251 24 sum_crps +#> 25 1.3380422 25 sum_crps #> # }

diff --git a/docs/reference/forecast.mvgam-1.png b/docs/reference/forecast.mvgam-1.png index cf26a1b1..db04e3d4 100644 Binary files a/docs/reference/forecast.mvgam-1.png and b/docs/reference/forecast.mvgam-1.png differ diff --git a/docs/reference/forecast.mvgam-10.png b/docs/reference/forecast.mvgam-10.png index 2fd05275..44764c50 100644 Binary files a/docs/reference/forecast.mvgam-10.png and b/docs/reference/forecast.mvgam-10.png differ diff --git a/docs/reference/forecast.mvgam-11.png b/docs/reference/forecast.mvgam-11.png index 1f5161c8..b7c789b9 100644 Binary files a/docs/reference/forecast.mvgam-11.png and b/docs/reference/forecast.mvgam-11.png differ diff --git a/docs/reference/forecast.mvgam-12.png b/docs/reference/forecast.mvgam-12.png index a65eadff..9ebbd99c 100644 Binary files a/docs/reference/forecast.mvgam-12.png and b/docs/reference/forecast.mvgam-12.png differ diff --git a/docs/reference/forecast.mvgam-2.png b/docs/reference/forecast.mvgam-2.png index a4325391..fd1f30d2 100644 Binary files a/docs/reference/forecast.mvgam-2.png and b/docs/reference/forecast.mvgam-2.png differ diff --git a/docs/reference/forecast.mvgam-3.png b/docs/reference/forecast.mvgam-3.png index ea7a56b1..03230e5f 100644 Binary files a/docs/reference/forecast.mvgam-3.png and b/docs/reference/forecast.mvgam-3.png differ diff --git a/docs/reference/forecast.mvgam-4.png b/docs/reference/forecast.mvgam-4.png index f891d67f..9bf120c0 100644 Binary files a/docs/reference/forecast.mvgam-4.png and b/docs/reference/forecast.mvgam-4.png differ diff --git a/docs/reference/forecast.mvgam-5.png b/docs/reference/forecast.mvgam-5.png index 531bbb33..cdd33a4b 100644 Binary files a/docs/reference/forecast.mvgam-5.png and b/docs/reference/forecast.mvgam-5.png differ diff --git a/docs/reference/forecast.mvgam-6.png b/docs/reference/forecast.mvgam-6.png index 5ce72c5c..a1d39cba 100644 Binary files a/docs/reference/forecast.mvgam-6.png and b/docs/reference/forecast.mvgam-6.png differ diff --git a/docs/reference/forecast.mvgam-7.png b/docs/reference/forecast.mvgam-7.png index 2b25bf97..9a579c1a 100644 Binary files a/docs/reference/forecast.mvgam-7.png and b/docs/reference/forecast.mvgam-7.png differ diff --git a/docs/reference/forecast.mvgam-8.png b/docs/reference/forecast.mvgam-8.png index 2c79e72c..7e577379 100644 Binary files a/docs/reference/forecast.mvgam-8.png and b/docs/reference/forecast.mvgam-8.png differ diff --git a/docs/reference/forecast.mvgam-9.png b/docs/reference/forecast.mvgam-9.png index 008f19e0..61f4c808 100644 Binary files a/docs/reference/forecast.mvgam-9.png and b/docs/reference/forecast.mvgam-9.png differ diff --git a/docs/reference/forecast.mvgam.html b/docs/reference/forecast.mvgam.html index 37fb2f5b..68967f96 100644 --- a/docs/reference/forecast.mvgam.html +++ b/docs/reference/forecast.mvgam.html @@ -137,46 +137,59 @@

See alsoExamples

# \donttest{
 simdat <- sim_mvgam(n_series = 3, trend_model = AR())
-mod <- mvgam(y ~ s(season, bs = 'cc', k = 6),
+mod <- mvgam(y ~ s(season, bs = 'cc', k = 6),
             trend_model = AR(),
             noncentred = TRUE,
             data = simdat$data_train,
             chains = 2)
 #> Compiling Stan program using cmdstanr
 #> 
+#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5,
+#>                  from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4,
+#>                  from stan/lib/stan_math/stan/math/prim/prob.hpp:359,
+#>                  from stan/lib/stan_math/stan/math/prim.hpp:16,
+#>                  from stan/lib/stan_math/stan/math/rev.hpp:16,
+#>                  from stan/lib/stan_math/stan/math.hpp:19,
+#>                  from stan/src/stan/model/model_header.hpp:4,
+#>                  from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f85c0c3ea4.hpp:2:
+#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)':
+#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
+#>   194 |       if (cdf_n < 0.0)
+#>       | 
+#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory
 #> Start sampling
 #> Running MCMC with 2 parallel chains...
 #> 
 #> Chain 1 Iteration:   1 / 1000 [  0%]  (Warmup) 
 #> Chain 2 Iteration:   1 / 1000 [  0%]  (Warmup) 
 #> Chain 1 Iteration: 100 / 1000 [ 10%]  (Warmup) 
-#> Chain 1 Iteration: 200 / 1000 [ 20%]  (Warmup) 
 #> Chain 2 Iteration: 100 / 1000 [ 10%]  (Warmup) 
+#> Chain 1 Iteration: 200 / 1000 [ 20%]  (Warmup) 
 #> Chain 1 Iteration: 300 / 1000 [ 30%]  (Warmup) 
 #> Chain 2 Iteration: 200 / 1000 [ 20%]  (Warmup) 
-#> Chain 1 Iteration: 400 / 1000 [ 40%]  (Warmup) 
 #> Chain 2 Iteration: 300 / 1000 [ 30%]  (Warmup) 
-#> Chain 1 Iteration: 500 / 1000 [ 50%]  (Warmup) 
 #> Chain 2 Iteration: 400 / 1000 [ 40%]  (Warmup) 
-#> Chain 1 Iteration: 501 / 1000 [ 50%]  (Sampling) 
+#> Chain 1 Iteration: 400 / 1000 [ 40%]  (Warmup) 
 #> Chain 2 Iteration: 500 / 1000 [ 50%]  (Warmup) 
 #> Chain 2 Iteration: 501 / 1000 [ 50%]  (Sampling) 
-#> Chain 1 Iteration: 600 / 1000 [ 60%]  (Sampling) 
+#> Chain 1 Iteration: 500 / 1000 [ 50%]  (Warmup) 
+#> Chain 1 Iteration: 501 / 1000 [ 50%]  (Sampling) 
 #> Chain 2 Iteration: 600 / 1000 [ 60%]  (Sampling) 
-#> Chain 1 Iteration: 700 / 1000 [ 70%]  (Sampling) 
+#> Chain 1 Iteration: 600 / 1000 [ 60%]  (Sampling) 
 #> Chain 2 Iteration: 700 / 1000 [ 70%]  (Sampling) 
+#> Chain 1 Iteration: 700 / 1000 [ 70%]  (Sampling) 
 #> Chain 2 Iteration: 800 / 1000 [ 80%]  (Sampling) 
 #> Chain 1 Iteration: 800 / 1000 [ 80%]  (Sampling) 
 #> Chain 2 Iteration: 900 / 1000 [ 90%]  (Sampling) 
 #> Chain 1 Iteration: 900 / 1000 [ 90%]  (Sampling) 
 #> Chain 2 Iteration: 1000 / 1000 [100%]  (Sampling) 
-#> Chain 2 finished in 2.1 seconds.
+#> Chain 2 finished in 0.9 seconds.
 #> Chain 1 Iteration: 1000 / 1000 [100%]  (Sampling) 
-#> Chain 1 finished in 2.2 seconds.
+#> Chain 1 finished in 1.1 seconds.
 #> 
 #> Both chains finished successfully.
-#> Mean chain execution time: 2.1 seconds.
-#> Total execution time: 2.3 seconds.
+#> Mean chain execution time: 1.0 seconds.
+#> Total execution time: 1.2 seconds.
 #> 
 
 # Hindcasts on response scale
@@ -184,7 +197,7 @@ 

Examplesstr(hc) #> List of 15 #> $ call :Class 'formula' language y ~ s(season, bs = "cc", k = 6) -#> .. ..- attr(*, ".Environment")=<environment: 0x00000134260eede0> +#> .. ..- attr(*, ".Environment")=<environment: 0x00000251dbbb3bb8> #> $ trend_call : NULL #> $ family : chr "poisson" #> $ trend_model :List of 4 @@ -206,15 +219,15 @@

Examples#> $ test_observations : NULL #> $ test_times : NULL #> $ hindcasts :List of 3 -#> ..$ series_1: num [1:1000, 1:75] 2 5 0 2 1 0 2 1 0 0 ... +#> ..$ series_1: num [1:1000, 1:75] 3 0 1 1 0 0 0 3 0 2 ... #> .. ..- attr(*, "dimnames")=List of 2 #> .. .. ..$ : NULL #> .. .. ..$ : chr [1:75] "ypred[1,1]" "ypred[2,1]" "ypred[3,1]" "ypred[4,1]" ... -#> ..$ series_2: num [1:1000, 1:75] 0 1 0 0 1 2 0 1 0 1 ... +#> ..$ series_2: num [1:1000, 1:75] 0 0 1 0 0 0 0 0 0 0 ... #> .. ..- attr(*, "dimnames")=List of 2 #> .. .. ..$ : NULL #> .. .. ..$ : chr [1:75] "ypred[1,2]" "ypred[2,2]" "ypred[3,2]" "ypred[4,2]" ... -#> ..$ series_3: num [1:1000, 1:75] 0 2 0 1 1 0 0 5 1 1 ... +#> ..$ series_3: num [1:1000, 1:75] 0 2 0 0 1 1 0 0 1 0 ... #> .. ..- attr(*, "dimnames")=List of 2 #> .. .. ..$ : NULL #> .. .. ..$ : chr [1:75] "ypred[1,3]" "ypred[2,3]" "ypred[3,3]" "ypred[4,3]" ... @@ -235,7 +248,7 @@

Examplesstr(fc) #> List of 16 #> $ call :Class 'formula' language y ~ s(season, bs = "cc", k = 6) -#> .. ..- attr(*, ".Environment")=<environment: 0x00000134260eede0> +#> .. ..- attr(*, ".Environment")=<environment: 0x00000251dbbb3bb8> #> $ trend_call : NULL #> $ family : chr "poisson" #> $ family_pars : NULL @@ -261,34 +274,34 @@

Examples#> ..$ series_3: int [1:25] 1 0 1 0 0 0 0 0 3 0 ... #> $ test_times : int [1:25] 76 77 78 79 80 81 82 83 84 85 ... #> $ hindcasts :List of 3 -#> ..$ series_1: num [1:1000, 1:75] 2 5 0 2 1 0 2 1 0 0 ... +#> ..$ series_1: num [1:1000, 1:75] 3 0 1 1 0 0 0 3 0 2 ... #> .. ..- attr(*, "dimnames")=List of 2 #> .. .. ..$ : NULL #> .. .. ..$ : chr [1:75] "ypred[1,1]" "ypred[2,1]" "ypred[3,1]" "ypred[4,1]" ... -#> ..$ series_2: num [1:1000, 1:75] 0 1 0 0 1 2 0 1 0 1 ... +#> ..$ series_2: num [1:1000, 1:75] 0 0 1 0 0 0 0 0 0 0 ... #> .. ..- attr(*, "dimnames")=List of 2 #> .. .. ..$ : NULL #> .. .. ..$ : chr [1:75] "ypred[1,2]" "ypred[2,2]" "ypred[3,2]" "ypred[4,2]" ... -#> ..$ series_3: num [1:1000, 1:75] 0 2 0 1 1 0 0 5 1 1 ... +#> ..$ series_3: num [1:1000, 1:75] 0 2 0 0 1 1 0 0 1 0 ... #> .. ..- attr(*, "dimnames")=List of 2 #> .. .. ..$ : NULL #> .. .. ..$ : chr [1:75] "ypred[1,3]" "ypred[2,3]" "ypred[3,3]" "ypred[4,3]" ... #> $ forecasts :List of 3 -#> ..$ series_1: int [1:1000, 1:25] 8 3 3 3 2 2 6 1 1 1 ... -#> ..$ series_2: int [1:1000, 1:25] 0 1 1 5 0 2 2 2 0 0 ... -#> ..$ series_3: int [1:1000, 1:25] 1 1 1 1 1 1 1 0 2 0 ... +#> ..$ series_1: int [1:1000, 1:25] 0 0 2 1 1 1 1 3 5 2 ... +#> ..$ series_2: int [1:1000, 1:25] 2 0 5 5 1 0 4 4 0 2 ... +#> ..$ series_3: int [1:1000, 1:25] 2 0 2 4 2 1 1 3 1 1 ... #> - attr(*, "class")= chr "mvgam_forecast" plot(fc, series = 1) #> Out of sample DRPS: -#> 32.117538 +#> 31.457705 plot(fc, series = 2) #> Out of sample DRPS: -#> 20.953595 +#> 20.949768 plot(fc, series = 3) #> Out of sample DRPS: -#> 10.209583 +#> 9.884977 # Forecasts as expectations diff --git a/docs/reference/irf.mvgam-1.png b/docs/reference/irf.mvgam-1.png index 0f799a65..c1fea796 100644 Binary files a/docs/reference/irf.mvgam-1.png and b/docs/reference/irf.mvgam-1.png differ diff --git a/docs/reference/irf.mvgam-2.png b/docs/reference/irf.mvgam-2.png index c224e93b..ff957cd0 100644 Binary files a/docs/reference/irf.mvgam-2.png and b/docs/reference/irf.mvgam-2.png differ diff --git a/docs/reference/irf.mvgam-3.png b/docs/reference/irf.mvgam-3.png index 6f973ed7..8d08daa4 100644 Binary files a/docs/reference/irf.mvgam-3.png and b/docs/reference/irf.mvgam-3.png differ diff --git a/docs/reference/irf.mvgam-4.png b/docs/reference/irf.mvgam-4.png index 1828da25..367c6e71 100644 Binary files a/docs/reference/irf.mvgam-4.png and b/docs/reference/irf.mvgam-4.png differ diff --git a/docs/reference/irf.mvgam.html b/docs/reference/irf.mvgam.html index 7be1ea04..a5a319b1 100644 --- a/docs/reference/irf.mvgam.html +++ b/docs/reference/irf.mvgam.html @@ -144,6 +144,19 @@

Examples family = gaussian(), data = simdat$data_train, silent = 2) +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f88e74d98.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory # Calulate Generalized IRFs for each series irfs <- irf(mod, h = 12, cumulative = FALSE) diff --git a/docs/reference/mvgam-10.png b/docs/reference/mvgam-10.png index e68af813..65d6b581 100644 Binary files a/docs/reference/mvgam-10.png and b/docs/reference/mvgam-10.png differ diff --git a/docs/reference/mvgam-11.png b/docs/reference/mvgam-11.png index db4bb088..f0f32fb4 100644 Binary files a/docs/reference/mvgam-11.png and b/docs/reference/mvgam-11.png differ diff --git a/docs/reference/mvgam-12.png b/docs/reference/mvgam-12.png index 00693d30..90280257 100644 Binary files a/docs/reference/mvgam-12.png and b/docs/reference/mvgam-12.png differ diff --git a/docs/reference/mvgam-13.png b/docs/reference/mvgam-13.png index 47c0fe45..b0b48fbe 100644 Binary files a/docs/reference/mvgam-13.png and b/docs/reference/mvgam-13.png differ diff --git a/docs/reference/mvgam-14.png b/docs/reference/mvgam-14.png index f29faace..4fbfac7e 100644 Binary files a/docs/reference/mvgam-14.png and b/docs/reference/mvgam-14.png differ diff --git a/docs/reference/mvgam-15.png b/docs/reference/mvgam-15.png index 8070bb81..53c22aa9 100644 Binary files a/docs/reference/mvgam-15.png and b/docs/reference/mvgam-15.png differ diff --git a/docs/reference/mvgam-16.png b/docs/reference/mvgam-16.png index 5591a02c..3eec9485 100644 Binary files a/docs/reference/mvgam-16.png and b/docs/reference/mvgam-16.png differ diff --git a/docs/reference/mvgam-18.png b/docs/reference/mvgam-18.png index 6cebe23d..6b876412 100644 Binary files a/docs/reference/mvgam-18.png and b/docs/reference/mvgam-18.png differ diff --git a/docs/reference/mvgam-19.png b/docs/reference/mvgam-19.png index c449c981..06fd93ac 100644 Binary files a/docs/reference/mvgam-19.png and b/docs/reference/mvgam-19.png differ diff --git a/docs/reference/mvgam-20.png b/docs/reference/mvgam-20.png index 1775f96e..2dc639d9 100644 Binary files a/docs/reference/mvgam-20.png and b/docs/reference/mvgam-20.png differ diff --git a/docs/reference/mvgam-21.png b/docs/reference/mvgam-21.png index 84b34910..c4f5049a 100644 Binary files a/docs/reference/mvgam-21.png and b/docs/reference/mvgam-21.png differ diff --git a/docs/reference/mvgam-22.png b/docs/reference/mvgam-22.png index e06982cf..bb509d3a 100644 Binary files a/docs/reference/mvgam-22.png and b/docs/reference/mvgam-22.png differ diff --git a/docs/reference/mvgam-23.png b/docs/reference/mvgam-23.png index 2c929724..19fad5cb 100644 Binary files a/docs/reference/mvgam-23.png and b/docs/reference/mvgam-23.png differ diff --git a/docs/reference/mvgam-24.png b/docs/reference/mvgam-24.png index da5eb575..b0639411 100644 Binary files a/docs/reference/mvgam-24.png and b/docs/reference/mvgam-24.png differ diff --git a/docs/reference/mvgam-25.png b/docs/reference/mvgam-25.png index e7c26a2b..4674113e 100644 Binary files a/docs/reference/mvgam-25.png and b/docs/reference/mvgam-25.png differ diff --git a/docs/reference/mvgam-26.png b/docs/reference/mvgam-26.png index 24325c3c..b13c47d4 100644 Binary files a/docs/reference/mvgam-26.png and b/docs/reference/mvgam-26.png differ diff --git a/docs/reference/mvgam-27.png b/docs/reference/mvgam-27.png index 5e948d99..628c3d33 100644 Binary files a/docs/reference/mvgam-27.png and b/docs/reference/mvgam-27.png differ diff --git a/docs/reference/mvgam-28.png b/docs/reference/mvgam-28.png index 56790a02..16f09571 100644 Binary files a/docs/reference/mvgam-28.png and b/docs/reference/mvgam-28.png differ diff --git a/docs/reference/mvgam-3.png b/docs/reference/mvgam-3.png index 4dbc765b..fe800df7 100644 Binary files a/docs/reference/mvgam-3.png and b/docs/reference/mvgam-3.png differ diff --git a/docs/reference/mvgam-4.png b/docs/reference/mvgam-4.png index c12986f7..3e996752 100644 Binary files a/docs/reference/mvgam-4.png and b/docs/reference/mvgam-4.png differ diff --git a/docs/reference/mvgam-5.png b/docs/reference/mvgam-5.png index 34559324..57ff823d 100644 Binary files a/docs/reference/mvgam-5.png and b/docs/reference/mvgam-5.png differ diff --git a/docs/reference/mvgam-6.png b/docs/reference/mvgam-6.png index c69fd766..d2967556 100644 Binary files a/docs/reference/mvgam-6.png and b/docs/reference/mvgam-6.png differ diff --git a/docs/reference/mvgam-7.png b/docs/reference/mvgam-7.png index c10f1032..12389767 100644 Binary files a/docs/reference/mvgam-7.png and b/docs/reference/mvgam-7.png differ diff --git a/docs/reference/mvgam-8.png b/docs/reference/mvgam-8.png index c5412180..d50d67c1 100644 Binary files a/docs/reference/mvgam-8.png and b/docs/reference/mvgam-8.png differ diff --git a/docs/reference/mvgam-9.png b/docs/reference/mvgam-9.png index 4c7ba020..4f70efb2 100644 Binary files a/docs/reference/mvgam-9.png and b/docs/reference/mvgam-9.png differ diff --git a/docs/reference/mvgam.html b/docs/reference/mvgam.html index 1c3b4c3e..cd67bc75 100644 --- a/docs/reference/mvgam.html +++ b/docs/reference/mvgam.html @@ -128,7 +128,7 @@

Usage

Arguments

formula

A character string specifying the GAM observation model formula. These are exactly like the formula -for a GLM except that smooth terms, s(), te(), ti(), t2(), as well as time-varying +for a GLM except that smooth terms, s(), te(), ti(), t2(), as well as time-varying dynamic() terms, can be added to the right hand side to specify that the linear predictor depends on smooth functions of predictors (or linear functionals of these). In nmix() family models, the formula is used to @@ -217,16 +217,16 @@

Argumentsgaussian() for real-valued data

  • betar() for proportional data on (0,1)

  • -
  • lognormal() for non-negative real-valued data

  • +
  • lognormal() for non-negative real-valued data

  • student_t() for real-valued data

  • Gamma() for non-negative real-valued data

  • -
  • bernoulli() for binary data

  • +
  • bernoulli() for binary data

  • poisson() for count data

  • nb() for overdispersed count data

  • binomial() for count data with imperfect detection when the number of trials is known; note that the cbind() function must be used to bind the discrete observations and the discrete number of trials

  • -
  • beta_binomial() as for binomial() but allows for overdispersion

  • +
  • beta_binomial() as for binomial() but allows for overdispersion

  • nmix() for count data with imperfect detection when the number of trials is unknown and should be modeled via a State-Space N-Mixture model. The latent states are Poisson, capturing the 'true' latent @@ -434,7 +434,7 @@

    Argumentsfindjags

  • +for modelling if use_stan == FALSE. If missing, the path will be recovered from a call to findjags

    ...
    @@ -548,7 +548,7 @@

    Details

    6. Update the model as needed and use loo_compare.mvgam for in-sample model comparisons, or alternatively use forecast.mvgam and score.mvgam_forecast to compare models based on out-of-sample forecasts (see the forecast evaluation vignette for guidance)

  • 7. When satisfied with the model structure, use predict.mvgam, -plot_predictions and/or plot_slopes for +plot_predictions and/or plot_slopes for more targeted inferences (see "How to interpret and report nonlinear effects from Generalized Additive Models" for some guidance on interpreting GAMs)

  • @@ -600,7 +600,7 @@

    Examples run_model = FALSE) # View the model code in Stan language -stancode(mod1) +stancode(mod1) #> // Stan model code generated by package mvgam #> data { #> int<lower=0> total_obs; // total number of observations @@ -691,7 +691,7 @@

    Examples#> # View the data objects needed to fit the model in Stan -sdata1 <- standata(mod1) +sdata1 <- standata(mod1) str(sdata1) #> List of 18 #> $ y : num [1:60, 1:3] 12 17 12 31 30 8 0 1 3 5 ... @@ -731,46 +731,59 @@

    Examples chains = 2) #> Compiling Stan program using cmdstanr #> +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f843d074b8.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory #> Start sampling #> Running MCMC with 2 parallel chains... #> #> Chain 1 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 2 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) -#> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) +#> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) -#> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) -#> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) #> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) +#> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) +#> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) #> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) -#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) #> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 1 finished in 1.9 seconds. -#> Chain 2 finished in 1.8 seconds. +#> Chain 1 finished in 0.9 seconds. +#> Chain 2 finished in 0.9 seconds. #> #> Both chains finished successfully. -#> Mean chain execution time: 1.9 seconds. -#> Total execution time: 2.0 seconds. +#> Mean chain execution time: 0.9 seconds. +#> Total execution time: 1.0 seconds. #> # Extract the model summary summary(mod1) #> GAM formula: #> y ~ s(season, bs = "cc", k = 6) -#> <environment: 0x000001340a92ca48> +#> <environment: 0x00000251dde37b70> #> #> Family: #> poisson @@ -794,27 +807,27 @@

    Examples#> #> #> GAM coefficient (beta) estimates: -#> 2.5% 50% 97.5% Rhat n_eff -#> (Intercept) 1.80 1.900 2.10 1 475 -#> s(season).1 0.14 0.370 0.60 1 514 -#> s(season).2 -0.34 -0.097 0.15 1 566 -#> s(season).3 -1.00 -0.720 -0.46 1 470 -#> s(season).4 -0.50 -0.270 -0.03 1 799 +#> 2.5% 50% 97.5% Rhat n_eff +#> (Intercept) 1.80 2.000 2.1000 1.01 350 +#> s(season).1 0.15 0.370 0.6000 1.01 199 +#> s(season).2 -0.33 -0.091 0.1400 1.00 404 +#> s(season).3 -1.00 -0.710 -0.4500 1.01 372 +#> s(season).4 -0.52 -0.270 -0.0059 1.01 528 #> #> Approximate significance of GAM smooths: #> edf Ref.df Chi.sq p-value -#> s(season) 3.88 4 26 <2e-16 *** +#> s(season) 3.69 4 26.7 1.1e-06 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> Latent trend parameter AR estimates: -#> 2.5% 50% 97.5% Rhat n_eff -#> ar1[1] 0.300 0.74 0.99 1.00 384 -#> ar1[2] -0.930 -0.34 0.23 1.00 127 -#> ar1[3] 0.011 0.41 0.96 1.00 167 -#> sigma[1] 0.380 0.52 0.73 1.00 446 -#> sigma[2] 0.390 0.55 0.79 1.00 198 -#> sigma[3] 0.410 0.58 0.78 1.01 313 +#> 2.5% 50% 97.5% Rhat n_eff +#> ar1[1] 0.2400 0.73 0.98 1.01 274 +#> ar1[2] -0.9300 -0.36 0.18 1.01 147 +#> ar1[3] 0.0021 0.38 0.92 1.02 149 +#> sigma[1] 0.3900 0.53 0.73 1.00 314 +#> sigma[2] 0.3900 0.55 0.77 1.00 267 +#> sigma[3] 0.4300 0.59 0.78 1.00 309 #> #> Stan MCMC diagnostics: #> n_eff / iter looks reasonable for all parameters @@ -823,7 +836,7 @@

    Examples#> 0 of 1000 iterations saturated the maximum tree depth of 12 (0%) #> E-FMI indicated no pathological behavior #> -#> Samples were drawn using NUTS(diag_e) at Thu Aug 29 10:57:46 AM 2024. +#> Samples were drawn using NUTS(diag_e) at Mon Sep 09 10:40:46 AM 2024. #> For each parameter, n_eff is a crude measure of effective sample size, #> and Rhat is the potential scale reduction factor on split MCMC chains #> (at convergence, Rhat = 1) @@ -839,7 +852,7 @@

    Examples resids <- residuals(mod1) str(resids) -#> num [1:180, 1:4] 0.0253 -0.0822 0.1508 0.5405 -0.0836 ... +#> num [1:180, 1:4] 0.0319 -0.06 0.1531 0.5229 -0.0881 ... #> - attr(*, "dimnames")=List of 2 #> ..$ : NULL #> ..$ : chr [1:4] "Estimate" "Est.Error" "Q2.5" "Q97.5" @@ -849,7 +862,7 @@

    Examplesstr(fc) #> List of 16 #> $ call :Class 'formula' language y ~ s(season, bs = "cc", k = 6) -#> .. ..- attr(*, ".Environment")=<environment: 0x000001340a92ca48> +#> .. ..- attr(*, ".Environment")=<environment: 0x00000251dde37b70> #> $ trend_call : NULL #> $ family : chr "poisson" #> $ family_pars : NULL @@ -875,26 +888,26 @@

    Examples#> ..$ series_3: int [1:20] 10 NA 8 5 16 13 0 0 3 2 ... #> $ test_times : int [1:20] 61 62 63 64 65 66 67 68 69 70 ... #> $ hindcasts :List of 3 -#> ..$ series_1: num [1:1000, 1:60] 16 13 8 13 6 17 12 9 11 8 ... +#> ..$ series_1: num [1:1000, 1:60] 22 9 10 1 18 15 11 19 10 15 ... #> .. ..- attr(*, "dimnames")=List of 2 #> .. .. ..$ : NULL #> .. .. ..$ : chr [1:60] "ypred[1,1]" "ypred[2,1]" "ypred[3,1]" "ypred[4,1]" ... -#> ..$ series_2: num [1:1000, 1:60] 7 10 2 5 11 12 8 7 8 12 ... +#> ..$ series_2: num [1:1000, 1:60] 12 13 5 5 12 7 16 12 6 9 ... #> .. ..- attr(*, "dimnames")=List of 2 #> .. .. ..$ : NULL #> .. .. ..$ : chr [1:60] "ypred[1,2]" "ypred[2,2]" "ypred[3,2]" "ypred[4,2]" ... -#> ..$ series_3: num [1:1000, 1:60] 8 14 7 15 7 13 8 6 10 5 ... +#> ..$ series_3: num [1:1000, 1:60] 5 11 9 9 6 15 5 6 14 12 ... #> .. ..- attr(*, "dimnames")=List of 2 #> .. .. ..$ : NULL #> .. .. ..$ : chr [1:60] "ypred[1,3]" "ypred[2,3]" "ypred[3,3]" "ypred[4,3]" ... #> $ forecasts :List of 3 -#> ..$ series_1: int [1:1000, 1:20] 11 13 3 3 12 11 8 9 35 44 ... -#> ..$ series_2: int [1:1000, 1:20] 19 13 9 38 19 6 27 26 21 7 ... -#> ..$ series_3: int [1:1000, 1:20] 23 21 4 29 14 12 15 4 18 6 ... +#> ..$ series_1: int [1:1000, 1:20] 3 14 6 10 5 8 12 6 11 21 ... +#> ..$ series_2: int [1:1000, 1:20] 4 10 10 39 13 20 12 20 8 11 ... +#> ..$ series_3: int [1:1000, 1:20] 10 9 38 65 10 9 17 41 5 4 ... #> - attr(*, "class")= chr "mvgam_forecast" plot(fc) #> Out of sample DRPS: -#> 54.720637 +#> 55.27413 # Plot the estimated seasonal smooth function @@ -915,11 +928,11 @@

    Examples # Plot conditional response predictions using marginaleffects library(marginaleffects) -conditional_effects(mod1) +conditional_effects(mod1) #> Warning: Removed 19 rows containing missing values or values outside the scale range #> (`geom_point()`). -plot_predictions(mod1, condition = 'season', points = 0.5) +plot_predictions(mod1, condition = 'season', points = 0.5) #> Warning: Removed 19 rows containing missing values or values outside the scale range #> (`geom_point()`). @@ -934,41 +947,41 @@

    Examplesbeta_draws_df <- as.data.frame(mod1, variable = 'betas') head(beta_draws_df) #> (Intercept) s(season).1 s(season).2 s(season).3 s(season).4 -#> 1 1.87065 0.473169 -0.03894510 -0.488944 -0.335604 -#> 2 1.99174 0.186258 -0.00918666 -0.841499 -0.193604 -#> 3 1.90925 0.670423 -0.17225100 -0.755631 -0.429818 -#> 4 1.94451 0.534511 -0.04538430 -0.691632 -0.516703 -#> 5 2.08142 0.221111 0.10645400 -0.559959 -0.221205 -#> 6 2.02562 0.354744 -0.01871940 -0.662982 -0.435189 +#> 1 1.94416 0.394466 -0.06900860 -0.783359 -0.426288 +#> 2 1.92798 0.271471 -0.00850006 -0.685065 -0.244868 +#> 3 1.90193 0.230704 -0.04661740 -0.676646 -0.314741 +#> 4 1.88637 0.430494 -0.30333200 -0.634353 -0.345208 +#> 5 1.97914 0.322658 0.15346600 -0.703236 -0.263105 +#> 6 2.02798 0.407478 0.05122050 -0.581718 -0.361806 str(beta_draws_df) #> 'data.frame': 1000 obs. of 5 variables: -#> $ (Intercept): num 1.87 1.99 1.91 1.94 2.08 ... -#> $ s(season).1: num 0.473 0.186 0.67 0.535 0.221 ... -#> $ s(season).2: num -0.03895 -0.00919 -0.17225 -0.04538 0.10645 ... -#> $ s(season).3: num -0.489 -0.841 -0.756 -0.692 -0.56 ... -#> $ s(season).4: num -0.336 -0.194 -0.43 -0.517 -0.221 ... +#> $ (Intercept): num 1.94 1.93 1.9 1.89 1.98 ... +#> $ s(season).1: num 0.394 0.271 0.231 0.43 0.323 ... +#> $ s(season).2: num -0.069 -0.0085 -0.0466 -0.3033 0.1535 ... +#> $ s(season).3: num -0.783 -0.685 -0.677 -0.634 -0.703 ... +#> $ s(season).4: num -0.426 -0.245 -0.315 -0.345 -0.263 ... # Investigate model fit mc.cores.def <- getOption('mc.cores') options(mc.cores = 1) -loo(mod1) +loo(mod1) #> Warning: Some Pareto k diagnostic values are too high. See help('pareto-k-diagnostic') for details. #> #> Computed from 1000 by 161 log-likelihood matrix #> #> Estimate SE -#> elpd_loo -449.6 7.9 -#> p_loo 88.7 4.3 -#> looic 899.2 15.9 +#> elpd_loo -452.2 8.5 +#> p_loo 91.6 4.8 +#> looic 904.4 17.0 #> ------ #> Monte Carlo SE of elpd_loo is NA. #> #> Pareto k diagnostic values: #> Count Pct. Min. n_eff -#> (-Inf, 0.5] (good) 19 11.8% 151 -#> (0.5, 0.7] (ok) 67 41.6% 59 -#> (0.7, 1] (bad) 67 41.6% 17 -#> (1, Inf) (very bad) 8 5.0% 8 +#> (-Inf, 0.5] (good) 22 13.7% 131 +#> (0.5, 0.7] (ok) 61 37.9% 61 +#> (0.7, 1] (bad) 63 39.1% 19 +#> (1, Inf) (very bad) 15 9.3% 4 #> See help('pareto-k-diagnostic') for details. options(mc.cores = mc.cores.def) @@ -992,39 +1005,52 @@

    Examples chains = 2) #> Compiling Stan program using cmdstanr #> +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f8137a4fb3.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory #> Start sampling #> Running MCMC with 2 parallel chains... #> #> Chain 1 Iteration: 1 / 1000 [ 0%] (Warmup) -#> Chain 2 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup) +#> Chain 2 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) -#> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) -#> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) +#> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) +#> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) -#> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) #> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) -#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) +#> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) +#> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) #> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) -#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) +#> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 1 finished in 3.3 seconds. +#> Chain 1 finished in 1.0 seconds. +#> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) +#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 2 finished in 3.5 seconds. +#> Chain 2 finished in 2.0 seconds. #> #> Both chains finished successfully. -#> Mean chain execution time: 3.4 seconds. -#> Total execution time: 3.6 seconds. +#> Mean chain execution time: 1.5 seconds. +#> Total execution time: 2.1 seconds. #> # The mapping matrix is now supplied as data to the model in the 'Z' element @@ -1179,15 +1205,28 @@

    Examples chains = 2) #> Compiling Stan program using cmdstanr #> +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f868403df2.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory #> Start sampling #> Running MCMC with 2 parallel chains... #> #> Chain 1 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 2 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) +#> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) @@ -1198,27 +1237,27 @@

    Examples#> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) #> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 1 finished in 1.3 seconds. #> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 2 finished in 1.4 seconds. +#> Chain 1 finished in 0.8 seconds. +#> Chain 2 finished in 0.7 seconds. #> #> Both chains finished successfully. -#> Mean chain execution time: 1.4 seconds. -#> Total execution time: 1.6 seconds. +#> Mean chain execution time: 0.7 seconds. +#> Total execution time: 0.9 seconds. #> # Inspect the model summary, forecast and time-varying coefficient distribution summary(mod) #> GAM formula: #> out ~ gp(time, by = temp, c = 5/4, k = 40, scale = FALSE) -#> <environment: 0x000001340a92ca48> +#> <environment: 0x00000251dde37b70> #> #> Family: #> gaussian @@ -1243,68 +1282,67 @@

    Examples#> #> Observation error parameter estimates: #> 2.5% 50% 97.5% Rhat n_eff -#> sigma_obs[1] 0.44 0.49 0.55 1 642 +#> sigma_obs[1] 0.44 0.49 0.55 1 1179 #> #> GAM coefficient (beta) estimates: -#> 2.5% 50% 97.5% Rhat n_eff -#> (Intercept) 4.000 4.0e+00 4.1000 1.01 177 -#> gp(time):temp.1 0.950 3.2e+00 6.5000 1.00 494 -#> gp(time):temp.2 -2.400 1.7e+00 5.5000 1.01 359 -#> gp(time):temp.3 -5.600 -1.7e+00 3.6000 1.00 599 -#> gp(time):temp.4 -5.200 -1.2e+00 2.2000 1.00 934 -#> gp(time):temp.5 -2.800 2.3e-01 3.5000 1.00 765 -#> gp(time):temp.6 -2.500 1.5e-02 3.4000 1.00 1019 -#> gp(time):temp.7 -3.500 -1.9e-01 2.1000 1.00 703 -#> gp(time):temp.8 -1.500 1.2e-01 2.8000 1.00 844 -#> gp(time):temp.9 -1.400 1.2e-01 2.6000 1.01 631 -#> gp(time):temp.10 -2.200 -1.3e-01 1.0000 1.01 515 -#> gp(time):temp.11 -1.900 -1.1e-03 1.2000 1.00 802 -#> gp(time):temp.12 -0.630 5.9e-02 2.0000 1.00 437 -#> gp(time):temp.13 -1.200 2.2e-12 1.2000 1.00 1294 -#> gp(time):temp.14 -1.200 -1.8e-05 0.6500 1.00 942 -#> gp(time):temp.15 -0.890 -4.4e-19 0.9000 1.00 1176 -#> gp(time):temp.16 -0.660 1.8e-17 0.9300 1.00 1499 -#> gp(time):temp.17 -0.640 2.0e-17 0.7800 1.00 1348 -#> gp(time):temp.18 -0.680 -7.5e-23 0.7700 1.00 1831 -#> gp(time):temp.19 -0.830 -3.1e-19 0.3700 1.00 754 -#> gp(time):temp.20 -0.400 2.3e-29 0.5000 1.00 1432 -#> gp(time):temp.21 -0.190 3.7e-28 0.8200 1.00 747 -#> gp(time):temp.22 -0.480 -2.4e-32 0.2600 1.00 1214 -#> gp(time):temp.23 -0.470 -1.8e-33 0.2100 1.00 995 -#> gp(time):temp.24 -0.140 1.6e-36 0.4800 1.00 724 -#> gp(time):temp.25 -0.210 2.5e-61 0.3200 1.00 1165 -#> gp(time):temp.26 -0.380 -7.4e-48 0.1100 1.00 838 -#> gp(time):temp.27 -0.120 -1.0e-60 0.2900 1.00 1245 -#> gp(time):temp.28 -0.097 -7.5e-67 0.2100 1.00 912 -#> gp(time):temp.29 -0.150 -5.2e-70 0.0940 1.00 1129 -#> gp(time):temp.30 -0.130 4.6e-79 0.0790 1.00 1228 -#> gp(time):temp.31 -0.180 -2.8e-86 0.0800 1.00 1248 -#> gp(time):temp.32 -0.120 -2.0e-74 0.0710 1.00 1007 -#> gp(time):temp.33 -0.089 -1.2e-81 0.0520 1.00 1098 -#> gp(time):temp.34 -0.037 -2.9e-98 0.1100 1.00 1064 -#> gp(time):temp.35 -0.042 2.1e-99 0.0630 1.00 947 -#> gp(time):temp.36 -0.075 -3.6e-115 0.0470 1.00 1178 -#> gp(time):temp.37 -0.056 1.4e-116 0.0210 1.00 1658 -#> gp(time):temp.38 -0.015 -3.7e-127 0.0510 1.00 1148 -#> gp(time):temp.39 -0.013 -6.9e-124 0.0310 1.00 1207 -#> gp(time):temp.40 -0.033 6.9e-135 0.0098 1.00 885 -#> gp(time):temp.41 -0.024 -9.1e-137 0.0130 1.00 962 +#> 2.5% 50% 97.5% Rhat n_eff +#> (Intercept) 4.000 4.0e+00 4.100 1.00 1235 +#> gp(time):temp.1 0.740 3.3e+00 6.500 1.00 548 +#> gp(time):temp.2 -2.400 1.5e+00 5.800 1.00 435 +#> gp(time):temp.3 -5.700 -1.5e+00 3.800 1.00 573 +#> gp(time):temp.4 -5.200 -1.2e+00 2.300 1.00 464 +#> gp(time):temp.5 -2.900 4.5e-01 3.800 1.00 889 +#> gp(time):temp.6 -2.300 1.6e-01 3.300 1.00 813 +#> gp(time):temp.7 -3.400 -2.8e-01 2.200 1.00 839 +#> gp(time):temp.8 -1.700 1.9e-01 2.700 1.00 794 +#> gp(time):temp.9 -1.200 1.6e-01 2.700 1.00 920 +#> gp(time):temp.10 -2.500 -2.5e-01 0.910 1.00 534 +#> gp(time):temp.11 -1.900 -2.6e-02 1.200 1.00 832 +#> gp(time):temp.12 -0.610 6.3e-02 1.800 1.00 671 +#> gp(time):temp.13 -1.200 1.8e-09 1.200 1.00 1055 +#> gp(time):temp.14 -1.400 -1.2e-03 0.690 1.00 667 +#> gp(time):temp.15 -0.780 2.3e-18 1.000 1.00 841 +#> gp(time):temp.16 -0.730 3.3e-06 0.860 1.00 1027 +#> gp(time):temp.17 -0.810 5.1e-26 0.970 1.00 1103 +#> gp(time):temp.18 -0.780 5.6e-29 0.670 1.00 1011 +#> gp(time):temp.19 -1.000 -6.4e-06 0.320 1.00 833 +#> gp(time):temp.20 -0.560 1.4e-19 0.590 1.00 997 +#> gp(time):temp.21 -0.260 7.7e-12 0.910 1.00 669 +#> gp(time):temp.22 -0.470 -6.6e-25 0.330 1.00 1345 +#> gp(time):temp.23 -0.600 -4.1e-23 0.180 1.00 464 +#> gp(time):temp.24 -0.220 1.8e-19 0.710 1.00 1152 +#> gp(time):temp.25 -0.370 3.2e-33 0.310 1.00 1078 +#> gp(time):temp.26 -0.610 -4.5e-21 0.096 1.00 448 +#> gp(time):temp.27 -0.200 4.7e-39 0.360 1.00 764 +#> gp(time):temp.28 -0.100 9.8e-21 0.320 1.00 938 +#> gp(time):temp.29 -0.240 -5.7e-57 0.180 1.00 1000 +#> gp(time):temp.30 -0.160 2.8e-82 0.230 1.00 1156 +#> gp(time):temp.31 -0.160 2.6e-57 0.160 1.00 948 +#> gp(time):temp.32 -0.130 -1.0e-60 0.170 1.00 772 +#> gp(time):temp.33 -0.160 -1.7e-57 0.075 1.00 772 +#> gp(time):temp.34 -0.066 8.3e-75 0.110 1.00 944 +#> gp(time):temp.35 -0.038 1.6e-82 0.130 1.00 434 +#> gp(time):temp.36 -0.085 3.4e-124 0.051 1.00 957 +#> gp(time):temp.37 -0.062 7.2e-125 0.057 1.00 800 +#> gp(time):temp.38 -0.046 4.0e-72 0.072 1.00 1389 +#> gp(time):temp.39 -0.024 -4.0e-87 0.087 1.00 728 +#> gp(time):temp.40 -0.062 -9.5e-73 0.019 1.00 902 +#> gp(time):temp.41 -0.036 3.6e-126 0.029 1.01 754 #> #> GAM gp term marginal deviation (alpha) and length scale (rho) estimates: -#> 2.5% 50% 97.5% Rhat n_eff -#> alpha_gp(time):temp 0.18 0.35 1.2 1.16 12 -#> rho_gp(time):temp 12.00 33.00 130.0 1.11 14 +#> 2.5% 50% 97.5% Rhat n_eff +#> alpha_gp(time):temp 0.17 0.33 0.84 1.01 210 +#> rho_gp(time):temp 11.00 32.00 100.00 1.01 135 #> #> Stan MCMC diagnostics: #> n_eff / iter looks reasonable for all parameters -#> Rhats above 1.05 found for 9 parameters -#> *Diagnose further to investigate why the chains have not mixed -#> 151 of 1000 iterations ended with a divergence (15.1%) +#> Rhat looks reasonable for all parameters +#> 63 of 1000 iterations ended with a divergence (6.3%) #> *Try running with larger adapt_delta to remove the divergences #> 0 of 1000 iterations saturated the maximum tree depth of 12 (0%) #> E-FMI indicated no pathological behavior #> -#> Samples were drawn using NUTS(diag_e) at Thu Aug 29 10:59:38 AM 2024. +#> Samples were drawn using NUTS(diag_e) at Mon Sep 09 10:42:03 AM 2024. #> For each parameter, n_eff is a crude measure of effective sample size, #> and Rhat is the potential scale reduction factor on split MCMC chains #> (at convergence, Rhat = 1) @@ -1313,7 +1351,7 @@

    Examplesfc <- forecast(mod, newdata = data_test) plot(fc) #> Out of sample CRPS: -#> 6.22329038558597 +#> 6.33897291368901 # Propagating the smooth term shows how the coefficient is expected to evolve @@ -1343,6 +1381,19 @@

    Examples chains = 2) #> Compiling Stan program using cmdstanr #> +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f85c546b04.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory #> Start sampling #> Running MCMC with 2 parallel chains... #> @@ -1352,30 +1403,30 @@

    Examples#> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) -#> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) -#> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) +#> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) -#> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) -#> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) +#> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) +#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 2 finished in 14.0 seconds. +#> Chain 2 finished in 3.9 seconds. #> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 1 finished in 15.0 seconds. +#> Chain 1 finished in 4.2 seconds. #> #> Both chains finished successfully. -#> Mean chain execution time: 14.5 seconds. -#> Total execution time: 15.1 seconds. +#> Mean chain execution time: 4.0 seconds. +#> Total execution time: 4.3 seconds. #> # Inspect the model file to see the modification to the linear predictor @@ -1477,10 +1528,10 @@

    Exampleslayout(matrix(1:2, ncol = 2)) plot(fc, series = 1, ylim = c(0, 75)) #> Out of sample DRPS: -#> 22.754399 +#> 22.781273 plot(fc, series = 2, ylim = c(0, 75)) #> Out of sample DRPS: -#> 77.633266 +#> 77.61833 layout(1) @@ -1490,7 +1541,7 @@

    Examplesfc <- forecast(mod, newdata = dat$data_test) plot(fc) #> Out of sample DRPS: -#> 38.550576 +#> 38.523539 # Relative Risks can be computed by fixing the offset to the same value @@ -1552,44 +1603,57 @@

    Examples#> This warning is displayed once per session. #> Compiling Stan program using cmdstanr #> +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f849e13761.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory #> Start sampling #> Running MCMC with 2 parallel chains... #> #> Chain 1 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 2 Iteration: 1 / 1000 [ 0%] (Warmup) -#> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) -#> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) -#> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) -#> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) #> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) +#> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) +#> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) #> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) -#> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) -#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) +#> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 1 finished in 3.1 seconds. -#> Chain 2 finished in 3.1 seconds. +#> Chain 2 finished in 1.0 seconds. +#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) +#> Chain 1 finished in 1.1 seconds. #> #> Both chains finished successfully. -#> Mean chain execution time: 3.1 seconds. -#> Total execution time: 3.3 seconds. +#> Mean chain execution time: 1.1 seconds. +#> Total execution time: 1.2 seconds. #> summary(mod) #> GAM formula: #> cbind(y, ntrials) ~ series + s(x, by = series) -#> <environment: 0x000001340a92ca48> +#> <environment: 0x00000251dde37b70> #> #> Family: #> binomial @@ -1614,31 +1678,31 @@

    Examples#> #> GAM coefficient (beta) estimates: #> 2.5% 50% 97.5% Rhat n_eff -#> (Intercept) -0.690 -0.55000 -0.410 1.00 816 -#> seriesseries2 0.300 0.50000 0.680 1.00 898 -#> s(x):seriesseries1.1 -0.110 0.06900 0.500 1.02 198 -#> s(x):seriesseries1.2 -0.170 0.01700 0.290 1.01 428 -#> s(x):seriesseries1.3 -0.098 -0.00420 0.061 1.00 552 -#> s(x):seriesseries1.4 -0.110 0.00380 0.150 1.00 433 -#> s(x):seriesseries1.5 -0.056 -0.00098 0.046 1.00 715 -#> s(x):seriesseries1.6 -0.130 -0.00410 0.100 1.00 430 -#> s(x):seriesseries1.7 -0.045 0.00130 0.053 1.00 422 -#> s(x):seriesseries1.8 -0.680 0.03200 0.880 1.00 410 -#> s(x):seriesseries1.9 0.360 0.96000 1.300 1.01 197 -#> s(x):seriesseries2.1 -0.350 -0.03300 0.160 1.01 244 -#> s(x):seriesseries2.2 -0.260 -0.01600 0.180 1.00 289 -#> s(x):seriesseries2.3 -0.048 0.00810 0.110 1.01 307 -#> s(x):seriesseries2.4 -0.140 -0.00520 0.120 1.00 312 -#> s(x):seriesseries2.5 -0.047 0.00230 0.052 1.00 935 -#> s(x):seriesseries2.6 -0.110 0.00380 0.120 1.00 314 -#> s(x):seriesseries2.7 -0.043 0.00015 0.043 1.00 346 -#> s(x):seriesseries2.8 -0.790 -0.02200 0.700 1.00 293 -#> s(x):seriesseries2.9 -0.950 -0.69000 -0.220 1.01 259 +#> (Intercept) -0.280 -0.17000 -0.036 1.00 592 +#> seriesseries2 -0.320 -0.15000 0.028 1.00 577 +#> s(x):seriesseries1.1 -0.120 0.02100 0.380 1.01 176 +#> s(x):seriesseries1.2 -0.190 0.00420 0.260 1.00 222 +#> s(x):seriesseries1.3 -0.088 -0.00440 0.063 1.00 307 +#> s(x):seriesseries1.4 -0.150 -0.00084 0.150 1.00 250 +#> s(x):seriesseries1.5 -0.064 0.00330 0.092 1.00 232 +#> s(x):seriesseries1.6 -0.120 -0.00120 0.130 1.00 253 +#> s(x):seriesseries1.7 -0.036 -0.00051 0.028 1.00 364 +#> s(x):seriesseries1.8 -0.440 0.00740 0.500 1.00 223 +#> s(x):seriesseries1.9 0.280 0.70000 0.920 1.01 171 +#> s(x):seriesseries2.1 -0.650 -0.07300 0.070 1.02 76 +#> s(x):seriesseries2.2 -0.270 0.02900 0.520 1.03 138 +#> s(x):seriesseries2.3 -0.068 0.01300 0.170 1.02 191 +#> s(x):seriesseries2.4 -0.160 0.02600 0.340 1.03 142 +#> s(x):seriesseries2.5 -0.180 -0.01700 0.055 1.03 127 +#> s(x):seriesseries2.6 -0.120 0.02400 0.310 1.03 130 +#> s(x):seriesseries2.7 -0.031 0.00420 0.079 1.00 374 +#> s(x):seriesseries2.8 -0.430 0.12000 1.200 1.03 117 +#> s(x):seriesseries2.9 -0.800 -0.58000 0.013 1.02 89 #> #> Approximate significance of GAM smooths: #> edf Ref.df Chi.sq p-value -#> s(x):seriesseries1 1.93 9 53.8 <2e-16 *** -#> s(x):seriesseries2 1.08 9 27.6 0.42 +#> s(x):seriesseries1 2.12 9 27.4 < 2e-16 *** +#> s(x):seriesseries2 1.77 9 38.8 0.00017 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> @@ -1649,7 +1713,7 @@

    Examples#> 0 of 1000 iterations saturated the maximum tree depth of 12 (0%) #> E-FMI indicated no pathological behavior #> -#> Samples were drawn using NUTS(diag_e) at Thu Aug 29 11:01:26 AM 2024. +#> Samples were drawn using NUTS(diag_e) at Mon Sep 09 10:43:01 AM 2024. #> For each parameter, n_eff is a crude measure of effective sample size, #> and Rhat is the potential scale reduction factor on split MCMC chains #> (at convergence, Rhat = 1) @@ -1659,7 +1723,7 @@

    Examplespp_check(mod, type = "ecdf_overlay_grouped", group = "series", ndraws = 50) -conditional_effects(mod, type = 'link') +conditional_effects(mod, type = 'link') # } diff --git a/docs/reference/mvgam_diagnostics.html b/docs/reference/mvgam_diagnostics.html index 3b631b5f..879c12a0 100644 --- a/docs/reference/mvgam_diagnostics.html +++ b/docs/reference/mvgam_diagnostics.html @@ -119,49 +119,62 @@

    Examples chains = 2) #> Compiling Stan program using cmdstanr #> +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f8335480c.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory #> Start sampling #> Running MCMC with 2 parallel chains... #> #> Chain 1 Iteration: 1 / 1000 [ 0%] (Warmup) -#> Chain 2 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 2 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) -#> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) -#> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) #> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) +#> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) -#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) +#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) -#> Chain 1 finished in 0.9 seconds. +#> Chain 1 finished in 0.3 seconds. #> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 2 finished in 1.0 seconds. +#> Chain 2 finished in 0.4 seconds. #> #> Both chains finished successfully. -#> Mean chain execution time: 0.9 seconds. -#> Total execution time: 1.1 seconds. +#> Mean chain execution time: 0.4 seconds. +#> Total execution time: 0.5 seconds. #> np <- nuts_params(mod) head(np) #> Chain Iteration Parameter Value -#> 1 1 1 accept_stat__ 0.946851 -#> 2 1 2 accept_stat__ 0.971100 -#> 3 1 3 accept_stat__ 0.980961 -#> 4 1 4 accept_stat__ 0.911601 -#> 5 1 5 accept_stat__ 0.926669 -#> 6 1 6 accept_stat__ 0.837443 +#> 1 1 1 accept_stat__ 0.944154 +#> 2 1 2 accept_stat__ 0.947702 +#> 3 1 3 accept_stat__ 0.919436 +#> 4 1 4 accept_stat__ 0.920023 +#> 5 1 5 accept_stat__ 0.998240 +#> 6 1 6 accept_stat__ 0.941577 # extract the number of divergence transitions sum(subset(np, Parameter == "divergent__")$Value) @@ -169,7 +182,7 @@

    Examples head(neff_ratio(mod)) #> mus[1,1] mus[2,1] mus[3,1] mus[4,1] mus[5,1] mus[6,1] -#> 0.6358219 0.3672060 0.7036268 0.8197350 0.6501380 0.4767678 +#> 0.4479520 0.7294096 0.7456069 0.8241892 0.7841851 0.7799631 # }

    diff --git a/docs/reference/mvgam_families-1.png b/docs/reference/mvgam_families-1.png index 84c6fd52..c84f0e76 100644 Binary files a/docs/reference/mvgam_families-1.png and b/docs/reference/mvgam_families-1.png differ diff --git a/docs/reference/mvgam_families.html b/docs/reference/mvgam_families.html index 082a0610..efc618a9 100644 --- a/docs/reference/mvgam_families.html +++ b/docs/reference/mvgam_families.html @@ -244,25 +244,38 @@

    Examples#> Your model may benefit from using "noncentred = TRUE" #> Compiling Stan program using cmdstanr #> +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f8b195da5.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory #> Start sampling #> Running MCMC with 2 parallel chains... #> #> Chain 1 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 2 Iteration: 1 / 1000 [ 0%] (Warmup) -#> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) -#> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) +#> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) -#> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) +#> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) -#> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) -#> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) +#> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) +#> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) #> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) @@ -270,24 +283,24 @@

    Examples#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 2 finished in 45.9 seconds. +#> Chain 2 finished in 9.9 seconds. #> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 1 finished in 46.5 seconds. +#> Chain 1 finished in 10.4 seconds. #> #> Both chains finished successfully. -#> Mean chain execution time: 46.2 seconds. -#> Total execution time: 46.6 seconds. +#> Mean chain execution time: 10.1 seconds. +#> Total execution time: 10.4 seconds. #> # The usual diagnostics summary(mod) #> GAM observation formula: #> obs ~ species - 1 -#> <environment: 0x000001e60fc56eb8> +#> <environment: 0x00000251dbf04c98> #> #> GAM process formula: #> ~s(time, by = trend, k = 4) + species -#> <environment: 0x000001e60fc56eb8> +#> <environment: 0x00000251dbf04c98> #> #> Family: #> nmix @@ -314,25 +327,25 @@

    Examples#> #> #> GAM observation model coefficient (beta) estimates: -#> 2.5% 50% 97.5% Rhat n_eff -#> speciessp_1 -0.28 0.700 1.40 1 522 -#> speciessp_2 -1.10 -0.012 0.84 1 532 +#> 2.5% 50% 97.5% Rhat n_eff +#> speciessp_1 -0.27 0.68000 1.40 1 376 +#> speciessp_2 -1.20 -0.00015 0.89 1 503 #> #> GAM process model coefficient (beta) estimates: -#> 2.5% 50% 97.5% Rhat n_eff -#> (Intercept)_trend 2.700 3.0000 3.400 1.00 555 -#> speciessp_2_trend -1.300 -0.6200 0.130 1.00 545 -#> s(time):trendtrend1.1_trend -0.068 0.0140 0.210 1.00 361 -#> s(time):trendtrend1.2_trend -0.230 0.0069 0.250 1.00 564 -#> s(time):trendtrend1.3_trend -0.470 -0.2500 -0.034 1.00 586 -#> s(time):trendtrend2.1_trend -0.290 -0.0150 0.088 1.01 158 -#> s(time):trendtrend2.2_trend -0.170 0.0350 0.550 1.00 170 -#> s(time):trendtrend2.3_trend 0.056 0.3300 0.600 1.01 480 +#> 2.5% 50% 97.5% Rhat n_eff +#> (Intercept)_trend 2.700 3.00000 3.400 1.00 359 +#> speciessp_2_trend -1.200 -0.62000 0.170 1.00 357 +#> s(time):trendtrend1.1_trend -0.074 0.01600 0.200 1.00 276 +#> s(time):trendtrend1.2_trend -0.280 -0.00085 0.270 1.00 341 +#> s(time):trendtrend1.3_trend -0.460 -0.25000 -0.050 1.00 412 +#> s(time):trendtrend2.1_trend -0.300 -0.01600 0.082 1.01 105 +#> s(time):trendtrend2.2_trend -0.190 0.03500 0.610 1.01 140 +#> s(time):trendtrend2.3_trend 0.043 0.32000 0.620 1.00 499 #> #> Approximate significance of GAM process smooths: -#> edf Ref.df Chi.sq p-value -#> s(time):seriestrend1 1.01 3 2.52 0.50 -#> s(time):seriestrend2 1.11 3 1.06 0.86 +#> edf Ref.df Chi.sq p-value +#> s(time):seriestrend1 0.964 3 3.59 0.64 +#> s(time):seriestrend2 0.966 3 4.08 0.81 #> #> Stan MCMC diagnostics: #> n_eff / iter looks reasonable for all parameters @@ -341,17 +354,17 @@

    Examples#> 0 of 1000 iterations saturated the maximum tree depth of 12 (0%) #> E-FMI indicated no pathological behavior #> -#> Samples were drawn using NUTS(diag_e) at Tue Sep 03 2:04:02 PM 2024. +#> Samples were drawn using NUTS(diag_e) at Mon Sep 09 10:44:18 AM 2024. #> For each parameter, n_eff is a crude measure of effective sample size, #> and Rhat is the potential scale reduction factor on split MCMC chains #> (at convergence, Rhat = 1) # Plotting conditional effects library(ggplot2); library(marginaleffects) -#> Warning: package ‘ggplot2’ was built under R version 4.2.3 +#> Warning: package ‘ggplot2’ was built under R version 4.3.3 #> RStudio Community is a great place to get help: #> https://community.rstudio.com/c/tidyverse -plot_predictions(mod, condition = 'species', +plot_predictions(mod, condition = 'species', type = 'detection') + ylab('Pr(detection)') + ylim(c(0, 1)) + @@ -383,9 +396,6 @@

    Examplesmod <- mvgam(cbind(y, ntrials) ~ series + s(x, by = series), family = binomial(), data = dat) -#> Warning: Binomial and Beta-binomial families require cbind(n_successes, n_trials) -#> in the formula left-hand side. Do not use cbind(n_successes, n_failures)! -#> This warning is displayed once per session. #> Compiling Stan program using cmdstanr #> #> Start sampling @@ -396,62 +406,62 @@

    Examples#> Chain 3 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 4 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 3 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 4 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 3 Iteration: 100 / 1000 [ 10%] (Warmup) +#> Chain 4 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) +#> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 3 Iteration: 200 / 1000 [ 20%] (Warmup) -#> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) +#> Chain 4 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) -#> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) -#> Chain 4 Iteration: 200 / 1000 [ 20%] (Warmup) -#> Chain 3 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) -#> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 3 Iteration: 400 / 1000 [ 40%] (Warmup) -#> Chain 4 Iteration: 300 / 1000 [ 30%] (Warmup) -#> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 3 Iteration: 500 / 1000 [ 50%] (Warmup) +#> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) +#> Chain 3 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 4 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 3 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 3 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 4 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 4 Iteration: 501 / 1000 [ 50%] (Sampling) #> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) -#> Chain 3 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) +#> Chain 3 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 4 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) -#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) +#> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) +#> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) +#> Chain 3 Iteration: 500 / 1000 [ 50%] (Warmup) +#> Chain 3 Iteration: 501 / 1000 [ 50%] (Sampling) #> Chain 4 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 3 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) -#> Chain 4 Iteration: 800 / 1000 [ 80%] (Sampling) -#> Chain 3 Iteration: 900 / 1000 [ 90%] (Sampling) -#> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 2 finished in 3.3 seconds. #> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 3 Iteration: 1000 / 1000 [100%] (Sampling) +#> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 3 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 4 Iteration: 800 / 1000 [ 80%] (Sampling) +#> Chain 1 finished in 1.1 seconds. +#> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 3 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 4 Iteration: 900 / 1000 [ 90%] (Sampling) -#> Chain 1 finished in 3.5 seconds. -#> Chain 3 finished in 3.5 seconds. +#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) +#> Chain 3 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 4 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 4 finished in 3.6 seconds. +#> Chain 4 finished in 1.3 seconds. +#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) +#> Chain 3 Iteration: 900 / 1000 [ 90%] (Sampling) +#> Chain 3 Iteration: 1000 / 1000 [100%] (Sampling) +#> Chain 3 finished in 1.4 seconds. +#> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) +#> Chain 2 finished in 1.5 seconds. #> #> All 4 chains finished successfully. -#> Mean chain execution time: 3.5 seconds. -#> Total execution time: 3.8 seconds. +#> Mean chain execution time: 1.3 seconds. +#> Total execution time: 1.6 seconds. #> summary(mod) #> GAM formula: #> cbind(y, ntrials) ~ series + s(x, by = series) -#> <environment: 0x000001e60fc56eb8> +#> <environment: 0x00000251dbf04c98> #> #> Family: #> binomial @@ -476,43 +486,42 @@

    Examples#> #> GAM coefficient (beta) estimates: #> 2.5% 50% 97.5% Rhat n_eff -#> (Intercept) -0.550 -0.41000 -0.260 1.00 1198 -#> seriesseries2 -0.170 0.02500 0.230 1.00 1140 -#> s(x):seriesseries1.1 -0.220 -0.00640 0.190 1.00 765 -#> s(x):seriesseries1.2 -0.240 0.00210 0.290 1.01 603 -#> s(x):seriesseries1.3 -0.057 0.00640 0.110 1.00 448 -#> s(x):seriesseries1.4 -0.160 -0.00510 0.130 1.00 693 -#> s(x):seriesseries1.5 -0.040 0.00200 0.051 1.00 815 -#> s(x):seriesseries1.6 -0.140 -0.00340 0.120 1.01 620 -#> s(x):seriesseries1.7 -0.022 0.00084 0.028 1.00 951 -#> s(x):seriesseries1.8 -0.550 0.01800 0.650 1.00 654 -#> s(x):seriesseries1.9 0.810 1.20000 1.400 1.00 617 -#> s(x):seriesseries2.1 -0.120 0.05200 0.700 1.05 66 -#> s(x):seriesseries2.2 -0.930 -0.02600 0.260 1.03 122 -#> s(x):seriesseries2.3 -0.260 -0.00420 0.091 1.04 97 -#> s(x):seriesseries2.4 -0.200 0.00014 0.390 1.02 341 -#> s(x):seriesseries2.5 -0.190 -0.00480 0.041 1.03 109 -#> s(x):seriesseries2.6 -0.160 0.00360 0.410 1.03 143 -#> s(x):seriesseries2.7 -0.056 -0.00025 0.039 1.00 691 -#> s(x):seriesseries2.8 -1.700 -0.00180 0.700 1.03 146 -#> s(x):seriesseries2.9 -1.200 -0.94000 -0.038 1.05 65 +#> (Intercept) -0.550 -0.41000 -0.270 1.01 833 +#> seriesseries2 -0.170 0.03000 0.220 1.00 1020 +#> s(x):seriesseries1.1 -0.200 0.00089 0.200 1.00 504 +#> s(x):seriesseries1.2 -0.280 0.00670 0.320 1.00 475 +#> s(x):seriesseries1.3 -0.150 -0.00370 0.068 1.00 317 +#> s(x):seriesseries1.4 -0.160 0.00140 0.160 1.00 461 +#> s(x):seriesseries1.5 -0.045 0.00053 0.057 1.00 562 +#> s(x):seriesseries1.6 -0.140 0.00210 0.150 1.00 423 +#> s(x):seriesseries1.7 -0.031 -0.00050 0.024 1.01 433 +#> s(x):seriesseries1.8 -0.670 -0.00710 0.650 1.00 457 +#> s(x):seriesseries1.9 0.830 1.20000 1.500 1.01 378 +#> s(x):seriesseries2.1 -0.120 0.04300 0.630 1.02 128 +#> s(x):seriesseries2.2 -0.250 0.01900 0.680 1.01 158 +#> s(x):seriesseries2.3 -0.081 0.00290 0.190 1.01 261 +#> s(x):seriesseries2.4 -0.200 -0.00035 0.250 1.01 285 +#> s(x):seriesseries2.5 -0.140 -0.00390 0.040 1.01 208 +#> s(x):seriesseries2.6 -0.130 0.00300 0.280 1.01 176 +#> s(x):seriesseries2.7 -0.037 0.00032 0.058 1.00 669 +#> s(x):seriesseries2.8 -1.200 -0.00260 0.630 1.01 188 +#> s(x):seriesseries2.9 -1.200 -0.96000 -0.140 1.02 146 #> #> Approximate significance of GAM smooths: #> edf Ref.df Chi.sq p-value -#> s(x):seriesseries1 1.06 9 71.5 0.00081 *** -#> s(x):seriesseries2 1.65 9 55.5 < 2e-16 *** +#> s(x):seriesseries1 1.10 9 70.4 0.0016 ** +#> s(x):seriesseries2 2.45 9 60.7 <2e-16 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> Stan MCMC diagnostics: #> n_eff / iter looks reasonable for all parameters -#> Rhats above 1.05 found for 3 parameters -#> *Diagnose further to investigate why the chains have not mixed +#> Rhat looks reasonable for all parameters #> 0 of 2000 iterations ended with a divergence (0%) #> 0 of 2000 iterations saturated the maximum tree depth of 12 (0%) #> E-FMI indicated no pathological behavior #> -#> Samples were drawn using NUTS(diag_e) at Tue Sep 03 2:04:52 PM 2024. +#> Samples were drawn using NUTS(diag_e) at Mon Sep 09 10:44:23 AM 2024. #> For each parameter, n_eff is a crude measure of effective sample size, #> and Rhat is the potential scale reduction factor on split MCMC chains #> (at convergence, Rhat = 1) diff --git a/docs/reference/mvgam_marginaleffects.html b/docs/reference/mvgam_marginaleffects.html index 8fffd966..4a4eae81 100644 --- a/docs/reference/mvgam_marginaleffects.html +++ b/docs/reference/mvgam_marginaleffects.html @@ -70,16 +70,16 @@

    Usage

    # S3 method for mvgam
    -get_coef(model, trend_effects = FALSE, ...)
    +get_coef(model, trend_effects = FALSE, ...)
     
     # S3 method for mvgam
    -set_coef(model, coefs, trend_effects = FALSE, ...)
    +set_coef(model, coefs, trend_effects = FALSE, ...)
     
     # S3 method for mvgam
    -get_vcov(model, vcov = NULL, ...)
    +get_vcov(model, vcov = NULL, ...)
     
     # S3 method for mvgam
    -get_predict(model, newdata, type = "response", process_error = FALSE, ...)
    +get_predict(model, newdata, type = "response", process_error = FALSE, ...)
     
     # S3 method for mvgam
     get_data(x, source = "environment", verbose = TRUE, ...)
    @@ -128,7 +128,7 @@ 

    Arguments?slopes documentation for a non-exhaustive list of available +?slopes documentation for a non-exhaustive list of available arguments.

    @@ -153,11 +153,9 @@

    Argumentsinsight::get_data(), which tries to extract data from the environment. This may produce unexpected results if the original data frame has been altered since fitting the model.

    -
  • datagrid() call to specify a custom grid of regressors. For example:

  • diff --git a/docs/reference/plot.mvgam-1.png b/docs/reference/plot.mvgam-1.png index e910c73a..da26dc06 100644 Binary files a/docs/reference/plot.mvgam-1.png and b/docs/reference/plot.mvgam-1.png differ diff --git a/docs/reference/plot.mvgam-10.png b/docs/reference/plot.mvgam-10.png index fc716032..6cd4c02f 100644 Binary files a/docs/reference/plot.mvgam-10.png and b/docs/reference/plot.mvgam-10.png differ diff --git a/docs/reference/plot.mvgam-11.png b/docs/reference/plot.mvgam-11.png index 13586b86..0e02cf10 100644 Binary files a/docs/reference/plot.mvgam-11.png and b/docs/reference/plot.mvgam-11.png differ diff --git a/docs/reference/plot.mvgam-12.png b/docs/reference/plot.mvgam-12.png index 0592e677..0f64ca37 100644 Binary files a/docs/reference/plot.mvgam-12.png and b/docs/reference/plot.mvgam-12.png differ diff --git a/docs/reference/plot.mvgam-13.png b/docs/reference/plot.mvgam-13.png index 97438f9a..c835b942 100644 Binary files a/docs/reference/plot.mvgam-13.png and b/docs/reference/plot.mvgam-13.png differ diff --git a/docs/reference/plot.mvgam-2.png b/docs/reference/plot.mvgam-2.png index 921bc3d8..18483e35 100644 Binary files a/docs/reference/plot.mvgam-2.png and b/docs/reference/plot.mvgam-2.png differ diff --git a/docs/reference/plot.mvgam-3.png b/docs/reference/plot.mvgam-3.png index d7592176..53d395d5 100644 Binary files a/docs/reference/plot.mvgam-3.png and b/docs/reference/plot.mvgam-3.png differ diff --git a/docs/reference/plot.mvgam-4.png b/docs/reference/plot.mvgam-4.png index ab65921d..14890068 100644 Binary files a/docs/reference/plot.mvgam-4.png and b/docs/reference/plot.mvgam-4.png differ diff --git a/docs/reference/plot.mvgam-5.png b/docs/reference/plot.mvgam-5.png index dfa92135..3d42c50f 100644 Binary files a/docs/reference/plot.mvgam-5.png and b/docs/reference/plot.mvgam-5.png differ diff --git a/docs/reference/plot.mvgam-6.png b/docs/reference/plot.mvgam-6.png index 0ad8cf99..a114fd9b 100644 Binary files a/docs/reference/plot.mvgam-6.png and b/docs/reference/plot.mvgam-6.png differ diff --git a/docs/reference/plot.mvgam-7.png b/docs/reference/plot.mvgam-7.png index b05a5303..aaa7b3ac 100644 Binary files a/docs/reference/plot.mvgam-7.png and b/docs/reference/plot.mvgam-7.png differ diff --git a/docs/reference/plot.mvgam-8.png b/docs/reference/plot.mvgam-8.png index 94b32bcf..9ede9067 100644 Binary files a/docs/reference/plot.mvgam-8.png and b/docs/reference/plot.mvgam-8.png differ diff --git a/docs/reference/plot.mvgam-9.png b/docs/reference/plot.mvgam-9.png index e55ef646..90061d74 100644 Binary files a/docs/reference/plot.mvgam-9.png and b/docs/reference/plot.mvgam-9.png differ diff --git a/docs/reference/plot.mvgam.html b/docs/reference/plot.mvgam.html index 396b0582..dcdcdcb0 100644 --- a/docs/reference/plot.mvgam.html +++ b/docs/reference/plot.mvgam.html @@ -155,7 +155,7 @@

    See also

    plot_mvgam_resids, plot_mvgam_smooth, plot_mvgam_fc, plot_mvgam_trend, plot_mvgam_uncertainty, plot_mvgam_factors, plot_mvgam_randomeffects, conditional_effects.mvgam, -plot_predictions, plot_slopes, +plot_predictions, plot_slopes, gratia_mvgam_enhancements

    @@ -177,6 +177,19 @@

    Examples#> Your model may benefit from using "noncentred = TRUE" #> Compiling Stan program using cmdstanr #> +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f827f5212f.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory #> Start sampling #> Running MCMC with 2 parallel chains... #> @@ -184,32 +197,32 @@

    Examples#> Chain 2 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) -#> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) +#> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) -#> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) +#> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) -#> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) -#> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) +#> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) +#> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) +#> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) +#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) -#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 2 finished in 16.3 seconds. -#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) +#> Chain 2 finished in 6.5 seconds. #> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 1 finished in 32.9 seconds. +#> Chain 1 finished in 7.5 seconds. #> #> Both chains finished successfully. -#> Mean chain execution time: 24.6 seconds. -#> Total execution time: 33.0 seconds. +#> Mean chain execution time: 7.0 seconds. +#> Total execution time: 7.6 seconds. #> # Plot predictions and residuals for each series @@ -234,13 +247,13 @@

    Examples # More flexible plots with 'marginaleffects' utilities library(marginaleffects) -plot_predictions(mod, condition = 'season', type = 'link') +plot_predictions(mod, condition = 'season', type = 'link') -plot_predictions(mod, +plot_predictions(mod, condition = c('season', 'series', 'series'), type = 'link') -plot_predictions(mod, condition = 'series', type = 'link') +plot_predictions(mod, condition = 'series', type = 'link') # When using a State-Space model with predictors on the process @@ -253,6 +266,19 @@

    Examples#> Your model may benefit from using "noncentred = TRUE" #> Compiling Stan program using cmdstanr #> +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f8280855a9.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory #> Start sampling #> Running MCMC with 2 parallel chains... #> @@ -262,36 +288,36 @@

    Examples#> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) +#> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) -#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) -#> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) -#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 1 finished in 15.2 seconds. #> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) +#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) +#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) +#> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 2 finished in 55.4 seconds. +#> Chain 2 finished in 4.4 seconds. +#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) +#> Chain 1 finished in 4.5 seconds. #> #> Both chains finished successfully. -#> Mean chain execution time: 35.3 seconds. -#> Total execution time: 55.5 seconds. +#> Mean chain execution time: 4.4 seconds. +#> Total execution time: 4.6 seconds. #> plot(mod, type = 'smooths', trend_effects = TRUE) # But marginaleffects functions work without any modification -plot_predictions(mod, condition = 'season', type = 'link') +plot_predictions(mod, condition = 'season', type = 'link') # } diff --git a/docs/reference/posterior_epred.mvgam.html b/docs/reference/posterior_epred.mvgam.html index 0cf92587..fa95f5c8 100644 --- a/docs/reference/posterior_epred.mvgam.html +++ b/docs/reference/posterior_epred.mvgam.html @@ -177,71 +177,84 @@

    Examples data = simdat$data_train) #> Compiling Stan program using cmdstanr #> +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f8239e6cbd.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory #> Start sampling #> Running MCMC with 4 parallel chains... #> #> Chain 1 Iteration: 1 / 1000 [ 0%] (Warmup) -#> Chain 2 Iteration: 1 / 1000 [ 0%] (Warmup) -#> Chain 3 Iteration: 1 / 1000 [ 0%] (Warmup) -#> Chain 4 Iteration: 1 / 1000 [ 0%] (Warmup) #> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 1 Iteration: 300 / 1000 [ 30%] (Warmup) +#> Chain 2 Iteration: 1 / 1000 [ 0%] (Warmup) +#> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) +#> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 3 Iteration: 1 / 1000 [ 0%] (Warmup) +#> Chain 3 Iteration: 100 / 1000 [ 10%] (Warmup) +#> Chain 3 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 4 Iteration: 1 / 1000 [ 0%] (Warmup) +#> Chain 4 Iteration: 100 / 1000 [ 10%] (Warmup) #> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 3 Iteration: 100 / 1000 [ 10%] (Warmup) -#> Chain 3 Iteration: 200 / 1000 [ 20%] (Warmup) +#> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) +#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 3 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 3 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 3 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 3 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 4 Iteration: 100 / 1000 [ 10%] (Warmup) +#> Chain 3 Iteration: 600 / 1000 [ 60%] (Sampling) +#> Chain 3 Iteration: 700 / 1000 [ 70%] (Sampling) +#> Chain 3 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 4 Iteration: 200 / 1000 [ 20%] (Warmup) #> Chain 4 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 4 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 4 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 4 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 3 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 4 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) -#> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 3 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 3 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 4 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 4 Iteration: 800 / 1000 [ 80%] (Sampling) +#> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) +#> Chain 2 finished in 0.3 seconds. #> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) -#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) -#> Chain 3 Iteration: 900 / 1000 [ 90%] (Sampling) -#> Chain 4 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) +#> Chain 3 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 3 Iteration: 1000 / 1000 [100%] (Sampling) +#> Chain 4 Iteration: 900 / 1000 [ 90%] (Sampling) #> Chain 4 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 1 finished in 0.7 seconds. -#> Chain 3 finished in 0.8 seconds. -#> Chain 4 finished in 0.7 seconds. -#> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 2 finished in 0.8 seconds. +#> Chain 1 finished in 0.4 seconds. +#> Chain 3 finished in 0.4 seconds. +#> Chain 4 finished in 0.4 seconds. #> #> All 4 chains finished successfully. -#> Mean chain execution time: 0.8 seconds. -#> Total execution time: 1.0 seconds. +#> Mean chain execution time: 0.4 seconds. +#> Total execution time: 0.5 seconds. #> # Compute posterior expectations expectations <- posterior_epred(mod) str(expectations) -#> num [1:2000, 1:75] 2.25 1.96 1.83 1.73 2.27 ... +#> num [1:2000, 1:75] 0.54 0.371 0.542 0.376 0.676 ... # }

    diff --git a/docs/reference/reexports.html b/docs/reference/reexports.html index fdaf67c0..e069d9ea 100644 --- a/docs/reference/reexports.html +++ b/docs/reference/reexports.html @@ -115,7 +115,7 @@
    marginaleffects
    -

    comparisons, datagrid, hypotheses, plot_comparisons, plot_predictions, plot_slopes, predictions, slopes

    +

    comparisons, datagrid, hypotheses, plot_comparisons, plot_predictions, plot_slopes, predictions, slopes

    mgcv
    diff --git a/docs/reference/score.mvgam_forecast.html b/docs/reference/score.mvgam_forecast.html index a6fccf94..a0955c25 100644 --- a/docs/reference/score.mvgam_forecast.html +++ b/docs/reference/score.mvgam_forecast.html @@ -151,6 +151,19 @@

    Examples#> Your model may benefit from using "noncentred = TRUE" #> Compiling Stan program using cmdstanr #> +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f82091fd4.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory #> Start sampling #> Running MCMC with 2 parallel chains... #> @@ -164,26 +177,26 @@

    Examples#> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup) #> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup) #> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup) -#> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) -#> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup) +#> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup) #> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling) -#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) +#> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling) #> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling) -#> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) +#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling) #> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling) -#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 1 finished in 10.2 seconds. +#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling) #> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling) +#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling) #> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling) -#> Chain 2 finished in 14.5 seconds. +#> Chain 2 finished in 2.6 seconds. +#> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling) +#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling) +#> Chain 1 finished in 3.8 seconds. #> #> Both chains finished successfully. -#> Mean chain execution time: 12.4 seconds. -#> Total execution time: 14.7 seconds. +#> Mean chain execution time: 3.2 seconds. +#> Total execution time: 3.8 seconds. #> # Extract forecasts into a 'mvgam_forecast' object @@ -194,25 +207,25 @@

    Examplesstr(fc_scores) #> List of 4 #> $ series_1 :'data.frame': 25 obs. of 5 variables: -#> ..$ score : num [1:25] 1.886 0.349 0.316 0.973 0.276 ... +#> ..$ score : num [1:25] 0.378 0.382 0.784 0.376 0.245 ... #> ..$ in_interval : num [1:25] 1 1 1 1 1 1 1 1 1 1 ... #> ..$ interval_width: num [1:25] 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 ... #> ..$ eval_horizon : int [1:25] 1 2 3 4 5 6 7 8 9 10 ... #> ..$ score_type : chr [1:25] "drps" "drps" "drps" "drps" ... #> $ series_2 :'data.frame': 25 obs. of 5 variables: -#> ..$ score : num [1:25] 1.928 0.19 0.47 0.315 0.382 ... +#> ..$ score : num [1:25] 1.4 2.67 2.62 1.33 1.35 ... #> ..$ in_interval : num [1:25] 1 1 1 1 1 1 1 1 1 1 ... #> ..$ interval_width: num [1:25] 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 ... #> ..$ eval_horizon : int [1:25] 1 2 3 4 5 6 7 8 9 10 ... #> ..$ score_type : chr [1:25] "drps" "drps" "drps" "drps" ... #> $ series_3 :'data.frame': 25 obs. of 5 variables: -#> ..$ score : num [1:25] 0.337 0.344 1.095 0.228 0.246 ... -#> ..$ in_interval : num [1:25] 1 1 1 1 1 1 1 1 1 1 ... +#> ..$ score : num [1:25] 0.342 2.639 0.909 0.874 0.298 ... +#> ..$ in_interval : num [1:25] 1 0 1 1 1 1 1 1 1 1 ... #> ..$ interval_width: num [1:25] 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 ... #> ..$ eval_horizon : int [1:25] 1 2 3 4 5 6 7 8 9 10 ... #> ..$ score_type : chr [1:25] "drps" "drps" "drps" "drps" ... #> $ all_series:'data.frame': 25 obs. of 3 variables: -#> ..$ score : num [1:25] 4.152 0.883 1.882 1.516 0.904 ... +#> ..$ score : num [1:25] 2.12 5.69 4.31 2.58 1.89 ... #> ..$ eval_horizon: int [1:25] 1 2 3 4 5 6 7 8 9 10 ... #> ..$ score_type : chr [1:25] "sum_drps" "sum_drps" "sum_drps" "sum_drps" ... # } diff --git a/docs/reference/stability.mvgam-1.png b/docs/reference/stability.mvgam-1.png index 0f799a65..81477826 100644 Binary files a/docs/reference/stability.mvgam-1.png and b/docs/reference/stability.mvgam-1.png differ diff --git a/docs/reference/stability.mvgam-2.png b/docs/reference/stability.mvgam-2.png index 74c2a0b4..4e7e376f 100644 Binary files a/docs/reference/stability.mvgam-2.png and b/docs/reference/stability.mvgam-2.png differ diff --git a/docs/reference/stability.mvgam-3.png b/docs/reference/stability.mvgam-3.png index 10b0c961..2b520039 100644 Binary files a/docs/reference/stability.mvgam-3.png and b/docs/reference/stability.mvgam-3.png differ diff --git a/docs/reference/stability.mvgam.html b/docs/reference/stability.mvgam.html index 68a89d7e..01a71546 100644 --- a/docs/reference/stability.mvgam.html +++ b/docs/reference/stability.mvgam.html @@ -72,7 +72,7 @@

    Usage
    stability(object, ...)
     
     # S3 method for mvgam
    -stability(object, ...)
    +stability(object)
    @@ -91,12 +91,13 @@

    ArgumentsValue

    -

    A data.frame containing posterior draws for each of the above stability metrics.

    +

    An data.frame containing posterior draws for each stability metric.

    Details

    -

    These measures of stability can be used to assess how systems respond to -environmental perturbations. Using the formula for a latent VAR(1) as: +

    These measures of stability can be used to assess how important inter-series +dependencies are to the variability of a multivariate system and to ask how systems +are expected to respond to environmental perturbations. Using the formula for a latent VAR(1) as: $$ \mu_t \sim \text{MVNormal}(A(\mu_{t - 1}), \Sigma) \quad $$ @@ -107,8 +108,8 @@

    Details -
  • prop_int_adj: Same as prop_int but scaled by the number of series to facilitate -direct comparisons among systems with different numbers of interacting variables \(p\): +

  • prop_int_adj: Same as prop_int but scaled by the number of series \(p\) to facilitate +direct comparisons among systems with different numbers of interacting variables: $$ det(A)^{2/p} \quad $$

  • @@ -126,17 +127,10 @@

    Details -
  • prop_cov_offdiag: Sensitivity of \(\Sigma_{\infty}\) to inter-series error correlations +

  • prop_cov: Sensitivity of \(\Sigma_{\infty}\) to intra-series error correlations (i.e. how important are off-diagonal covariances in \(\Sigma\) for shaping \(\Sigma_{\infty}\)?), calculated as the relative magnitude of the off-diagonals in the partial derivative matrix: -$$ - [2~det(\Sigma_{\infty}) (\Sigma_{\infty}^{-1})^T] \quad - $$

  • -
  • prop_cov_diag: Sensitivity of \(\Sigma_{\infty}\) to intra-series error variances -(i.e. how important are diagonal variances in \(\Sigma\) for shaping -\(\Sigma_{\infty}\)?), calculated as the relative magnitude of the diagonals in -the partial derivative matrix: $$ [2~det(\Sigma_{\infty}) (\Sigma_{\infty}^{-1})^T] \quad $$

  • @@ -160,7 +154,9 @@

    Details -

    +

    To more directly inspect possible interactions among the time series in a latent VAR process, +you can inspect Generalized Orthogonalized Impulse Response Functions using the irf function.

    +

    References

    AR Ives, B Dennis, KL Cottingham & SR Carpenter (2003). @@ -169,7 +165,7 @@

    References

    See also

    - +

    Author

    @@ -187,14 +183,26 @@

    Examplesplot_mvgam_series(data = simdat$data_train, series = 'all') -# Fit a State-Space VAR(1) -mod <- mvgam(y ~ series, - trend_formula = ~ -1, +# Fit a model that uses a latent VAR(1) +mod <- mvgam(y ~ -1, + trend_formula = ~ 1, trend_model = VAR(cor = TRUE), family = gaussian(), - share_obs_params = TRUE, data = simdat$data_train, silent = 2) +#> In file included from stan/lib/stan_math/stan/math/prim/prob/von_mises_lccdf.hpp:5, +#> from stan/lib/stan_math/stan/math/prim/prob/von_mises_ccdf_log.hpp:4, +#> from stan/lib/stan_math/stan/math/prim/prob.hpp:359, +#> from stan/lib/stan_math/stan/math/prim.hpp:16, +#> from stan/lib/stan_math/stan/math/rev.hpp:16, +#> from stan/lib/stan_math/stan/math.hpp:19, +#> from stan/src/stan/model/model_header.hpp:4, +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f85c41daa.hpp:2: +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::von_mises_cdf(const T_x&, const T_mu&, const T_k&)': +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers +#> 194 | if (cdf_n < 0.0) +#> | +#> stan/lib/stan_math/stan/math/prim/prob/von_mises_cdf.hpp:194: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory # Calulate stability metrics for this system metrics <- stability(mod) @@ -202,66 +210,34 @@

    Examples# Proportion of stationary forecast distribution # attributable to lagged interactions hist(metrics$prop_int, - xlim = c(0, 1), - xlab = 'Prop_int', - main = '', - col = '#B97C7C', - border = 'white') + xlim = c(0, 1), + xlab = 'Prop_int', + main = '', + col = '#B97C7C', + border = 'white') -# Within this contribution of interactions, how important -# are inter-series interactions (offdiagonals of the A matrix) vs -# intra-series density dependence (diagonals of the A matrix)? -layout(matrix(1:2, nrow = 2)) -hist(metrics$prop_int_offdiag, - xlim = c(0, 1), - xlab = '', - main = 'Inter-series interactions', - col = '#B97C7C', - border = 'white') - -hist(metrics$prop_int_diag, - xlim = c(0, 1), - xlab = 'Contribution to interaction effect', - main = 'Intra-series interactions (density dependence)', - col = 'darkblue', - border = 'white') - -layout(1) - -# How important are inter-series error covariances -# (offdiagonals of the Sigma matrix) vs -# intra-series variances (diagonals of the Sigma matrix) for explaining -# the variance of the stationary forecast distribution? -layout(matrix(1:2, nrow = 2)) -hist(metrics$prop_cov_offdiag, - xlim = c(0, 1), - xlab = '', - main = 'Inter-series covariances', - col = '#B97C7C', - border = 'white') - -hist(metrics$prop_cov_diag, - xlim = c(0, 1), - xlab = 'Contribution to forecast variance', - main = 'Intra-series variances', - col = 'darkblue', - border = 'white') - -layout(1) +# Proportion of stationary forecast distribution +# attributable to correlated process errors +hist(metrics$prop_env, + xlim = c(0, 1), + xlab = 'Prop_env', + main = '', + col = '#B97C7C', + border = 'white') +#> Error in hist.default(metrics$prop_env, xlim = c(0, 1), xlab = "Prop_env", main = "", col = "#B97C7C", border = "white"): 'x' must be numeric # Reactivity, i.e. degree to which the system moves # away from a stable equilibrium following a perturbation -# (values > 1 suggest a more reactive, less stable system) hist(metrics$reactivity, - main = '', - xlab = 'Reactivity', - col = '#B97C7C', - border = 'white', - xlim = c(-1*max(abs(metrics$reactivity)), - max(abs(metrics$reactivity)))) + main = '', + xlab = 'Reactivity', + col = '#B97C7C', + border = 'white', + xlim = c(-1*max(abs(metrics$reactivity)), + max(abs(metrics$reactivity)))) abline(v = 0, lwd = 2.5) - + # }