Index standardization with sdmTMB
-2023-10-23
+2023-10-24
Source:vignettes/web_only/index-standardization.Rmd
index-standardization.Rmd
A conventional delta-gamma model:#> ✔ No gradients with respect to fixed effects are >= 0.001 #> ✔ No fixed-effect standard errors are NA #> ✔ No standard errors look unreasonably large -#> ✔ No sigma parameters are < 0.01 -#> ✔ No sigma parameters are > 100 +#> ✖ `sigma_O` is smaller than 0.01 +#> ℹ Consider omitting this part of the model #> ✔ Range parameters don't look unreasonably large
How can we show the effect of depth on catch weight? There is no one curve, because the two components use different links (logit + log), so @@ -264,8 +264,8 @@
A Poisson-link-delta-gamma alter
#> ✔ No gradients with respect to fixed effects are >= 0.001
#> ✔ No fixed-effect standard errors are NA
#> ✔ No standard errors look unreasonably large
-#> ✔ No sigma parameters are < 0.01
-#> ✔ No sigma parameters are > 100
+#> ✖ `sigma_O` is smaller than 0.01
+#> ℹ Consider omitting this part of the model
#> ✔ Range parameters don't look unreasonably large
summary(fit_dpg)
#> Spatial model fit by REML ['sdmTMB']
@@ -317,12 +317,14 @@ A Poisson-link-delta-gamma alter
#>
#> Dispersion parameter: 0.59
#> Matérn anisotropic range (spatial): 4.2 to 60.8 at 142 deg.
-#> Spatial SD: 1.97
+#> Spatial SD: 0.00
#>
#> REML criterion at convergence: 5851.613
#>
#> See ?tidy.sdmTMB to extract these values as a data frame.
-#> See ?plot_anisotropy to plot the anisotropic range.
+#> See ?plot_anisotropy to plot the anisotropic range.
+#>
+#> **Possible issues detected! Check output of sanity().**
and make the same plot:
p_dpg <- predict(fit_dpg, newdata = nd, re_form = NA)
diff --git a/articles/web_only/residual-checking.html b/articles/web_only/residual-checking.html
index e89bc970c..32cc201e3 100644
--- a/articles/web_only/residual-checking.html
+++ b/articles/web_only/residual-checking.html
@@ -224,8 +224,8 @@
#>
#> SAMPLING FOR MODEL 'tmb_generic' NOW (CHAIN 1).
#> Chain 1:
-#> Chain 1: Gradient evaluation took 0.00118 seconds
-#> Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 11.8 seconds.
+#> Chain 1: Gradient evaluation took 0.001134 seconds
+#> Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 11.34 seconds.
#> Chain 1: Adjust your expectations accordingly!
#> Chain 1:
#> Chain 1:
@@ -242,9 +242,9 @@
#> Chain 1: Iteration: 200 / 201 [ 99%] (Warmup)
#> Chain 1: Iteration: 201 / 201 [100%] (Sampling)
#> Chain 1:
-#> Chain 1: Elapsed Time: 3.157 seconds (Warm-up)
-#> Chain 1: 0.013 seconds (Sampling)
-#> Chain 1: 3.17 seconds (Total)
+#> Chain 1: Elapsed Time: 3.326 seconds (Warm-up)
+#> Chain 1: 0.015 seconds (Sampling)
+#> Chain 1: 3.341 seconds (Total)
#> Chain 1:
mcmc_res <- residuals(fit_nb2, type = "mle-mcmc", mcmc_samples = samps)
qqnorm(mcmc_res);qqline(mcmc_res)
Fitting spatial trend models with sdmTMB
-2023-10-23
+2023-10-24
Source:vignettes/web_only/spatial-trend-models.Rmd
spatial-trend-models.Rmd
2023-10-23
#> # A tibble: 5 × 5 #> term estimate std.error conf.low conf.high #> <chr> <dbl> <dbl> <dbl> <dbl> -#> 1 range 20.5 2.49 16.2 26.0 -#> 2 phi 11.8 0.394 11.0 12.6 -#> 3 sigma_O 2.40 0.175 2.08 2.76 -#> 4 sigma_Z 1.23 0.180 0.925 1.64 -#> 5 tweedie_p 1.52 0.0111 1.50 1.54Let’s look at the predictions and estimates of the spatially varying coefficients on a grid. First, we will create a small function to help with plotting:
@@ -227,7 +227,7 @@2023-10-23
coefs <- tidy(fit, conf.int = TRUE)
scaled_year_coef <- coefs$estimate[coefs$term == "scaled_year"]
scaled_year_coef
-#> [1] -0.06320894
+#> [1] -0.06320893
exp(scaled_year_coef)
#> [1] 0.9387473
Our main effect tells us that the overall linear trend of density has
diff --git a/articles/web_only/spatial-trend-models_files/figure-html/unnamed-chunk-13-1.png b/articles/web_only/spatial-trend-models_files/figure-html/unnamed-chunk-13-1.png
index 4e3b5acb9..7206a6d48 100644
Binary files a/articles/web_only/spatial-trend-models_files/figure-html/unnamed-chunk-13-1.png and b/articles/web_only/spatial-trend-models_files/figure-html/unnamed-chunk-13-1.png differ
diff --git a/articles/web_only/threshold-models.html b/articles/web_only/threshold-models.html
index 2c77ed13e..f6e34a5c9 100644
--- a/articles/web_only/threshold-models.html
+++ b/articles/web_only/threshold-models.html
@@ -85,7 +85,7 @@
Threshold modeling with sdmTMB
- 2023-10-23
+ 2023-10-24
Source: vignettes/web_only/threshold-models.Rmd
threshold-models.Rmd
Julia Indivero,
Sean Anderson, Lewis Barnett, Philina English, Eric Ward
- 2023-10-23
+ 2023-10-24
Source: vignettes/web_only/visreg.Rmd
visreg.Rmd
Examples data = pcod_2011, mesh = pcod_mesh_2011, family = tweedie())
head(spread_sims(m, nsim = 10))
#> .iteration X.Intercept. depth_scaled range phi tweedie_p sigma_O
-#> 1 1 2.378534 -0.7933863 88.54519 14.58967 1.589928 1.608106
-#> 2 2 2.489069 -0.6224076 15.45192 14.78132 1.568329 2.974359
-#> 3 3 3.005066 -0.4876294 37.05711 15.21137 1.584400 1.697899
-#> 4 4 3.540592 -0.7320227 15.26638 15.81939 1.603113 3.173216
-#> 5 5 3.500796 -0.5528166 34.18817 15.19810 1.595213 1.951126
-#> 6 6 2.350821 -0.8157729 39.22583 14.65105 1.591801 2.166761
+#> 1 1 2.894762 -0.8545553 19.86566 14.59055 1.600137 2.528615
+#> 2 2 2.908403 -0.6366737 32.36848 14.67494 1.577689 1.924753
+#> 3 3 2.866009 -0.9098213 35.52301 15.60351 1.583430 1.444568
+#> 4 4 3.513403 -0.5226909 33.78098 15.98712 1.573360 1.862328
+#> 5 5 2.873889 -0.8040590 20.37395 14.73140 1.596087 2.669583
+#> 6 6 2.950808 -0.7785113 16.08796 15.07983 1.598505 2.677013
head(gather_sims(m, nsim = 10))
#> .iteration .variable .value
-#> 1 1 X.Intercept. 3.133451
-#> 2 2 X.Intercept. 2.588547
-#> 3 3 X.Intercept. 1.897626
-#> 4 4 X.Intercept. 3.339313
-#> 5 5 X.Intercept. 2.934447
-#> 6 6 X.Intercept. 2.996000
+#> 1 1 X.Intercept. 2.845475
+#> 2 2 X.Intercept. 2.762401
+#> 3 3 X.Intercept. 2.581949
+#> 4 4 X.Intercept. 2.458614
+#> 5 5 X.Intercept. 2.552741
+#> 6 6 X.Intercept. 3.287949
samps <- gather_sims(m, nsim = 1000)
if (require("ggplot2", quietly = TRUE)) {
diff --git a/reference/get_index_sims-1.png b/reference/get_index_sims-1.png
index 545b0e624..10c8de860 100644
Binary files a/reference/get_index_sims-1.png and b/reference/get_index_sims-1.png differ
diff --git a/reference/run_extra_optimization.html b/reference/run_extra_optimization.html
index 5e8f72529..411cfe917 100644
--- a/reference/run_extra_optimization.html
+++ b/reference/run_extra_optimization.html
@@ -104,9 +104,9 @@
Examples data = pcod_2011, mesh = pcod_mesh_2011, family = tweedie())
fit_1 <- run_extra_optimization(fit, newton_loops = 1)
max(fit$gradients)
-#> [1] 5.774443e-09
+#> [1] 5.789538e-09
max(fit_1$gradients)
-#> [1] 5.774443e-09
+#> [1] 5.789538e-09