diff --git a/R/stability.R b/R/stability.R index 3efe0a42..03d81eff 100644 --- a/R/stability.R +++ b/R/stability.R @@ -43,13 +43,20 @@ #' \deqn{ #' [2~det(A) (A^{-1})^T] \quad #' } -#' \item `prop_cov`: Sensitivity of \eqn{\Sigma_{\infty}} to intra-series error correlations +#' \item `prop_cov_offdiag`: Sensitivity of \eqn{\Sigma_{\infty}} to intra-series error correlations #' (i.e. how important are off-diagonal covariances in \eqn{\Sigma} for shaping #' \eqn{\Sigma_{\infty}}?), calculated as the relative magnitude of the *off-diagonals* in #' the partial derivative matrix: #' \deqn{ #' [2~det(\Sigma_{\infty}) (\Sigma_{\infty}^{-1})^T] \quad #' } +#' \item `prop_cov_diag`: Sensitivity of \eqn{\Sigma_{\infty}} to inter-series error variances +#' (i.e. how important are diagonal variances in \eqn{\Sigma} for shaping +#' \eqn{\Sigma_{\infty}}?), calculated as the relative magnitude of the *diagonals* in +#' the partial derivative matrix: +#' \deqn{ +#' [2~det(\Sigma_{\infty}) (\Sigma_{\infty}^{-1})^T] \quad +#' } #' \item `reactivity`: A measure of the degree to which the system moves #' away from a stable equilibrium following a perturbation #' values `> 0` suggest the system is reactive, whereby a @@ -102,30 +109,61 @@ #' # Proportion of stationary forecast distribution #' # attributable to lagged interactions #' hist(metrics$prop_int, -#' xlim = c(0, 1), -#' xlab = 'Prop_int', -#' main = '', -#' col = '#B97C7C', -#' border = 'white') +#' xlim = c(0, 1), +#' xlab = 'Prop_int', +#' main = '', +#' col = '#B97C7C', +#' border = 'white') #' -#' # Proportion of stationary forecast distribution -#' # attributable to correlated process errors -#' hist(metrics$prop_env, -#' xlim = c(0, 1), -#' xlab = 'Prop_env', -#' main = '', -#' col = '#B97C7C', -#' border = 'white') +#' # Within this contribution of interactions, how important +#' # are inter-series interactions (offdiagonals of the A matrix) vs +#' # intra-series density dependence (diagonals of the A matrix)? +#' layout(matrix(1:2, nrow = 2)) +#' hist(metrics$prop_int_offdiag, +#' xlim = c(0, 1), +#' xlab = '', +#' main = 'Inter-series interactions', +#' col = '#B97C7C', +#' border = 'white') +#' +#' hist(metrics$prop_int_diag, +#' xlim = c(0, 1), +#' xlab = 'Contribution to interaction effect', +#' main = 'Intra-series interactions (density dependence)', +#' col = 'darkblue', +#' border = 'white') +#' layout(1) +#' +#' # How important are inter-series error covariances +#' # (offdiagonals of the Sigma matrix) vs +#' # intra-series variances (diagonals of the Sigma matrix) for explaining +#' # the variance of the stationary forecast distribution? +#' layout(matrix(1:2, nrow = 2)) +#' hist(metrics$prop_cov_offdiag, +#' xlim = c(0, 1), +#' xlab = '', +#' main = 'Inter-series covariances', +#' col = '#B97C7C', +#' border = 'white') +#' +#' hist(metrics$prop_cov_diag, +#' xlim = c(0, 1), +#' xlab = 'Contribution to forecast variance', +#' main = 'Intra-series variances', +#' col = 'darkblue', +#' border = 'white') +#' layout(1) #' #' # Reactivity, i.e. degree to which the system moves #' # away from a stable equilibrium following a perturbation +#' # (values > 1 suggest a more reactive, less stable system) #' hist(metrics$reactivity, -#' main = '', -#' xlab = 'Reactivity', -#' col = '#B97C7C', -#' border = 'white', -#' xlim = c(-1*max(abs(metrics$reactivity)), -#' max(abs(metrics$reactivity)))) +#' main = '', +#' xlab = 'Reactivity', +#' col = '#B97C7C', +#' border = 'white', +#' xlim = c(-1*max(abs(metrics$reactivity)), +#' max(abs(metrics$reactivity)))) #' abline(v = 0, lwd = 2.5) #' } #'@export diff --git a/docs/reference/Rplot001.png b/docs/reference/Rplot001.png index 08d1d778..fa3dfa5c 100644 Binary files a/docs/reference/Rplot001.png and b/docs/reference/Rplot001.png differ diff --git a/docs/reference/Rplot002.png b/docs/reference/Rplot002.png index 3adae0bc..7b260240 100644 Binary files a/docs/reference/Rplot002.png and b/docs/reference/Rplot002.png differ diff --git a/docs/reference/Rplot003.png b/docs/reference/Rplot003.png index 82ac21b8..371c4148 100644 Binary files a/docs/reference/Rplot003.png and b/docs/reference/Rplot003.png differ diff --git a/docs/reference/Rplot004.png b/docs/reference/Rplot004.png index 8372e9f3..c23e1031 100644 Binary files a/docs/reference/Rplot004.png and b/docs/reference/Rplot004.png differ diff --git a/docs/reference/Rplot005.png b/docs/reference/Rplot005.png index 44457094..5c13a9bf 100644 Binary files a/docs/reference/Rplot005.png and b/docs/reference/Rplot005.png differ diff --git a/docs/reference/stability.mvgam-1.png b/docs/reference/stability.mvgam-1.png index 81477826..0f799a65 100644 Binary files a/docs/reference/stability.mvgam-1.png and b/docs/reference/stability.mvgam-1.png differ diff --git a/docs/reference/stability.mvgam-2.png b/docs/reference/stability.mvgam-2.png index 4e7e376f..d0a05911 100644 Binary files a/docs/reference/stability.mvgam-2.png and b/docs/reference/stability.mvgam-2.png differ diff --git a/docs/reference/stability.mvgam-3.png b/docs/reference/stability.mvgam-3.png index 2b520039..3239adb4 100644 Binary files a/docs/reference/stability.mvgam-3.png and b/docs/reference/stability.mvgam-3.png differ diff --git a/docs/reference/stability.mvgam-4.png b/docs/reference/stability.mvgam-4.png index 79d06613..3668228b 100644 Binary files a/docs/reference/stability.mvgam-4.png and b/docs/reference/stability.mvgam-4.png differ diff --git a/docs/reference/stability.mvgam-5.png b/docs/reference/stability.mvgam-5.png index 1fd2f2e0..2dec4521 100644 Binary files a/docs/reference/stability.mvgam-5.png and b/docs/reference/stability.mvgam-5.png differ diff --git a/docs/reference/stability.mvgam.html b/docs/reference/stability.mvgam.html index 01a71546..76bac056 100644 --- a/docs/reference/stability.mvgam.html +++ b/docs/reference/stability.mvgam.html @@ -127,10 +127,17 @@

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

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

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

  • @@ -197,7 +204,7 @@

    Examples#> from stan/lib/stan_math/stan/math/rev.hpp:16, #> from stan/lib/stan_math/stan/math.hpp:19, #> from stan/src/stan/model/model_header.hpp:4, -#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpuihtV8/model-49f85c41daa.hpp:2: +#> from C:/Users/uqnclar2/AppData/Local/Temp/RtmpULw7Rt/model-86746fb62ab3.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) @@ -210,34 +217,66 @@

    Examples# Proportion of stationary forecast distribution # attributable to lagged interactions hist(metrics$prop_int, - xlim = c(0, 1), - xlab = 'Prop_int', - main = '', - col = '#B97C7C', - border = 'white') + xlim = c(0, 1), + xlab = 'Prop_int', + main = '', + col = '#B97C7C', + border = 'white') -# Proportion of stationary forecast distribution -# attributable to correlated process errors -hist(metrics$prop_env, - xlim = c(0, 1), - xlab = 'Prop_env', - main = '', - col = '#B97C7C', - border = 'white') -#> Error in hist.default(metrics$prop_env, xlim = c(0, 1), xlab = "Prop_env", main = "", col = "#B97C7C", border = "white"): 'x' must be numeric +# Within this contribution of interactions, how important +# are inter-series interactions (offdiagonals of the A matrix) vs +# intra-series density dependence (diagonals of the A matrix)? +layout(matrix(1:2, nrow = 2)) +hist(metrics$prop_int_offdiag, + xlim = c(0, 1), + xlab = '', + main = 'Inter-series interactions', + col = '#B97C7C', + border = 'white') + +hist(metrics$prop_int_diag, + xlim = c(0, 1), + xlab = 'Contribution to interaction effect', + main = 'Intra-series interactions (density dependence)', + col = 'darkblue', + border = 'white') + +layout(1) + +# How important are inter-series error covariances +# (offdiagonals of the Sigma matrix) vs +# intra-series variances (diagonals of the Sigma matrix) for explaining +# the variance of the stationary forecast distribution? +layout(matrix(1:2, nrow = 2)) +hist(metrics$prop_cov_offdiag, + xlim = c(0, 1), + xlab = '', + main = 'Inter-series covariances', + col = '#B97C7C', + border = 'white') + +hist(metrics$prop_cov_diag, + xlim = c(0, 1), + xlab = 'Contribution to forecast variance', + main = 'Intra-series variances', + col = 'darkblue', + border = 'white') + +layout(1) # Reactivity, i.e. degree to which the system moves # away from a stable equilibrium following a perturbation +# (values > 1 suggest a more reactive, less stable system) hist(metrics$reactivity, - main = '', - xlab = 'Reactivity', - col = '#B97C7C', - border = 'white', - xlim = c(-1*max(abs(metrics$reactivity)), - max(abs(metrics$reactivity)))) + main = '', + xlab = 'Reactivity', + col = '#B97C7C', + border = 'white', + xlim = c(-1*max(abs(metrics$reactivity)), + max(abs(metrics$reactivity)))) abline(v = 0, lwd = 2.5) - + # } diff --git a/man/stability.mvgam.Rd b/man/stability.mvgam.Rd index 72c1e608..2f7061fe 100644 --- a/man/stability.mvgam.Rd +++ b/man/stability.mvgam.Rd @@ -59,10 +59,17 @@ matrix: \deqn{ [2~det(A) (A^{-1})^T] \quad } -\item \code{prop_cov}: Sensitivity of \eqn{\Sigma_{\infty}} to intra-series error correlations +\item \code{prop_cov_offdiag}: Sensitivity of \eqn{\Sigma_{\infty}} to intra-series error correlations (i.e. how important are off-diagonal covariances in \eqn{\Sigma} for shaping \eqn{\Sigma_{\infty}}?), calculated as the relative magnitude of the \emph{off-diagonals} in the partial derivative matrix: +\deqn{ + [2~det(\Sigma_{\infty}) (\Sigma_{\infty}^{-1})^T] \quad + } +\item \code{prop_cov_diag}: Sensitivity of \eqn{\Sigma_{\infty}} to inter-series error variances +(i.e. how important are diagonal variances in \eqn{\Sigma} for shaping +\eqn{\Sigma_{\infty}}?), calculated as the relative magnitude of the \emph{diagonals} in +the partial derivative matrix: \deqn{ [2~det(\Sigma_{\infty}) (\Sigma_{\infty}^{-1})^T] \quad } @@ -113,30 +120,61 @@ metrics <- stability(mod) # Proportion of stationary forecast distribution # attributable to lagged interactions hist(metrics$prop_int, - xlim = c(0, 1), - xlab = 'Prop_int', - main = '', - col = '#B97C7C', - border = 'white') + xlim = c(0, 1), + xlab = 'Prop_int', + main = '', + col = '#B97C7C', + border = 'white') -# Proportion of stationary forecast distribution -# attributable to correlated process errors -hist(metrics$prop_env, - xlim = c(0, 1), - xlab = 'Prop_env', - main = '', - col = '#B97C7C', - border = 'white') +# Within this contribution of interactions, how important +# are inter-series interactions (offdiagonals of the A matrix) vs +# intra-series density dependence (diagonals of the A matrix)? +layout(matrix(1:2, nrow = 2)) +hist(metrics$prop_int_offdiag, + xlim = c(0, 1), + xlab = '', + main = 'Inter-series interactions', + col = '#B97C7C', + border = 'white') + +hist(metrics$prop_int_diag, + xlim = c(0, 1), + xlab = 'Contribution to interaction effect', + main = 'Intra-series interactions (density dependence)', + col = 'darkblue', + border = 'white') +layout(1) + +# How important are inter-series error covariances +# (offdiagonals of the Sigma matrix) vs +# intra-series variances (diagonals of the Sigma matrix) for explaining +# the variance of the stationary forecast distribution? +layout(matrix(1:2, nrow = 2)) +hist(metrics$prop_cov_offdiag, + xlim = c(0, 1), + xlab = '', + main = 'Inter-series covariances', + col = '#B97C7C', + border = 'white') + +hist(metrics$prop_cov_diag, + xlim = c(0, 1), + xlab = 'Contribution to forecast variance', + main = 'Intra-series variances', + col = 'darkblue', + border = 'white') +layout(1) # Reactivity, i.e. degree to which the system moves # away from a stable equilibrium following a perturbation +# (values > 1 suggest a more reactive, less stable system) hist(metrics$reactivity, - main = '', - xlab = 'Reactivity', - col = '#B97C7C', - border = 'white', - xlim = c(-1*max(abs(metrics$reactivity)), - max(abs(metrics$reactivity)))) + main = '', + xlab = 'Reactivity', + col = '#B97C7C', + border = 'white', + xlim = c(-1*max(abs(metrics$reactivity)), + max(abs(metrics$reactivity)))) abline(v = 0, lwd = 2.5) } } diff --git a/src/mvgam.dll b/src/mvgam.dll index ac9a44fd..744de664 100644 Binary files a/src/mvgam.dll and b/src/mvgam.dll differ