An R package for spatial and spatiotemporal GLMMs with TMB
Pass several arguments to DHARMa::plotQQunif()
.
Add silent
option in simulate.sdmTMB()
. Setting it to FALSE
allows
monitoring simulations from larger models.
Fix bug in est_non_rf1
and est_non_rf2
columns when all the following
conditions were true:
Fix delta-gamma binomial link printing for type = 'poisson-link'
#340
Add suggestion to use an optimized BLAS library to README.
Add warning if it's detected that there were problems reloading (e.g., with
readRDS()
) a fitted model. Simultaneously revert the approach to
how reloaded models are reattached.
Move log_ratio_mix
parameter to 2nd phase with starting value of -1 instead
of 0 to improve convergence.
Fix bugs for nbinom1()
and nbinom2_mix()
simulation.
Allow profile
argument in the control list to take a character vector of
parameters. This move these parameters from the outer optimization problem to
the inner problem (but omits from the from the Laplace approximation). See
documentation in TMB. This can considerably speed up fitting models with many
fixed effects.
Add theoretical quantile residuals for the generalized gamma distribution.
Thanks to J.C. Dunic. #333
Add "poisson-link"
option to delta-mixture lognormal.
Fix bug in simulation from Poisson-link delta models.
Simplify the internal treatment of extra time slices (extra_time
). #329
This is much less bug prone and also fixes a recently introduced bug. #335
This can slightly affect model results compared to the previous approach if
extra time was used along with smoothers since the 'fake' extra data
previously used was included when mgcv determined knot locations for
smoothers.
Published by seananderson 7 months ago
Overhaul residuals vignette ('article')
https://pbs-assess.github.io/sdmTMB/articles/web_only/residual-checking.html
including brief intros to randomized quantile residuals, simulation-based
residuals, 'one-sample' residuals, and uniform vs. Gaussian residuals.
Add check if prediction coordinates appear outside of fitted coordinates. #285
Fix memory issue with Tweedie family on large datasets. #302
Add experimental option to return standard normal residuals from
dharma_residuals()
.
Make simulate.sdmTMB()
not include extra_time
elements.
Improved re-initialization of saved fitted model objects in new sessions.
Fix important bug in simulate.sdmTMB()
method for delta families where
the positive linear predictor was only getting simulated for observations
present in the fitted data.
Add new "mle-mvn"
type to residuals.sdmTMB()
and make it the default.
This is a fast option for evaluating goodness of fit that should be better
than the previous default. See the details section in ?residuals.sdmTMB
for details. The previous default is now called "mvn-eb"
but is not
recommended.
Bring dharma_residuals()
back over from sdmTMBextra to sdmTMB. Add a new
option in the type
argument ("mle-mvn"
) that should make the
simulation residuals consistent with the expected distribution.
See the same new documentation in ?residuals.sdmTMB
. The examples
in ?dharma_residuals
illustrate suggested use.
Fix bug in sanity()
where gradient checks were missing abs()
such that
large negative gradients weren't getting caught. #324
Return offset
vector in fitted object as an element. Ensure any extra time
rows of data in the data
element of the fitted object do not include the
extra time slices.
Add experimental residuals option "mle-mvn" where a single approximate
posterior sample of the random effects is drawn and these are combined
with the MLE fixed effects to produce residuals. This may become the
default option.
Add the generalized gamma distribution (thanks to J.T. Thorson with additional
work by J.C. Dunic.) See gengamma()
. This distribution is still in a testing
phase and is not recommended for applied use yet. #286
Detect possible issue with factor(time) in formula if same column name is used
for time
and extra_time
is specified. #320
Improve sanity()
check output when there are NA fixed effect standard
errors.
Set intern = FALSE
within index bias correction, which seems to be
considerably faster when testing with most models.
Published by seananderson 8 months ago
Fix a bug likely introduced in July 2023 that caused issues when
extra_time
was specified. This is an important bug and models fit with
extra_time
between that date (if using the GitHub version) and v0.4.2.9004
(2024-02-24) should be checked against a current version of sdmTMB
(v0.4.2.9005 or greater). On CRAN, this affected v0.4.0 (2023-10-20) to
v0.4.2. Details:
extra_time
works by padding the dataIssue error if time
column has NAs. #298 #299
Fix bug in get_cog(..., format = "wide")
where the time column was
hardcoded to "year"
by accident.
Poisson-link delta models now use a type
argument in delta_gamma()
and
delta_lognormal()
. delta_poisson_link_gamma()
and
delta_poisson_link_lognormal()
are deprecated. #290
Delta families can now pass links that are different from the default
"logit"
and "log"
. #290
Published by seananderson 9 months ago
Force rebuild of CRAN binaries to fix issue with breaking Matrix ABI change
causing NaN gradient
errors. #288 #287
Fix crash in if sdmTMB(..., do_index = TRUE)
and extra_time
supplied along
with predict_args = list(newdata = ...)
that lacked extra_time
elements.
Allow get_index()
to work with missing time elements.
Add the ability to pass a custom randomized quantile function qres_func
to residuals.sdmTMB()
.
Add check for factor random intercept columns in newdata
to avoid a crash.
#278 #280
Improve warnings/errors around use of do_index = TRUE
and get_index()
if newdata = NULL
. #276
Fix prediction with offset
when newdata
is NULL
but offset
is
specified. #274
Fix prediction failure when both offset
and nsim
are provided and
model includes extra_time
. #273
Published by seananderson 12 months ago
Fix memory issues detected by CRAN 'Additional issues' clang-UBSAN, valgrind.
Fix a bug predicting on new data with a specified offset and extra_time
.
#270
Add warning around non-factor handling of the spatial_varying
formula. #269
Add experimental set_delta_model()
for plotting delta models with
ggeffects::ggpredict()
(GitHub version only until next CRAN version).
Published by seananderson about 1 year ago
Move add_barrier_mesh() to sdmTMBextra to avoid final INLA dependency.
https://github.com/pbs-assess/sdmTMBextra
Switch to using the new fmesher package for all mesh/SPDE calculations. INLA
is no longer a dependency.
Switch to diagonal.penalty = FALSE
in mgcv::smoothCon().
This changes the scale of the linear component of the smoother, but
should result in the same model.
https://github.com/glmmTMB/glmmTMB/issues/928#issuecomment-1642862066
Implement cross validation for delta models #239
Remove ELPD from cross validation output. Use sum_loglik instead. #235
Turn on Newton optimization by default. #182
print() now checks sanity() and issues a warning if there may be issues. #176
Poisson-link delta models and censored likelihood distributions have been made
considerably more robust. #186
Standard errors are now available on SD parameters etc. in tidy() #240
Fix bug in print()/tidy() for delta-model positive model component sigma_E.
A recently introduce bug was causing sigma_E for the 2nd model to be reported
as the 1st model component sigma_E.
Add new anisotropy plotting function.
Add anisotropic range printing. #149 by @jdunic
Published by seananderson over 1 year ago
Create the sdmTMBextra package to remove rstan/tmbstan helpers, which
were causing memory sanitizer errors on CRAN.
https://github.com/pbs-assess/sdmTMBextra
The following functions are affected:
predict.sdmTMB()
now takes mcmc_samples
, which is output fromsdmTMBextra::extract_mcmc()
.simulate.sdmTMB()
now takes mcmc_samples
, which is output fromsdmTMBextra::extract_mcmc()
.residuals.sdmTMB()
now takes mcmc_samples
, which is outputsdmTMBextra::predict_mle_mcmc()
. This only affectsresiduals(..., type = "mle-mcmc")
.Move dharma_residuals()
to
sdmTMBextra to reduce heavy
dependencies.
See examples in the Bayesian and residuals vignettes or in the help files for
those functions within sdmTMBextra.
Various fixes to pass CRAN checks. #158
Fix memory issue highlighted by Additional issues CRAN checks. #158
'offset' argument can now be a character value indicating a column name. This
is the preferred way of using an offset with parallel cross validation. #165
Fix parallel cross validation when using an offset vector. #165
Add leave-future-out cross validation functionality. #156
Example data qcs_grid
is no longer replicated by year to save package
space. #158
Add message with tidy(fit, "ran_pars")
about why SEs are NA.
Add anisotropy to print()
#157
Fix predict(..., type = "response", se_fit = TRUE)
, which involves issuing
a warning and sticking to link space. #140