However, what happens if we were to sample the random effects with
each simulation?
-
+
set.seed(1)
s <- replicate(200, simulate(fit, nsim = 1, type = "mle-mvn"), simplify = "matrix")
attr(s, "type") <- "mle-mvn"
@@ -602,7 +591,7 @@
+
set.seed(123)
sim_dat2 <- sdmTMB_simulate(
formula = ~ 1,
@@ -617,13 +606,7 @@ = 1,
B = 0.2
)
-#> The `seed` argument may be deprecated in the future.
-#> We recommend instead setting the seed manually with `set.seed()` prior to
-#> calling `sdmTMB_simulate()`.
-#> We have encountered some situations where setting the seed via this argument
-#> does not have the intended effect.
-
-fit2 <- sdmTMB(observed ~ 1, data = sim_dat2, time = "year", mesh = mesh)
+fit2 <- sdmTMB(observed ~ 1, data = sim_dat2, time = "year", mesh = mesh)
sanity(fit2)
#> ✔ Non-linear minimizer suggests successful convergence
#> ✔ Hessian matrix is positive definite
@@ -634,12 +617,12 @@ #> ✔ No sigma parameters are < 0.01
#> ✔ No sigma parameters are > 100
#> ✔ Range parameter doesn't look unreasonably large
-
+
-
+
ks.test(r1, pnorm)
#>
#> Asymptotic one-sample Kolmogorov-Smirnov test
@@ -647,11 +630,11 @@ #> data: r1
#> D = 0.021085, p-value = 0.7656
#> alternative hypothesis: two-sided
-
+
-
+
ks.test(r2, pnorm)
#>
#> Asymptotic one-sample Kolmogorov-Smirnov test
@@ -674,17 +657,17 @@