diff --git a/docs/articles/data_in_mvgam.html b/docs/articles/data_in_mvgam.html
index 17989235..9a7d9d95 100644
--- a/docs/articles/data_in_mvgam.html
+++ b/docs/articles/data_in_mvgam.html
@@ -26,7 +26,7 @@
mvgam
- 1.1.3
+ 1.1.4
@@ -81,7 +81,7 @@
Nicholas J
Clark
- 2024-09-03
+ 2024-10-28
Source: vignettes/data_in_mvgam.Rmd
data_in_mvgam.Rmd
@@ -111,21 +111,21 @@ Note that you can technically supply data that does not have a
-series
indicator, and the package will assume that you are
-only using a single time series. But again, it is better to have this
-included so there is no confusion.
+series
indicator, and the package will generally assume
+that you are only using a single time series. There are exceptions to
+this, for example if you have grouped data and would like to estimate
+hierarchical dependencies (see an example of hierarchical process error
+correlations in the ?AR
documentation) or if you would like
+to set up a Joint Species Distribution Model (JSDM) using a Zero-Mean
+Multivariate Gaussian distribution for the latent residuals (see
+examples in the ?ZMVN
documentation).
Depending on the observation families you plan to use when building
models, there may be some restrictions that need to be satisfied within
the outcome variable. For example, a Beta regression can only handle
@@ -246,17 +251,17 @@
A single outcome variable levels = 'series1' ) ,
time = 1 : 10 )
gauss_dat
-#> outcome series time
-#> 1 -1.105964948 series1 1
-#> 2 0.299966201 series1 2
-#> 3 -0.942046180 series1 3
-#> 4 -0.001887559 series1 4
-#> 5 0.339117564 series1 5
-#> 6 1.458563643 series1 6
-#> 7 -0.024058830 series1 7
-#> 8 0.646390934 series1 8
-#> 9 -0.686607550 series1 9
-#> 10 0.126273947 series1 10
+#> outcome series time
+#> 1 -0.13861365 series1 1
+#> 2 -0.91744129 series1 2
+#> 3 -1.11421816 series1 3
+#> 4 -0.54160093 series1 4
+#> 5 -0.70531419 series1 5
+#> 6 0.41129640 series1 6
+#> 7 0.08264837 series1 7
+#> 8 0.74125282 series1 8
+#> 9 1.06481068 series1 9
+#> 10 -1.19286012 series1 10
A call to gam
using the mgcv
package leads
to a model that actually fits (though it does give an unhelpful warning
message):
@@ -264,17 +269,15 @@ A single outcome variablemgcv :: gam ( outcome ~ time ,
family = betar ( ) ,
data = gauss_dat )
-#> Warning in family$saturated.ll(y, prior.weights, theta): saturated likelihood
-#> may be inaccurate
#>
-#> Family: Beta regression(0.137)
+#> Family: Beta regression(0.149)
#> Link function: logit
#>
#> Formula:
#> outcome ~ time
#> Total model degrees of freedom 2
#>
-#> REML score: -149.2203
+#> REML score: -179.2758
But the same call to mvgam
gives us something more
useful:
@@ -367,15 +375,15 @@
Checking data with get_mvgam_
series = factor ( 'series_1' ) ,
outcome = rnorm ( 8 ) )
bad_times
-#> time series outcome
-#> 1 1 series_1 1.48518852
-#> 2 3 series_1 -0.56975888
-#> 3 5 series_1 -0.63240452
-#> 4 7 series_1 -2.30914822
-#> 5 9 series_1 -0.03495886
-#> 6 11 series_1 0.54345770
-#> 7 13 series_1 0.99494365
-#> 8 15 series_1 -0.35716657
+#> time series outcome
+#> 1 1 series_1 1.1513006
+#> 2 3 series_1 1.1254512
+#> 3 5 series_1 2.1308782
+#> 4 7 series_1 0.1698518
+#> 5 9 series_1 0.2252843
+#> 6 11 series_1 0.1634252
+#> 7 13 series_1 -0.8280628
+#> 8 15 series_1 -1.2064504
Next we call get_mvgam_priors
by simply specifying an
intercept-only model, which is enough to trigger all the checks:
@@ -394,24 +402,23 @@ Checking data with get_mvgam_
series = factor ( unique ( bad_times $ series ) ,
levels = levels ( bad_times $ series ) ) ) ) %>%
dplyr :: arrange ( time ) -> good_times
-#> Joining with `by = join_by(time, series)`
good_times
-#> time series outcome
-#> 1 1 series_1 1.48518852
-#> 2 2 series_1 NA
-#> 3 3 series_1 -0.56975888
-#> 4 4 series_1 NA
-#> 5 5 series_1 -0.63240452
-#> 6 6 series_1 NA
-#> 7 7 series_1 -2.30914822
-#> 8 8 series_1 NA
-#> 9 9 series_1 -0.03495886
-#> 10 10 series_1 NA
-#> 11 11 series_1 0.54345770
-#> 12 12 series_1 NA
-#> 13 13 series_1 0.99494365
-#> 14 14 series_1 NA
-#> 15 15 series_1 -0.35716657
+#> time series outcome
+#> 1 1 series_1 1.1513006
+#> 2 2 series_1 NA
+#> 3 3 series_1 1.1254512
+#> 4 4 series_1 NA
+#> 5 5 series_1 2.1308782
+#> 6 6 series_1 NA
+#> 7 7 series_1 0.1698518
+#> 8 8 series_1 NA
+#> 9 9 series_1 0.2252843
+#> 10 10 series_1 NA
+#> 11 11 series_1 0.1634252
+#> 12 12 series_1 NA
+#> 13 13 series_1 -0.8280628
+#> 14 14 series_1 NA
+#> 15 15 series_1 -1.2064504
Now the call to get_mvgam_priors
, using our filled in
data, should work:
@@ -421,9 +428,9 @@ Checking data with get_mvgam_
#> param_name param_length param_info
#> 1 (Intercept) 1 (Intercept)
#> 2 vector<lower=0>[n_series] sigma_obs; 1 observation error sd
-#> prior example_change
-#> 1 (Intercept) ~ student_t(3, -0.2, 2.5); (Intercept) ~ normal(0, 1);
-#> 2 sigma_obs ~ student_t(3, 0, 2.5); sigma_obs ~ normal(-0.47, 0.56);
+#> prior example_change
+#> 1 (Intercept) ~ student_t(3, 0.2, 2.5); (Intercept) ~ normal(0, 1);
+#> 2 sigma_obs ~ student_t(3, 0, 2.5); sigma_obs ~ normal(-0.59, 0.77);
#> new_lowerbound new_upperbound
#> 1 NA NA
#> 2 NA NA
@@ -471,9 +478,9 @@ Checking data with get_mvgam_
#> param_name param_length param_info
#> 1 (Intercept) 1 (Intercept)
#> 2 vector<lower=0>[n_series] sigma_obs; 1 observation error sd
-#> prior example_change
-#> 1 (Intercept) ~ student_t(3, -0.4, 2.5); (Intercept) ~ normal(0, 1);
-#> 2 sigma_obs ~ student_t(3, 0, 2.5); sigma_obs ~ normal(-0.62, 1);
+#> prior example_change
+#> 1 (Intercept) ~ student_t(3, 0.2, 2.5); (Intercept) ~ normal(0, 1);
+#> 2 sigma_obs ~ student_t(3, 0, 2.5); sigma_obs ~ normal(0.52, 0.79);
#> new_lowerbound new_upperbound
#> 1 NA NA
#> 2 NA NA
@@ -496,17 +503,17 @@ Covariates with no NA
s= 'series1' ) ,
time = 1 : 10 )
miss_dat
-#> outcome cov series time
-#> 1 0.1561020 NA series1 1
-#> 2 0.1084784 0.98322738 series1 2
-#> 3 0.0330442 0.28407529 series1 3
-#> 4 0.6572311 -1.45353685 series1 4
-#> 5 0.8854784 0.02783985 series1 5
-#> 6 1.6044159 -1.17292983 series1 6
-#> 7 -0.9053955 0.88927692 series1 7
-#> 8 2.3019384 0.36575792 series1 8
-#> 9 0.1608429 -0.58446531 series1 9
-#> 10 0.9125095 3.75742498 series1 10
+#> outcome cov series time
+#> 1 -0.05154719 NA series1 1
+#> 2 -0.90557847 0.3056585 series1 2
+#> 3 1.57026671 -0.1043396 series1 3
+#> 4 -1.17614423 0.1857409 series1 4
+#> 5 -0.99307998 -1.1794223 series1 5
+#> 6 0.12506085 0.4783767 series1 6
+#> 7 2.03148116 0.8312380 series1 7
+#> 8 -0.03710697 1.2468830 series1 8
+#> 9 -0.23561841 0.2331789 series1 9
+#> 10 -0.31391472 -1.7201368 series1 10
+ dplyr :: distinct ( ) ) -> model_dat
Create the series
variable needed for mvgam
modelling:
+ run_model = FALSE )
This call runs without issue, and the resulting object now contains
the model code and data objects that are needed to initiate
sampling:
@@ -768,7 +772,7 @@ Example with NEON tick data#> $ S8 : num [1:8, 1:8] 1.037 -0.416 0.419 0.117 0.188 ...
#> $ p_coefs : Named num 0
#> ..- attr(*, "names")= chr "(Intercept)"
-#> $ p_taus : num 0.945
+#> $ p_taus : num 0.936
#> $ ytimes : int [1:416, 1:8] 1 9 17 25 33 41 49 57 65 73 ...
#> $ n_series : int 8
#> $ sp : Named num [1:9] 0.368 0.368 0.368 0.368 0.368 ...
diff --git a/docs/articles/data_in_mvgam_files/figure-html/unnamed-chunk-24-1.png b/docs/articles/data_in_mvgam_files/figure-html/unnamed-chunk-24-1.png
index a3825320..f4212e01 100644
Binary files a/docs/articles/data_in_mvgam_files/figure-html/unnamed-chunk-24-1.png and b/docs/articles/data_in_mvgam_files/figure-html/unnamed-chunk-24-1.png differ
diff --git a/docs/articles/data_in_mvgam_files/figure-html/unnamed-chunk-25-1.png b/docs/articles/data_in_mvgam_files/figure-html/unnamed-chunk-25-1.png
index 0c08f9cd..2730c50e 100644
Binary files a/docs/articles/data_in_mvgam_files/figure-html/unnamed-chunk-25-1.png and b/docs/articles/data_in_mvgam_files/figure-html/unnamed-chunk-25-1.png differ
diff --git a/docs/articles/data_in_mvgam_files/figure-html/unnamed-chunk-26-1.png b/docs/articles/data_in_mvgam_files/figure-html/unnamed-chunk-26-1.png
index cb03d0e4..83cdf28f 100644
Binary files a/docs/articles/data_in_mvgam_files/figure-html/unnamed-chunk-26-1.png and b/docs/articles/data_in_mvgam_files/figure-html/unnamed-chunk-26-1.png differ
diff --git a/docs/reference/GP.html b/docs/reference/GP.html
index 3ca7674e..7a0f7c11 100644
--- a/docs/reference/GP.html
+++ b/docs/reference/GP.html
@@ -16,7 +16,7 @@
mvgam
- 1.1.3
+ 1.1.4
@@ -59,13 +59,13 @@
Set up low-rank approximate Gaussian Process trend models using Hilbert
-basis expansions in mvgam
. This function does not evaluate its arguments –
+basis expansions in mvgam . This function does not evaluate its arguments –
it exists purely to help set up a model with particular GP
trend models.
@@ -86,7 +86,7 @@ Value An object of class mvgam_trend
, which contains a list of
-arguments to be interpreted by the parsing functions in mvgam
+arguments to be interpreted by the parsing functions in mvgam
diff --git a/docs/reference/RW.html b/docs/reference/RW.html
index 451e9b24..bf978ec9 100644
--- a/docs/reference/RW.html
+++ b/docs/reference/RW.html
@@ -2,7 +2,7 @@
Specify autoregressive dynamic processes — RW • mvgam Specify autoregressive dynamic processes in mvgam — RW • mvgam Specify correlated residual processes in mvgam — ZMVN • mvgam
+ Skip to contents
+
+
+
+
+
mvgam
+
+
1.1.4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Set up latent correlated multivariate Gaussian residual processes
+in mvgam . This function does not evaluate it's arguments –
+it exists purely to help set up a model with particular error processes.
+
+
+
+
Usage
+
ZMVN ( unit = time , gr = NA , subgr = series )
+
+
+
+
Arguments
+
unit
+The unquoted name of the variable that represents the unit of analysis in data
over
+which latent residuals should be correlated. This variable should be either a
+numeric
or integer
variable in the supplied data
.
+Defaults to time
to be consistent with other functionalities
+in mvgam , though note that the data need not be time series in this case. See examples below
+for further details and explanations
+
+
+gr
+An optional grouping variable, which must be a factor
in the supplied data
,
+for setting up hierarchical residual correlation structures. If specified,
+this will automatically set up a model where the
+residual correlations for a specific level of gr
are modelled hierarchically:
+\(\Omega_{group} = p\Omega_{global} + (1 - p)\Omega_{group, local}\),
+where \(\Omega_{global}\) is a global correlation
+matrix, \(\Omega_{group, local}\) is a local deviation correlation matrix
+and \(p\) is a weighting parameter
+controlling how strongly the local correlation matrix \(\Omega_{group}\) is shrunk towards the global
+correlation matrix \(\Omega_{global}\). If gr
is supplied then subgr
must also be supplied
+
+
+subgr
+A subgrouping factor
variable specifying which element in data
represents the
+different observational units. Defaults to series
to be consistent with other functionalities
+in mvgam , though note that the data need not be time series in this case.
+But note that models that use the hierarchical correlations (by supplying a value for gr
)
+should not include a series
element in data
. Rather, this element will be created internally based
+on the supplied variables for gr
and subgr
. For example, if you are modelling
+counts for a group of species (labelled as species
in the data) across sampling sites
+(labelled as site
in the data) in three
+different geographical regions (labelled as region
), and you would like the residuals to be correlated
+within regions, then you should specify
+unit = site
, gr = region
, and subgr = species
. Internally, mvgam()
will appropriately order
+the data by unit
(in this case, by site
) and create
+the series
element for the data using something like: series = as.factor(paste0(group, '_', subgroup))
+
+
+
+
Value
+
+
+
An object of class mvgam_trend
, which contains a list of
+arguments to be interpreted by the parsing functions in mvgam
+
+
+
+
+
+
Examples
+
if ( FALSE ) {
+# Simulate counts of four species over ten sampling locations
+site_dat <- data.frame ( site = rep ( 1 : 10 , 4 ) ,
+ species = as.factor ( sort ( rep ( letters [ 1 : 4 ] , 10 ) ) ) ,
+ y = c ( NA , rpois ( 39 , 3 ) ) )
+head ( site_dat )
+
+# Set up a correlated residual (i.e. Joint Species Distribution) model,
+# where 'site' represents the unit of analysis
+trend_model <- ZMVN ( unit = site , subgr = species )
+mod <- mvgam ( y ~ species ,
+ trend_model = ZMVN ( unit = site ,
+ subgr = species ) ,
+ data = site_dat ,
+ chains = 2 ,
+ silent = 2 )
+
+# Inspect the estimated species-species residual covariances
+mcmc_plot ( mod , variable = 'Sigma' , regex = TRUE , type = 'hist' )
+
+# A hierarchical correlation example; set up correlated counts
+# for three species across two sampling locations
+Sigma <- matrix ( c ( 1 , - 0.4 , 0.5 ,
+ - 0.4 , 1 , 0.3 ,
+ 0.5 , 0.3 , 1 ) ,
+ byrow = TRUE ,
+ nrow = 3 )
+ Sigma
+
+make_site_dat = function ( ... ) {
+ errors <- mgcv :: rmvn ( n = 30 ,
+ mu = c ( 0.6 , 0.8 , 1.8 ) ,
+ V = Sigma )
+ site_dat <- do.call ( rbind , lapply ( 1 : 3 , function ( spec ) {
+ data.frame ( y = rpois ( 30 ,
+ lambda = exp ( errors [ , spec ] ) ) ,
+ species = paste0 ( 'species' ,
+ spec ) ,
+ site = 1 : 30 )
+} ) )
+site_dat
+}
+
+site_dat <- rbind ( make_site_dat ( ) %>%
+ dplyr :: mutate ( group = 'group1' ) ,
+ make_site_dat ( ) %>%
+ dplyr :: mutate ( group = 'group2' ) ) %>%
+ dplyr :: mutate ( species = as.factor ( species ) ,
+ group = as.factor ( group ) )
+
+# Fit the hierarchical correlated residual model
+mod <- mvgam ( y ~ species ,
+ trend_model = ZMVN ( unit = site ,
+ gr = group ,
+ subgr = species ) ,
+ data = site_dat )
+
+# Inspect the estimated species-species residual covariances
+mcmc_plot ( mod , variable = 'Sigma' , regex = TRUE , type = 'hist' )
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/reference/fevd.mvgam-2.png b/docs/reference/fevd.mvgam-2.png
index bd75f6bc..aa8fd724 100644
Binary files a/docs/reference/fevd.mvgam-2.png and b/docs/reference/fevd.mvgam-2.png differ
diff --git a/docs/reference/fevd.mvgam.html b/docs/reference/fevd.mvgam.html
index 9cecddfb..1a159c69 100644
--- a/docs/reference/fevd.mvgam.html
+++ b/docs/reference/fevd.mvgam.html
@@ -12,7 +12,7 @@
mvgam
- 1.1.3
+ 1.1.4
@@ -149,19 +149,6 @@ 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/RtmpGcPapO/model-e5b066e7c36.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 forecast error variance decompositions for each series
fevds <- fevd ( mod , h = 12 )
diff --git a/docs/reference/figures/README-unnamed-chunk-12-1.png b/docs/reference/figures/README-unnamed-chunk-12-1.png
index 22d526ad..ab0a563b 100644
Binary files a/docs/reference/figures/README-unnamed-chunk-12-1.png and b/docs/reference/figures/README-unnamed-chunk-12-1.png differ
diff --git a/docs/reference/figures/README-unnamed-chunk-13-1.png b/docs/reference/figures/README-unnamed-chunk-13-1.png
index 52c9a7b5..1dd71f45 100644
Binary files a/docs/reference/figures/README-unnamed-chunk-13-1.png and b/docs/reference/figures/README-unnamed-chunk-13-1.png differ
diff --git a/docs/reference/figures/README-unnamed-chunk-14-1.png b/docs/reference/figures/README-unnamed-chunk-14-1.png
index a4ba74fd..10ddf9af 100644
Binary files a/docs/reference/figures/README-unnamed-chunk-14-1.png and b/docs/reference/figures/README-unnamed-chunk-14-1.png differ
diff --git a/docs/reference/figures/README-unnamed-chunk-15-1.png b/docs/reference/figures/README-unnamed-chunk-15-1.png
index 6a61fd8f..6bf5afe5 100644
Binary files a/docs/reference/figures/README-unnamed-chunk-15-1.png and b/docs/reference/figures/README-unnamed-chunk-15-1.png differ
diff --git a/docs/reference/figures/README-unnamed-chunk-16-1.png b/docs/reference/figures/README-unnamed-chunk-16-1.png
index 9d40c8f5..9929b3e1 100644
Binary files a/docs/reference/figures/README-unnamed-chunk-16-1.png and b/docs/reference/figures/README-unnamed-chunk-16-1.png differ
diff --git a/docs/reference/figures/README-unnamed-chunk-17-1.png b/docs/reference/figures/README-unnamed-chunk-17-1.png
index 4fe24996..513dffbf 100644
Binary files a/docs/reference/figures/README-unnamed-chunk-17-1.png and b/docs/reference/figures/README-unnamed-chunk-17-1.png differ
diff --git a/docs/reference/figures/README-unnamed-chunk-18-1.png b/docs/reference/figures/README-unnamed-chunk-18-1.png
index 7fae3eaa..e46fe4c1 100644
Binary files a/docs/reference/figures/README-unnamed-chunk-18-1.png and b/docs/reference/figures/README-unnamed-chunk-18-1.png differ
diff --git a/docs/reference/figures/README-unnamed-chunk-19-1.png b/docs/reference/figures/README-unnamed-chunk-19-1.png
index 1a4a6698..5698f0da 100644
Binary files a/docs/reference/figures/README-unnamed-chunk-19-1.png and b/docs/reference/figures/README-unnamed-chunk-19-1.png differ
diff --git a/docs/reference/figures/README-unnamed-chunk-20-1.png b/docs/reference/figures/README-unnamed-chunk-20-1.png
index 85cc3201..52bef894 100644
Binary files a/docs/reference/figures/README-unnamed-chunk-20-1.png and b/docs/reference/figures/README-unnamed-chunk-20-1.png differ
diff --git a/docs/reference/figures/README-unnamed-chunk-21-1.png b/docs/reference/figures/README-unnamed-chunk-21-1.png
index f567beab..77eb6bcb 100644
Binary files a/docs/reference/figures/README-unnamed-chunk-21-1.png and b/docs/reference/figures/README-unnamed-chunk-21-1.png differ
diff --git a/docs/reference/figures/README-unnamed-chunk-22-1.png b/docs/reference/figures/README-unnamed-chunk-22-1.png
index 3a595e9e..3ced63da 100644
Binary files a/docs/reference/figures/README-unnamed-chunk-22-1.png and b/docs/reference/figures/README-unnamed-chunk-22-1.png differ
diff --git a/docs/reference/figures/README-unnamed-chunk-23-1.png b/docs/reference/figures/README-unnamed-chunk-23-1.png
index db66b595..2bc904ef 100644
Binary files a/docs/reference/figures/README-unnamed-chunk-23-1.png and b/docs/reference/figures/README-unnamed-chunk-23-1.png differ
diff --git a/docs/reference/figures/README-unnamed-chunk-24-1.png b/docs/reference/figures/README-unnamed-chunk-24-1.png
index 113a91bd..08ee5af0 100644
Binary files a/docs/reference/figures/README-unnamed-chunk-24-1.png and b/docs/reference/figures/README-unnamed-chunk-24-1.png differ
diff --git a/docs/reference/forecast.mvgam-1.png b/docs/reference/forecast.mvgam-1.png
index db04e3d4..5d7564c7 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 44764c50..4bd6327f 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 b7c789b9..373e2385 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 9ebbd99c..b55f8528 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 fd1f30d2..0faa1ccb 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 03230e5f..dfcfd5bd 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 9bf120c0..4f638052 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 cdd33a4b..eef8d680 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 a1d39cba..a9223ef4 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 9a579c1a..11b997e3 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 7e577379..b5d19251 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 61f4c808..7b0b3230 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 68967f96..bfe14a7e 100644
--- a/docs/reference/forecast.mvgam.html
+++ b/docs/reference/forecast.mvgam.html
@@ -10,7 +10,7 @@
mvgam
- 1.1.3
+ 1.1.4
@@ -80,8 +80,8 @@ ArgumentsExamples 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 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 1 Iteration: 300 / 1000 [ 30%] (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: 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 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: 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 0.9 seconds.
+#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling)
#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling)
-#> Chain 1 finished in 1.1 seconds.
+#> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling)
+#> Chain 1 finished in 2.7 seconds.
+#> Chain 2 finished in 2.6 seconds.
#>
#> Both chains finished successfully.
-#> Mean chain execution time: 1.0 seconds.
-#> Total execution time: 1.2 seconds.
+#> Mean chain execution time: 2.7 seconds.
+#> Total execution time: 2.8 seconds.
#>
# Hindcasts on response scale
@@ -197,13 +184,16 @@ Examplesstr ( hc )
#> List of 15
#> $ call :Class 'formula' language y ~ s(season, bs = "cc", k = 6)
-#> .. ..- attr(*, ".Environment")=<environment: 0x00000251dbbb3bb8>
+#> .. ..- attr(*, ".Environment")=<environment: 0x000001f1650b5778>
#> $ trend_call : NULL
#> $ family : chr "poisson"
-#> $ trend_model :List of 4
+#> $ trend_model :List of 7
#> ..$ trend_model: chr "AR1"
#> ..$ ma : logi FALSE
#> ..$ cor : logi FALSE
+#> ..$ unit : chr "time"
+#> ..$ gr : chr "NA"
+#> ..$ subgr : chr "series"
#> ..$ label : language AR()
#> ..- attr(*, "class")= chr "mvgam_trend"
#> $ drift : logi FALSE
@@ -212,22 +202,22 @@ Examples#> $ type : chr "response"
#> $ series_names : chr [1:3] "series_1" "series_2" "series_3"
#> $ train_observations:List of 3
-#> ..$ series_1: int [1:75] 3 1 2 3 6 2 0 0 1 0 ...
-#> ..$ series_2: int [1:75] 1 2 0 1 2 1 0 0 0 0 ...
-#> ..$ series_3: int [1:75] 0 0 2 1 1 1 0 0 0 0 ...
+#> ..$ series_1: int [1:75] 0 1 2 4 0 1 13 6 1 3 ...
+#> ..$ series_2: int [1:75] 0 0 0 0 0 0 0 1 2 0 ...
+#> ..$ series_3: int [1:75] 0 0 0 0 0 1 2 2 1 0 ...
#> $ train_times : int [1:75] 1 2 3 4 5 6 7 8 9 10 ...
#> $ test_observations : NULL
#> $ test_times : NULL
#> $ hindcasts :List of 3
-#> ..$ series_1: num [1:1000, 1:75] 3 0 1 1 0 0 0 3 0 2 ...
+#> ..$ series_1: num [1:1000, 1:75] 1 0 0 0 0 0 0 0 1 0 ...
#> .. ..- 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 0 1 0 0 0 0 0 0 0 ...
+#> ..$ series_2: num [1:1000, 1:75] 1 2 0 1 0 0 0 0 1 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 0 1 1 0 0 1 0 ...
+#> ..$ series_3: num [1:1000, 1:75] 0 2 1 0 1 2 1 1 1 0 ...
#> .. ..- attr(*, "dimnames")=List of 2
#> .. .. ..$ : NULL
#> .. .. ..$ : chr [1:75] "ypred[1,3]" "ypred[2,3]" "ypred[3,3]" "ypred[4,3]" ...
@@ -248,14 +238,17 @@ Examplesstr ( fc )
#> List of 16
#> $ call :Class 'formula' language y ~ s(season, bs = "cc", k = 6)
-#> .. ..- attr(*, ".Environment")=<environment: 0x00000251dbbb3bb8>
+#> .. ..- attr(*, ".Environment")=<environment: 0x000001f1650b5778>
#> $ trend_call : NULL
#> $ family : chr "poisson"
#> $ family_pars : NULL
-#> $ trend_model :List of 4
+#> $ trend_model :List of 7
#> ..$ trend_model: chr "AR1"
#> ..$ ma : logi FALSE
#> ..$ cor : logi FALSE
+#> ..$ unit : chr "time"
+#> ..$ gr : chr "NA"
+#> ..$ subgr : chr "series"
#> ..$ label : language AR()
#> ..- attr(*, "class")= chr "mvgam_trend"
#> $ drift : logi FALSE
@@ -264,44 +257,44 @@ Examples#> $ type : chr "response"
#> $ series_names : Factor w/ 3 levels "series_1","series_2",..: 1 2 3
#> $ train_observations:List of 3
-#> ..$ series_1: int [1:75] 3 1 2 3 6 2 0 0 1 0 ...
-#> ..$ series_2: int [1:75] 1 2 0 1 2 1 0 0 0 0 ...
-#> ..$ series_3: int [1:75] 0 0 2 1 1 1 0 0 0 0 ...
+#> ..$ series_1: int [1:75] 0 1 2 4 0 1 13 6 1 3 ...
+#> ..$ series_2: int [1:75] 0 0 0 0 0 0 0 1 2 0 ...
+#> ..$ series_3: int [1:75] 0 0 0 0 0 1 2 2 1 0 ...
#> $ train_times : int [1:75] 1 2 3 4 5 6 7 8 9 10 ...
#> $ test_observations :List of 3
-#> ..$ series_1: int [1:25] 6 5 5 1 1 0 0 0 4 3 ...
-#> ..$ series_2: int [1:25] 3 1 0 0 0 0 0 0 0 0 ...
-#> ..$ series_3: int [1:25] 1 0 1 0 0 0 0 0 3 0 ...
+#> ..$ series_1: int [1:25] 2 1 1 12 2 6 0 5 0 0 ...
+#> ..$ series_2: int [1:25] 0 0 0 10 0 0 1 1 0 0 ...
+#> ..$ series_3: int [1:25] 1 1 1 4 1 3 0 0 1 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] 3 0 1 1 0 0 0 3 0 2 ...
+#> ..$ series_1: num [1:1000, 1:75] 1 0 0 0 0 0 0 0 1 0 ...
#> .. ..- 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 0 1 0 0 0 0 0 0 0 ...
+#> ..$ series_2: num [1:1000, 1:75] 1 2 0 1 0 0 0 0 1 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 0 1 1 0 0 1 0 ...
+#> ..$ series_3: num [1:1000, 1:75] 0 2 1 0 1 2 1 1 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] 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 ...
+#> ..$ series_1: int [1:1000, 1:25] 2 1 1 0 6 0 0 0 0 0 ...
+#> ..$ series_2: int [1:1000, 1:25] 1 2 1 0 0 2 0 0 0 1 ...
+#> ..$ series_3: int [1:1000, 1:25] 1 0 0 1 1 0 0 2 1 0 ...
#> - attr(*, "class")= chr "mvgam_forecast"
plot ( fc , series = 1 )
#> Out of sample DRPS:
-#> 31.457705
+#> 40.733034
plot ( fc , series = 2 )
#> Out of sample DRPS:
-#> 20.949768
+#> 20.222428
plot ( fc , series = 3 )
#> Out of sample DRPS:
-#> 9.884977
+#> 13.041625
# Forecasts as expectations
diff --git a/docs/reference/get_mvgam_priors.html b/docs/reference/get_mvgam_priors.html
index 7eb889c4..39433e25 100644
--- a/docs/reference/get_mvgam_priors.html
+++ b/docs/reference/get_mvgam_priors.html
@@ -12,7 +12,7 @@
mvgam
- 1.1.3
+ 1.1.4
@@ -87,7 +87,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
@@ -112,7 +112,7 @@
ArgumentsArguments CAR() trends in CAR
- Should also include any other variables to be included in the linear predictor of formula
+Note however that there are special cases where these identifiers are not needed. For
+example, models with hierarchical temporal correlation processes (e.g. AR(gr = region, subgr = species)
)
+should NOT include a series
identifier, as this will be constructed internally (see
+mvgam_trends
and AR
for details). mvgam
can also fit models that do not
+include a time
variable if there are no temporal dynamic structures included (i.e. trend_model = 'None'
or
+trend_model = ZMVN()
). data
should also include any other variables to be included in
+the linear predictor of formula
data_train
@@ -133,16 +139,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
@@ -187,6 +193,7 @@
Argumentsgam )
+ZMVN
or ZMVN()
(Zero-Mean Multivariate Normal; only available in Stan
)
'RW'
or RW()
'AR1'
or AR(p = 1)
'AR2'
or AR(p = 2)
@@ -196,9 +203,11 @@ ArgumentsPW() (only available in Stan
)
'GP'
or GP()
(Gaussian Process with squared exponential kernel;
only available in Stan
)
-For all trend types apart from GP()
, CAR()
and PW()
, moving average and/or correlated
+
For all trend types apart from ZMVN()
, GP()
, CAR()
and PW()
, moving average and/or correlated
process error terms can also be estimated (for example, RW(cor = TRUE)
will set up a
-multivariate Random Walk if n_series > 1
). See mvgam_trends for more details
+multivariate Random Walk if n_series > 1
). It is also possible for many multivariate trends
+to estimate hierarchical correlations if the data are structured among levels of
+a relevant grouping factor. See mvgam_trends for more details and see ZMVN for an example.
trend_map
@@ -264,8 +273,8 @@ Examples
# Get a model file that uses default mvgam priors for inspection (not always necessary,
# but this can be useful for testing whether your updated priors are written correctly)
-mod_default <- mvgam ( y ~ s ( series , bs = 're' ) +
- s ( season , bs = 'cc' ) - 1 ,
+mod_default <- mvgam ( y ~ s ( series , bs = 're' ) +
+ s ( season , bs = 'cc' ) - 1 ,
family = nb ( ) ,
data = dat $ data_train ,
trend_model = AR ( p = 2 ) ,
@@ -410,8 +419,8 @@ Examples#>
# Look at which priors can be updated in mvgam
-test_priors <- get_mvgam_priors ( y ~ s ( series , bs = 're' ) +
- s ( season , bs = 'cc' ) - 1 ,
+test_priors <- get_mvgam_priors ( y ~ s ( series , bs = 're' ) +
+ s ( season , bs = 'cc' ) - 1 ,
family = nb ( ) ,
data = dat $ data_train ,
trend_model = AR ( p = 2 ) )
@@ -432,14 +441,14 @@ Examples#> 5 trend AR2 coefficient ar2 ~ std_normal();
#> 6 trend sd sigma ~ student_t(3, 0, 2.5);
#> 7 inverse of NB dispsersion phi_inv ~ student_t(3, 0, 0.1);
-#> example_change new_lowerbound new_upperbound
-#> 1 lambda ~ exponential(0.54); NA NA
-#> 2 mu_raw ~ normal(0.83, 0.19); NA NA
-#> 3 sigma_raw ~ exponential(0.2); NA NA
-#> 4 ar1 ~ normal(-0.96, 0.93); NA NA
-#> 5 ar2 ~ normal(-0.26, 0.75); NA NA
-#> 6 sigma ~ exponential(0.46); NA NA
-#> 7 phi_inv ~ normal(-0.3, 0.87); NA NA
+#> example_change new_lowerbound new_upperbound
+#> 1 lambda ~ exponential(0.27); NA NA
+#> 2 mu_raw ~ normal(0.58, 0.14); NA NA
+#> 3 sigma_raw ~ exponential(0.42); NA NA
+#> 4 ar1 ~ normal(-0.22, 0.6); NA NA
+#> 5 ar2 ~ normal(-0.92, 0.63); NA NA
+#> 6 sigma ~ exponential(0.32); NA NA
+#> 7 phi_inv ~ normal(0.36, 0.79); NA NA
# Make a few changes; first, change the population mean for the series-level
# random intercepts
@@ -450,8 +459,8 @@ Examples
# Check that the changes are made to the model file without any warnings by
# setting 'run_model = FALSE'
-mod <- mvgam ( y ~ s ( series , bs = 're' ) +
- s ( season , bs = 'cc' ) - 1 ,
+mod <- mvgam ( y ~ s ( series , bs = 're' ) +
+ s ( season , bs = 'cc' ) - 1 ,
family = nb ( ) ,
data = dat $ data_train ,
trend_model = AR ( p = 2 ) ,
@@ -600,17 +609,17 @@ Examples# The same can be done using 'brms' functions; here we will also change the ar1 prior
# and put some bounds on the ar coefficients to enforce stationarity; we set the
# prior using the 'class' argument in all brms prior functions
-brmsprior <- c ( prior ( normal ( 0.2 , 0.5 ) , class = mu_raw ) ,
- prior ( normal ( 0 , 0.25 ) , class = ar1 , lb = - 1 , ub = 1 ) ,
- prior ( normal ( 0 , 0.25 ) , class = ar2 , lb = - 1 , ub = 1 ) )
+brmsprior <- c ( prior ( normal ( 0.2 , 0.5 ) , class = mu_raw ) ,
+ prior ( normal ( 0 , 0.25 ) , class = ar1 , lb = - 1 , ub = 1 ) ,
+ prior ( normal ( 0 , 0.25 ) , class = ar2 , lb = - 1 , ub = 1 ) )
brmsprior
#> prior class coef group resp dpar nlpar lb ub source
#> normal(0.2, 0.5) mu_raw <NA> <NA> user
#> normal(0, 0.25) ar1 -1 1 user
#> normal(0, 0.25) ar2 -1 1 user
-mod <- mvgam ( y ~ s ( series , bs = 're' ) +
- s ( season , bs = 'cc' ) - 1 ,
+mod <- mvgam ( y ~ s ( series , bs = 're' ) +
+ s ( season , bs = 'cc' ) - 1 ,
family = nb ( ) ,
data = dat $ data_train ,
trend_model = AR ( p = 2 ) ,
@@ -755,8 +764,8 @@ Examples
# Look at what is returned when an incorrect spelling is used
test_priors $ prior [ 5 ] <- 'ar2_bananas ~ normal(0, 0.25);'
-mod <- mvgam ( y ~ s ( series , bs = 're' ) +
- s ( season , bs = 'cc' ) - 1 ,
+mod <- mvgam ( y ~ s ( series , bs = 're' ) +
+ s ( season , bs = 'cc' ) - 1 ,
family = nb ( ) ,
data = dat $ data_train ,
trend_model = AR ( p = 2 ) ,
@@ -906,7 +915,7 @@ Examples# Add a fake covariate
simdat $ data_train $ cov <- rnorm ( NROW ( simdat $ data_train ) )
-priors <- get_mvgam_priors ( y ~ cov + s ( season ) ,
+priors <- get_mvgam_priors ( y ~ cov + s ( season ) ,
data = simdat $ data_train ,
family = poisson ( ) ,
trend_model = AR ( ) )
@@ -915,7 +924,7 @@ Examplespriors $ prior [ 1 ] <- '(Intercept) ~ normal(0, 1);'
priors $ prior [ 2 ] <- 'cov ~ normal(0, 0.1);'
-mod2 <- mvgam ( y ~ cov + s ( season ) ,
+mod2 <- mvgam ( y ~ cov + s ( season ) ,
data = simdat $ data_train ,
trend_model = AR ( ) ,
family = poisson ( ) ,
@@ -1017,14 +1026,14 @@ Examples
# Likewise using 'brms' utilities (note that you can use
# Intercept rather than `(Intercept)`) to change priors on the intercept
-brmsprior <- c ( prior ( normal ( 0.2 , 0.5 ) , class = cov ) ,
- prior ( normal ( 0 , 0.25 ) , class = Intercept ) )
+brmsprior <- c ( prior ( normal ( 0.2 , 0.5 ) , class = cov ) ,
+ prior ( normal ( 0 , 0.25 ) , class = Intercept ) )
brmsprior
#> prior class coef group resp dpar nlpar lb ub source
#> normal(0.2, 0.5) cov <NA> <NA> user
#> normal(0, 0.25) Intercept <NA> <NA> user
-mod2 <- mvgam ( y ~ cov + s ( season ) ,
+mod2 <- mvgam ( y ~ cov + s ( season ) ,
data = simdat $ data_train ,
trend_model = AR ( ) ,
family = poisson ( ) ,
@@ -1130,8 +1139,8 @@ Examplesdat <- mgcv :: gamSim ( 1 , n = 200 , scale = 2 )
#> Gu & Wahba 4 term additive model
dat $ time <- 1 : NROW ( dat )
-mod <- mvgam ( y ~ x0 + x1 + s ( x2 ) + s ( x3 ) ,
- priors = prior ( normal ( 0 , 0.75 ) , class = 'b' ) ,
+mod <- mvgam ( y ~ x0 + x1 + s ( x2 ) + s ( x3 ) ,
+ priors = prior ( normal ( 0 , 0.75 ) , class = 'b' ) ,
data = dat ,
family = gaussian ( ) ,
run_model = FALSE )
diff --git a/docs/reference/index.html b/docs/reference/index.html
index 7c137436..fc019913 100644
--- a/docs/reference/index.html
+++ b/docs/reference/index.html
@@ -10,7 +10,7 @@
mvgam
- 1.1.3
+ 1.1.4
@@ -369,7 +369,7 @@ All functionsRW() AR()
CAR()
VAR()
- Specify autoregressive dynamic processes
+ Specify autoregressive dynamic processes in mvgam
score()
@@ -401,6 +401,11 @@ All functionsupdate(<mvgam> )
Update an existing mvgam
object
+
+
+ ZMVN()
+
+ Specify correlated residual processes in mvgam
diff --git a/docs/reference/irf.mvgam-1.png b/docs/reference/irf.mvgam-1.png
index 7d16a9eb..69a2919e 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 7605eaa5..b1541508 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 ca9b27fc..435c70a8 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 4134213a..74816ce6 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 2d14f841..bf1d7bed 100644
--- a/docs/reference/irf.mvgam.html
+++ b/docs/reference/irf.mvgam.html
@@ -12,7 +12,7 @@
mvgam
- 1.1.3
+ 1.1.4
@@ -152,19 +152,6 @@ 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/RtmpGcPapO/model-e5b0575a6e79.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/lfo_cv.mvgam.html b/docs/reference/lfo_cv.mvgam.html
index 35bee4e8..4d5a6f59 100644
--- a/docs/reference/lfo_cv.mvgam.html
+++ b/docs/reference/lfo_cv.mvgam.html
@@ -10,7 +10,7 @@
mvgam
- 1.1.3
+ 1.1.4
diff --git a/docs/reference/mvgam-10.png b/docs/reference/mvgam-10.png
index 65d6b581..e68af813 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 f0f32fb4..db4bb088 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 90280257..00693d30 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 b0b48fbe..47c0fe45 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 4fbfac7e..f29faace 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 53c22aa9..8070bb81 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 3eec9485..5591a02c 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 6b876412..6cebe23d 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 06fd93ac..c449c981 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 2dc639d9..1775f96e 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 c4f5049a..84b34910 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 bb509d3a..e06982cf 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 19fad5cb..2c929724 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 b0639411..da5eb575 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 4674113e..e7c26a2b 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 b13c47d4..24325c3c 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 628c3d33..5e948d99 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 16f09571..56790a02 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 fe800df7..4dbc765b 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 3e996752..c12986f7 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 57ff823d..34559324 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 d2967556..158e2a72 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 12389767..c10f1032 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 d50d67c1..c5412180 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 4f70efb2..4c7ba020 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 cd67bc75..d4e4a268 100644
--- a/docs/reference/mvgam.html
+++ b/docs/reference/mvgam.html
@@ -22,7 +22,7 @@
mvgam
- 1.1.3
+ 1.1.4
@@ -165,7 +165,7 @@ ArgumentsArguments CAR() trends in CAR
- Should also include any other variables to be included in the linear predictor of formula
+Note however that there are special cases where these identifiers are not needed. For
+example, models with hierarchical temporal correlation processes (e.g. AR(gr = region, subgr = species)
)
+should NOT include a series
identifier, as this will be constructed internally (see
+mvgam_trends
and AR
for details). mvgam
can also fit models that do not
+include a time
variable if there are no temporal dynamic structures included (i.e. trend_model = 'None'
or
+trend_model = ZMVN()
). data
should also include any other variables to be included in
+the linear predictor of formula
data_train
@@ -183,8 +189,8 @@ ArgumentsArguments gam )
+ ZMVN
or ZMVN()
(Zero-Mean Multivariate Normal; only available in Stan
)
'RW'
or RW()
'AR1'
or AR(p = 1)
'AR2'
or AR(p = 2)
@@ -282,9 +289,11 @@ ArgumentsPW() (only available in Stan
)
'GP'
or GP()
(Gaussian Process with squared exponential kernel;
only available in Stan
)
-For all trend types apart from GP()
, CAR()
and PW()
, moving average and/or correlated
+
For all trend types apart from ZMVN()
, GP()
, CAR()
and PW()
, moving average and/or correlated
process error terms can also be estimated (for example, RW(cor = TRUE)
will set up a
-multivariate Random Walk if n_series > 1
). See mvgam_trends for more details
+multivariate Random Walk if n_series > 1
). It is also possible for many multivariate trends
+to estimate hierarchical correlations if the data are structured among levels of
+a relevant grouping factor. See mvgam_trends for more details and see ZMVN for an example.
drift
@@ -434,7 +443,7 @@ Argumentsfindjags
...
@@ -476,7 +485,7 @@ Details
are non-identifiable (as in piecewise trends, see examples below)
Families and link functions : Details of families supported by mvgam can be found in
mvgam_families
.
-Trend models : Details of latent trend dynamic models supported by mvgam can be found in
+Trend models : Details of latent error process models supported by mvgam can be found in
mvgam_trends
.
Priors : Default priors for intercepts and any scale parameters are generated
using the same practice as brms . Prior distributions for most important model parameters can be
@@ -548,7 +557,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)
@@ -731,59 +740,46 @@
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 1 Iteration: 200 / 1000 [ 20%] (Warmup)
#> 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 1 Iteration: 400 / 1000 [ 40%] (Warmup)
#> 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 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 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 1 Iteration: 700 / 1000 [ 70%] (Sampling)
#> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling)
#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling)
-#> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling)
+#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling)
#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling)
+#> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling)
#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling)
#> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling)
-#> Chain 1 finished in 0.9 seconds.
-#> Chain 2 finished in 0.9 seconds.
+#> Chain 1 finished in 1.9 seconds.
+#> Chain 2 finished in 1.8 seconds.
#>
#> Both chains finished successfully.
-#> Mean chain execution time: 0.9 seconds.
-#> Total execution time: 1.0 seconds.
+#> Mean chain execution time: 1.8 seconds.
+#> Total execution time: 1.9 seconds.
#>
# Extract the model summary
summary ( mod1 )
#> GAM formula:
#> y ~ s(season, bs = "cc", k = 6)
-#> <environment: 0x00000251dde37b70>
+#> <environment: 0x000001f1510c0cc8>
#>
#> Family:
#> poisson
@@ -807,27 +803,27 @@ Examples#>
#>
#> GAM coefficient (beta) estimates:
-#> 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
+#> 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
#>
#> Approximate significance of GAM smooths:
#> edf Ref.df Chi.sq p-value
-#> s(season) 3.69 4 26.7 1.1e-06 ***
+#> s(season) 3.88 4 26 <2e-16 ***
#> ---
#> 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.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
+#> 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
#>
#> Stan MCMC diagnostics:
#> n_eff / iter looks reasonable for all parameters
@@ -836,7 +832,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 Mon Sep 09 10:40:46 AM 2024.
+#> Samples were drawn using NUTS(diag_e) at Mon Oct 28 6:56:55 PM 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)
@@ -852,7 +848,7 @@ Examples
resids <- residuals ( mod1 )
str ( resids )
-#> num [1:180, 1:4] 0.0319 -0.06 0.1531 0.5229 -0.0881 ...
+#> num [1:180, 1:4] 0.0253 -0.0822 0.1508 0.5405 -0.0836 ...
#> - attr(*, "dimnames")=List of 2
#> ..$ : NULL
#> ..$ : chr [1:4] "Estimate" "Est.Error" "Q2.5" "Q97.5"
@@ -862,14 +858,17 @@ Examplesstr ( fc )
#> List of 16
#> $ call :Class 'formula' language y ~ s(season, bs = "cc", k = 6)
-#> .. ..- attr(*, ".Environment")=<environment: 0x00000251dde37b70>
+#> .. ..- attr(*, ".Environment")=<environment: 0x000001f1510c0cc8>
#> $ trend_call : NULL
#> $ family : chr "poisson"
#> $ family_pars : NULL
-#> $ trend_model :List of 4
+#> $ trend_model :List of 7
#> ..$ trend_model: chr "AR1"
#> ..$ ma : logi FALSE
#> ..$ cor : logi FALSE
+#> ..$ unit : chr "time"
+#> ..$ gr : chr "NA"
+#> ..$ subgr : chr "series"
#> ..$ label : language AR()
#> ..- attr(*, "class")= chr "mvgam_trend"
#> $ drift : logi FALSE
@@ -888,26 +887,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] 22 9 10 1 18 15 11 19 10 15 ...
+#> ..$ series_1: num [1:1000, 1:60] 16 13 8 13 6 17 12 9 11 8 ...
#> .. ..- 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] 12 13 5 5 12 7 16 12 6 9 ...
+#> ..$ series_2: num [1:1000, 1:60] 7 10 2 5 11 12 8 7 8 12 ...
#> .. ..- 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] 5 11 9 9 6 15 5 6 14 12 ...
+#> ..$ series_3: num [1:1000, 1:60] 8 14 7 15 7 13 8 6 10 5 ...
#> .. ..- 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] 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 ...
+#> ..$ series_1: int [1:1000, 1:20] 9 39 3 7 2 4 19 11 23 14 ...
+#> ..$ series_2: int [1:1000, 1:20] 11 8 8 9 19 11 33 7 41 10 ...
+#> ..$ series_3: int [1:1000, 1:20] 15 37 6 15 16 6 5 13 13 7 ...
#> - attr(*, "class")= chr "mvgam_forecast"
plot ( fc )
#> Out of sample DRPS:
-#> 55.27413
+#> 54.788292
# Plot the estimated seasonal smooth function
@@ -932,7 +931,7 @@ Examples#> 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()`).
@@ -947,19 +946,19 @@ 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.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
+#> 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
str ( beta_draws_df )
#> 'data.frame': 1000 obs. of 5 variables:
-#> $ (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 ...
+#> $ (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 ...
# Investigate model fit
mc.cores.def <- getOption ( 'mc.cores' )
@@ -970,18 +969,18 @@ Examples#> Computed from 1000 by 161 log-likelihood matrix
#>
#> Estimate SE
-#> elpd_loo -452.2 8.5
-#> p_loo 91.6 4.8
-#> looic 904.4 17.0
+#> elpd_loo -449.6 7.9
+#> p_loo 88.7 4.3
+#> looic 899.2 15.9
#> ------
#> Monte Carlo SE of elpd_loo is NA.
#>
#> Pareto k diagnostic values:
#> Count Pct. Min. n_eff
-#> (-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
+#> (-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
#> See help('pareto-k-diagnostic') for details.
options ( mc.cores = mc.cores.def )
@@ -1005,52 +1004,39 @@ 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 1 Iteration: 100 / 1000 [ 10%] (Warmup)
#> Chain 2 Iteration: 1 / 1000 [ 0%] (Warmup)
+#> Chain 1 Iteration: 100 / 1000 [ 10%] (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: 200 / 1000 [ 20%] (Warmup)
+#> Chain 2 Iteration: 400 / 1000 [ 40%] (Warmup)
#> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup)
-#> Chain 2 Iteration: 300 / 1000 [ 30%] (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: 400 / 1000 [ 40%] (Warmup)
-#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling)
-#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling)
#> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup)
+#> Chain 1 Iteration: 501 / 1000 [ 50%] (Sampling)
#> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling)
-#> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling)
+#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling)
#> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling)
-#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling)
-#> Chain 1 finished in 1.0 seconds.
+#> 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 finished in 3.4 seconds.
#> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling)
-#> Chain 2 finished in 2.0 seconds.
+#> Chain 2 finished in 3.6 seconds.
#>
#> Both chains finished successfully.
-#> Mean chain execution time: 1.5 seconds.
-#> Total execution time: 2.1 seconds.
+#> Mean chain execution time: 3.5 seconds.
+#> Total execution time: 3.7 seconds.
#>
# The mapping matrix is now supplied as data to the model in the 'Z' element
@@ -1205,59 +1191,46 @@ 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)
#> Chain 1 Iteration: 500 / 1000 [ 50%] (Warmup)
#> Chain 1 Iteration: 501 / 1000 [ 50%] (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: 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: 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 2 Iteration: 1000 / 1000 [100%] (Sampling)
-#> Chain 1 finished in 0.8 seconds.
-#> Chain 2 finished in 0.7 seconds.
+#> Chain 1 finished in 1.3 seconds.
+#> Chain 2 finished in 1.3 seconds.
#>
#> Both chains finished successfully.
-#> Mean chain execution time: 0.7 seconds.
-#> Total execution time: 0.9 seconds.
+#> Mean chain execution time: 1.3 seconds.
+#> Total execution time: 1.4 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: 0x00000251dde37b70>
+#> <environment: 0x000001f1510c0cc8>
#>
#> Family:
#> gaussian
@@ -1282,67 +1255,68 @@ Examples#>
#> Observation error parameter estimates:
#> 2.5% 50% 97.5% Rhat n_eff
-#> sigma_obs[1] 0.44 0.49 0.55 1 1179
+#> sigma_obs[1] 0.44 0.49 0.55 1 642
#>
#> GAM coefficient (beta) estimates:
-#> 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
+#> 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
#>
#> GAM gp term marginal deviation (alpha) and length scale (rho) estimates:
-#> 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
+#> 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
#>
#> Stan MCMC diagnostics:
#> n_eff / iter looks reasonable for all parameters
-#> Rhat looks reasonable for all parameters
-#> 63 of 1000 iterations ended with a divergence (6.3%)
+#> 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%)
#> *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 Mon Sep 09 10:42:03 AM 2024.
+#> Samples were drawn using NUTS(diag_e) at Mon Oct 28 6:58:47 PM 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)
@@ -1351,7 +1325,7 @@ Examplesfc <- forecast ( mod , newdata = data_test )
plot ( fc )
#> Out of sample CRPS:
-#> 6.33897291368901
+#> 6.22329038558597
# Propagating the smooth term shows how the coefficient is expected to evolve
@@ -1381,19 +1355,6 @@ 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...
#>
@@ -1403,30 +1364,30 @@ Examples#> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup)
#> Chain 1 Iteration: 200 / 1000 [ 20%] (Warmup)
#> Chain 2 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: 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 2 Iteration: 600 / 1000 [ 60%] (Sampling)
#> 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: 700 / 1000 [ 70%] (Sampling)
+#> Chain 2 Iteration: 600 / 1000 [ 60%] (Sampling)
#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling)
+#> Chain 2 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 3.9 seconds.
+#> Chain 2 finished in 13.9 seconds.
#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling)
-#> Chain 1 finished in 4.2 seconds.
+#> Chain 1 finished in 14.9 seconds.
#>
#> Both chains finished successfully.
-#> Mean chain execution time: 4.0 seconds.
-#> Total execution time: 4.3 seconds.
+#> Mean chain execution time: 14.4 seconds.
+#> Total execution time: 15.0 seconds.
#>
# Inspect the model file to see the modification to the linear predictor
@@ -1528,10 +1489,10 @@ Exampleslayout ( matrix ( 1 : 2 , ncol = 2 ) )
plot ( fc , series = 1 , ylim = c ( 0 , 75 ) )
#> Out of sample DRPS:
-#> 22.781273
+#> 22.754399
plot ( fc , series = 2 , ylim = c ( 0 , 75 ) )
#> Out of sample DRPS:
-#> 77.61833
+#> 77.633266
layout ( 1 )
@@ -1541,7 +1502,7 @@ Examplesfc <- forecast ( mod , newdata = dat $ data_test )
plot ( fc )
#> Out of sample DRPS:
-#> 38.523539
+#> 38.550576
# Relative Risks can be computed by fixing the offset to the same value
@@ -1603,57 +1564,44 @@ 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 2 Iteration: 100 / 1000 [ 10%] (Warmup)
#> Chain 1 Iteration: 100 / 1000 [ 10%] (Warmup)
-#> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup)
+#> 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 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 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 2 Iteration: 600 / 1000 [ 60%] (Sampling)
#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling)
+#> Chain 2 Iteration: 500 / 1000 [ 50%] (Warmup)
+#> Chain 2 Iteration: 501 / 1000 [ 50%] (Sampling)
#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling)
-#> Chain 2 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 2 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 1.0 seconds.
+#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling)
#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling)
-#> Chain 1 finished in 1.1 seconds.
+#> Chain 1 finished in 3.0 seconds.
+#> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling)
+#> Chain 2 finished in 3.1 seconds.
#>
#> Both chains finished successfully.
-#> Mean chain execution time: 1.1 seconds.
-#> Total execution time: 1.2 seconds.
+#> Mean chain execution time: 3.1 seconds.
+#> Total execution time: 3.2 seconds.
#>
summary ( mod )
#> GAM formula:
#> cbind(y, ntrials) ~ series + s(x, by = series)
-#> <environment: 0x00000251dde37b70>
+#> <environment: 0x000001f1510c0cc8>
#>
#> Family:
#> binomial
@@ -1678,31 +1626,31 @@ Examples#>
#> GAM coefficient (beta) estimates:
#> 2.5% 50% 97.5% Rhat n_eff
-#> (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
+#> (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
#>
#> Approximate significance of GAM smooths:
#> edf Ref.df Chi.sq p-value
-#> s(x):seriesseries1 2.12 9 27.4 < 2e-16 ***
-#> s(x):seriesseries2 1.77 9 38.8 0.00017 ***
+#> s(x):seriesseries1 1.93 9 53.8 <2e-16 ***
+#> s(x):seriesseries2 1.08 9 27.6 0.42
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
@@ -1713,7 +1661,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 Mon Sep 09 10:43:01 AM 2024.
+#> Samples were drawn using NUTS(diag_e) at Mon Oct 28 7:00:34 PM 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_fevd-class.html b/docs/reference/mvgam_fevd-class.html
index b956ec59..2d50400e 100644
--- a/docs/reference/mvgam_fevd-class.html
+++ b/docs/reference/mvgam_fevd-class.html
@@ -12,7 +12,7 @@
mvgam
- 1.1.3
+ 1.1.4
diff --git a/docs/reference/mvgam_marginaleffects.html b/docs/reference/mvgam_marginaleffects.html
index 64e132cb..7c58668d 100644
--- a/docs/reference/mvgam_marginaleffects.html
+++ b/docs/reference/mvgam_marginaleffects.html
@@ -14,7 +14,7 @@
mvgam
- 1.1.3
+ 1.1.4
@@ -70,22 +70,22 @@
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 , ... )
+get_data ( x , source = "environment" , verbose = TRUE , ... )
# S3 method for mvgam_prefit
-get_data ( x , source = "environment" , verbose = TRUE , ... )
+get_data ( x , source = "environment" , verbose = TRUE , ... )
# S3 method for mvgam
find_predictors (
@@ -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,9 +153,11 @@ 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:
newdata = datagrid(cyl = c(4, 6))
: cyl
variable equal to 4 and 6 and other regressors fixed at their means or modes.
-See the Examples section and the datagrid()
documentation.
+datagrid()
call to specify a custom grid of regressors. For example:
newdata = datagrid(cyl = c(4, 6))
: cyl
variable equal to 4 and 6 and other regressors fixed at their means or modes.
+See the Examples section and the datagrid()
documentation.
+subset()
call with a single argument to select a subset of the dataset used to fit the model, ex: newdata = subset(treatment == 1)
+dplyr::filter()
call with a single argument to select a subset of the dataset used to fit the model, ex: newdata = filter(treatment == 1)
string:
"mean": Marginal Effects at the Mean. Slopes when each predictor is held at its mean or mode.
"median": Marginal Effects at the Median. Slopes when each predictor is held at its median or mode.
"marginalmeans": Marginal Effects at Marginal Means. See Details section below.
@@ -232,8 +234,8 @@ Value Objects suitable for internal 'marginaleffects' functions to proceed.
-See marginaleffects::get_coef()
, marginaleffects::set_coef()
,
-marginaleffects::get_vcov()
, marginaleffects::get_predict()
,
+See marginaleffects::get_coef()
, marginaleffects::set_coef()
,
+marginaleffects::get_vcov()
, marginaleffects::get_predict()
,
insight::get_data()
and insight::find_predictors()
for details
diff --git a/docs/reference/mvgam_trends.html b/docs/reference/mvgam_trends.html
index 4a6f950f..5a64c174 100644
--- a/docs/reference/mvgam_trends.html
+++ b/docs/reference/mvgam_trends.html
@@ -10,7 +10,7 @@
mvgam
-
1.1.3
+
1.1.4
@@ -66,6 +66,8 @@
Details
mvgam
currently supports the following dynamic trend models:
None
(no latent trend component; i.e. the GAM component is all that contributes to the linear predictor,
and the observation process is the only source of error; similarly to what is estimated by gam
)
+ZMVN()
(zero-mean correlated errors, useful for modelling time series where no
+autoregressive terms are needed or for modelling data that are not sampled as time series)
RW()
AR(p = 1, 2, or 3)
CAR(p = 1)
(continuous time autoregressive trends; only available in Stan
)
@@ -77,40 +79,13 @@ Details
measured in discrete, regularly spaced intervals (i.e. c(1, 2, 3, ...)
). However you can
use irregularly spaced intervals if using trend_model = CAR(1)
, though note that any
temporal intervals that are exactly 0
will be adjusted to a very small number
-(1e-12
) to prevent sampling errors. For all trend types
-apart from GP()
, PW()
, and CAR()
, moving average and/or correlated
+(1e-12
) to prevent sampling errors. For all autoregressive trend types
+apart from CAR()
, moving average and/or correlated
process error terms can also be estimated (for example, RW(cor = TRUE)
will set up a
-multivariate Random Walk if data
contains >1
series). Character strings can also be supplied
-instead of the various trend functions. The full list of possible models that are
-currently supported is:Note that only RW
, AR1
, AR2
and AR3
are available if
+multivariate Random Walk if data
contains >1
series). Hierarchical process error correlations
+can also be handled if the data contain relevant observation units that are nested into
+relevant grouping and subgrouping levels (i.e. using AR(gr = region, subgr = species)
)
+Note that only RW
, AR1
, AR2
and AR3
are available if
using JAGS
. All trend models are supported if using Stan
.
Dynamic factor models can be used in which the latent factors evolve as either
RW
, AR1-3
, VAR
or GP
. For VAR
models
@@ -135,7 +110,7 @@
References
See also
+VAR
, PW
, GP
, ZMVN
On this page
diff --git a/docs/reference/piecewise_trends.html b/docs/reference/piecewise_trends.html
index 8dc13d8e..03a68f7f 100644
--- a/docs/reference/piecewise_trends.html
+++ b/docs/reference/piecewise_trends.html
@@ -16,7 +16,7 @@
mvgam
- 1.1.3
+ 1.1.4
@@ -59,7 +59,7 @@
@@ -220,27 +220,27 @@ Examples#> 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 1 Iteration: 700 / 1000 [ 70%] (Sampling)
+#> Chain 1 Iteration: 600 / 1000 [ 60%] (Sampling)
#> Chain 2 Iteration: 700 / 1000 [ 70%] (Sampling)
-#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling)
+#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling)
#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling)
-#> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling)
+#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling)
#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling)
-#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling)
-#> Chain 1 finished in 24.2 seconds.
+#> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling)
#> Chain 2 Iteration: 1000 / 1000 [100%] (Sampling)
-#> Chain 2 finished in 24.7 seconds.
+#> Chain 2 finished in 23.3 seconds.
+#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling)
+#> Chain 1 finished in 24.1 seconds.
#>
#> Both chains finished successfully.
-#> Mean chain execution time: 24.5 seconds.
-#> Total execution time: 24.9 seconds.
+#> Mean chain execution time: 23.7 seconds.
+#> Total execution time: 24.2 seconds.
#>
summary ( mod )
#> GAM formula:
#> y ~ 1
-#> <environment: 0x00000134152809e8>
+#> <environment: 0x000001f156b3c498>
#>
#> Family:
#> poisson
@@ -282,7 +282,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:05:42 AM 2024.
+#> Samples were drawn using NUTS(diag_e) at Mon Oct 28 7:02:04 PM 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)
@@ -293,7 +293,8 @@ Examples
# View the changepoints with ggplot2 utilities
library ( ggplot2 )
-mcmc_plot ( mod , variable = 'delta_trend' ,
+#> Warning: package ‘ggplot2’ was built under R version 4.2.3
+mcmc_plot ( mod , variable = 'delta_trend' ,
regex = TRUE ) +
scale_y_discrete ( labels = mod $ trend_model $ changepoints ) +
labs ( y = 'Potential changepoint' ,
diff --git a/docs/reference/plot.mvgam_fevd.html b/docs/reference/plot.mvgam_fevd.html
index 42e605e8..41afc2ed 100644
--- a/docs/reference/plot.mvgam_fevd.html
+++ b/docs/reference/plot.mvgam_fevd.html
@@ -22,7 +22,7 @@
mvgam
- 1.1.3
+ 1.1.4
diff --git a/docs/reference/plot_mvgam_uncertainty.html b/docs/reference/plot_mvgam_uncertainty.html
index ff70b494..f4a9f622 100644
--- a/docs/reference/plot_mvgam_uncertainty.html
+++ b/docs/reference/plot_mvgam_uncertainty.html
@@ -10,7 +10,7 @@
mvgam
- 1.1.3
+ 1.1.4
diff --git a/docs/reference/posterior_epred.mvgam.html b/docs/reference/posterior_epred.mvgam.html
index fa95f5c8..570fff1d 100644
--- a/docs/reference/posterior_epred.mvgam.html
+++ b/docs/reference/posterior_epred.mvgam.html
@@ -28,7 +28,7 @@
mvgam
- 1.1.3
+ 1.1.4
@@ -108,8 +108,8 @@ ArgumentsExamples 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 1 Iteration: 400 / 1000 [ 40%] (Warmup)
#> Chain 2 Iteration: 100 / 1000 [ 10%] (Warmup)
#> Chain 2 Iteration: 200 / 1000 [ 20%] (Warmup)
-#> Chain 3 Iteration: 1 / 1000 [ 0%] (Warmup)
+#> Chain 2 Iteration: 300 / 1000 [ 30%] (Warmup)
#> Chain 3 Iteration: 100 / 1000 [ 10%] (Warmup)
#> Chain 3 Iteration: 200 / 1000 [ 20%] (Warmup)
-#> Chain 4 Iteration: 1 / 1000 [ 0%] (Warmup)
+#> Chain 3 Iteration: 300 / 1000 [ 30%] (Warmup)
#> Chain 4 Iteration: 100 / 1000 [ 10%] (Warmup)
-#> Chain 1 Iteration: 400 / 1000 [ 40%] (Warmup)
+#> Chain 4 Iteration: 200 / 1000 [ 20%] (Warmup)
+#> Chain 4 Iteration: 300 / 1000 [ 30%] (Warmup)
+#> Chain 4 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 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: 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 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: 600 / 1000 [ 60%] (Sampling)
+#> Chain 1 Iteration: 700 / 1000 [ 70%] (Sampling)
+#> Chain 2 Iteration: 800 / 1000 [ 80%] (Sampling)
#> Chain 3 Iteration: 600 / 1000 [ 60%] (Sampling)
#> Chain 3 Iteration: 700 / 1000 [ 70%] (Sampling)
+#> Chain 1 Iteration: 800 / 1000 [ 80%] (Sampling)
+#> Chain 2 Iteration: 900 / 1000 [ 90%] (Sampling)
+#> Chain 2 Iteration: 1000 / 1000 [100%] (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 4 Iteration: 600 / 1000 [ 60%] (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 2 finished in 0.8 seconds.
#> Chain 1 Iteration: 900 / 1000 [ 90%] (Sampling)
-#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling)
#> Chain 3 Iteration: 900 / 1000 [ 90%] (Sampling)
+#> Chain 4 Iteration: 800 / 1000 [ 80%] (Sampling)
+#> Chain 1 Iteration: 1000 / 1000 [100%] (Sampling)
#> Chain 3 Iteration: 1000 / 1000 [100%] (Sampling)
+#> Chain 1 finished in 1.0 seconds.
+#> Chain 3 finished in 1.0 seconds.
#> Chain 4 Iteration: 900 / 1000 [ 90%] (Sampling)
#> Chain 4 Iteration: 1000 / 1000 [100%] (Sampling)
-#> Chain 1 finished in 0.4 seconds.
-#> Chain 3 finished in 0.4 seconds.
-#> Chain 4 finished in 0.4 seconds.
+#> Chain 4 finished in 1.2 seconds.
#>
#> All 4 chains finished successfully.
-#> Mean chain execution time: 0.4 seconds.
-#> Total execution time: 0.5 seconds.
+#> Mean chain execution time: 1.0 seconds.
+#> Total execution time: 1.4 seconds.
#>
# Compute posterior expectations
expectations <- posterior_epred ( mod )
str ( expectations )
-#> num [1:2000, 1:75] 0.54 0.371 0.542 0.376 0.676 ...
+#> num [1:2000, 1:75] 0.465 0.604 0.4 0.245 0.331 ...
# }
diff --git a/docs/reference/posterior_linpred.mvgam.html b/docs/reference/posterior_linpred.mvgam.html
index 118b9699..2305237e 100644
--- a/docs/reference/posterior_linpred.mvgam.html
+++ b/docs/reference/posterior_linpred.mvgam.html
@@ -14,7 +14,7 @@
mvgam
- 1.1.3
+ 1.1.4
@@ -70,7 +70,7 @@
diff --git a/docs/reference/posterior_predict.mvgam.html b/docs/reference/posterior_predict.mvgam.html
index f684e463..080f5f6f 100644
--- a/docs/reference/posterior_predict.mvgam.html
+++ b/docs/reference/posterior_predict.mvgam.html
@@ -22,7 +22,7 @@
mvgam
- 1.1.3
+ 1.1.4
@@ -82,7 +82,7 @@