Releases: inlabru-org/inlabru
inlabru 2.12.0
General changes
- Introduce
bru_obs()
as a replacement tolike()
, to help avoid namespace
clashes with e.g.data.table::like()
(version2.11.1.9026
) - Change logic for
like
/bru_obs(allow_combine)
to allow user override, and
add warnings for ambiguous cases (version2.11.1.9011
) - Add
bru_response_size()
method for extracting the response size for each
observationbru_like
object (version2.11.1.9013
) - Add
sf
output format support forsline
andspoly
(version2.11.1.9006
) - Add
[
and]
to special character set inbru_standardise_names()
(version2.11.1.9012
) - Add
bru_index()
method for accessing predictor index information for
sub-models, and atag
argument forbru_obs()
to identify individual
sub-models by name, which is also propagated to lists ofbru_like
objects
(version2.11.1.9017
and2.12.0
) - Allow
bru_mapper_multi()
sub-mappers to have non-zero offsets, that are
added to generate the combined offset (version2.11.1.9019
) - Add general
bru_mapper_fmesher()
mapper, for indexed mapping of
all objects supportingfm_dof()
andfm_basis()
(version2.11.1.9021
) - Add
bru_mapper_repeat()
mapper, for automated single-mapper sums
(version2.11.1.9022
)
Data set updates
- Convert
mrsea
tosf
format (version2.11.1.9009
) - Convert the
shrimp
data set tosf
format (version2.11.1.9007
) - Remove
seals_sp
data set due to excessive size (version2.11.1.9010
) - Replace the
mexdolphin
dataset with a functionmexdolphin_sp()
to avoidsp
data objects in the package (version2.11.1.9015
) - Replace the
gorillas
dataset with a functiongorillas_sp()
to avoidsp
data objects in the package (version2.11.1.9016
)
Namespace changes
- Move
sp
fromImports
toSuggests
. Component definitions using
coordinates
as input require eithersp::coordinates
orsp
having been
already loaded with e.g.library(sp)
(version2.11.1.9003
) - Remove
ggmap
support (version2.11.1.9002
) - Remove unnecessary
INLA
namespace loading inggplot
methods
(version2.11.1.9008
) - Move
terra
fromImports
toSuggests
(version2.11.1.9014
) - Stop re-exporting
fmesher
methods (version2.11.1.9020
)
Deprecated methods
- Deprecated (since 2.8.0) method
is.inside()
have been removed.
Usefmesher::fm_is_within()
instead. - Deprecated (since 2.7.0)
bru_mapper.default()
to define new mapper classes
has been removed. Usebru_mapper_define()
instead. - Deprecated (since 2.6.0)
bru_mapper_offset()
method has been removed.
Usebru_mapper_const()
instead.
Internal changes
- Remove unneeded
"list"
class inheritance from solitary classes
(version2.11.1.9001
) - Expand the
summary
andprint
method class coverage (version2.11.1.9002
) - Reduced the amount of diagnostic messages in
bru_safe_inla()
(version2.11.1.9005
) - Change name of
component
andcomponent_list
methods tobru_component
andbru_component_list
(version2.11.1.9026
)
inlabru 2.11.1
Bug fixes
- Fix documentation link issues not spotted by local and github package checks
- Work around invalid geometry in map data used by the Spatially Varying
Coefficients vignette
inlabru 2.11.0
New features
- Add support for the
scale
parameter tolike()
. - Add support for special response objects like
inla.mdata()
andinla.surv()
,
when INLA version> 24.06.02
(formdata
) or> 24.06.26
(forsurv
) are
available (version2.10.1.9011
) - New
toypoints
example data set, for basic modelling examples
(version2.10.1.9003
)
Feature updates
- Updated convergence plots, reducing random effect aspects to summary statistics,
improving speed and visual coherence (version2.10.1.9004
) - Add options to
bru_convergence_plot()
to control the number of iterations
shown, and optionally show the initial values that are stored from this version
(version2.10.1.9005
) - Switch timing mechanism from
Sys.time()
toproc.time()
to capture CPU time
instead of elapsed clock time. Addedbru_timings()
method to extract the timings
safely from a fittedbru
object (version2.10.1.9007
and2.10.1.9010
) - Add verbosity level information to the bru log data structure,
allowing filtered log extraction and more flexible log display
(version2.10.1.9012
)
Bug fixes
- Fix regression bug in
"bym"
model support, where the latent state size
wasn't correctly handled by the mapper system (version2.10.1.9002
) - Add filter to limit mapper construction to only the components used in the
predictor expression, to avoid unused components breaking the initialisation.
This allows easier testing of multi-likelihood models (version2.10.1.9006
) - Improved backwards compatibility support for
sp
data input forfamily = "cp"
(version2.10.1.9008
)
Deprecated methods
- Deprecated (since 2.9.0) method
ipoints(samplers, domain)
is no longer available.
Usefmesher::fm_int(domain, samplers)
instead. - The
allow_latent
,include_latent
arguments tolike()
have been deprecated in favour
of the generalbru_used()
framework, that auto-detects what component effects and
latent effects are used by a predictor expression. - The deprecated (since 2.8.0)
cprod()
method now gives a warning and will be removed in a future version.
Usefmesher::fm_cprod()
instead. - The
integration_weight_aggregation
method has been removed (deprecated since 2.8.0).
Usefmesher::fm_vertex_projection()
instead. - The
mesh_triangle_integration
method has been removed (deprecated since 2.8.0).
Usefmesher::fm_int()
instead. - Old use of
bru_mapper.default()
to define new mapper classes has been disabled
(deprecated since 2.7.0). Usebru_mapper_define()
instead. - Deprecated (since 2.8.0) methods
is.inside()
,vertices.inla.mesh()
, and
pixels()
have been disabled. Usefmesher::fm_is_within()
,fmesher::fm_vertices()
,
andfmesher::fm_pixels()
instead.
inlabru 2.10.1
Feature updates
- Add new web article on ZIP/ZAP models (zero inflated Poisson models)
where the non-zero probability is modelled with a separate predictor from the
predictor for the Poisson model parameter:
https://inlabru-org.github.io/inlabru/articles/zip_zap_models.html.
(Thanks to Dmytro Perepolkin)
Bug fixes and dependency simplification
- Remove dependence on the
ggpolypath
package, and the
ggplot2::fortify.SpatialPolygons/DataFrame()
methods that were deprecated in
ggplot2
version3.4.4
. Code usinggg.SpatialPolygons()
together with
coord_fixed()
/coord_equal()
for coordinate axis control needs to use
coord_sf()
instead. - Detect the need for vectorised parameters in
bru_forward_transformation
to
allowbru_mapper_marginal
to be applied with e.g. spatially varying parameters.
(version2.10.0.9001
) - Detect
terra
version>= 1.7-66
that removes the need for
detecting special cases (nrow(where) == 1
andterra::nlyr(data) == 1
).
Workaround code used for versions< 1.7-66
. (version2.10.0.9002
)
(Thanks to Robert J. Hijmans)
inlabru 2.10.0
Feature updates
- Add new
ibm_simplify()
generic to handle mapper simplification more generally;
needed to properly support non-linear component mappers. (version2.9.0.9004
) - Add new
bru_mapper_marginal()
mapper class that can be used as part of component
mapper pipelines. (version2.9.0.9004
) - Add new
ibm_eval2()
generic that computes both evaluation and Jacobian,
avoiding double-computing of the Jacobian, when practical. (version2.9.0.9005
) - Add new
bru_timings_plot()
function that plots the time used for each nonlinear iteration
(version2.9.0.9007
) - Speed up
bru_fill_missing()
(by orders of magnitude) by changing method for
finding the nearest available data point. (version2.9.0.9011
) - Add new
bru_mapper_shift()
mapper class that works likebru_mapper_scale()
but for additive shifts instead of multiplicative scaling. (version2.9.0.9012
) - Added more checks for invalid component or predictor evaluations, to help
catch user errors sooner, and with more informative messages. (version2.9.0.9013
) - Expand
bru_mapper_matrix
, previously used only for componentmodel = "fixed"
,
to allow integer indexing in addition to the previous factor/character-only indexing.
(version2.9.0.9014
)
Bug fixes
- The
is_linear
flag wasn't correctly set forbru_mapper_logsumexp
mappers.
Since previous versions did not accept non-linear component mappers, this
is unlikely to have affected any user code. (Fixed in version2.9.0.9001
) - Improved error messages for missing or incomplete LGCP domain specification.
(version2.9.0.9002
and2.9.0.9006
) - Allow
NULL
in automatic component usage detection. (version2.9.0.9003
) - Corrected the crs information for
gorillas$plotsample$counts
and
gorillas_sf$plotsample$counts
from+units=m
to+units=km
. (version2.9.0.9010
)
The geometry information incounts
is unlikely to have been used in examples
or analysis code, as the problem would have been immediately obvious;
plotting or other geometric operations that use the crs information would
heve been completely wrong, and is only detected now that more code uses the
crs information at all. Thanks to Dmytro Perepolkin for reporting in issue #205 - Fix problem in
bru_fill_missing()
for cases where the input data object also
has missing values. (version2.9.0.9011
) - Make
eval_spatial()
transform thewhere
coordinates to the same crs as the
input data, forSpatRaster
andsf
inputs, to allow different crs specifications.
(version2.9.0.9012
)
inlabru 2.9.0
Feature updates
-
Conversion of code to use
fmesher
for mesh and geometry handling;
the interface supports existing objects and methods.
See https://inlabru-org.github.io/fmesher/articles/inla_conversion.html for
more information. -
General speed improvements, see below for details.
-
Added
gg.sf()
method. -
Add experimental support for
stars
viaeval_spatial()
.
(version2.8.0.9007
) -
Move the
sp
package from 'Depends' to 'Imports'. This means that user code
should either usesp::
orlibrary("sp")
to accesssp
methods.
Thebru_safe_sp()
helper function can be used to check for a safe
sp
package configuration during the transition fromrgdal
tosf
, and
is only needed if you may run on systems withsp
installations older than
"2.0-0" or withsp::get_evolution_status() < 2
. (version2.8.2011
) -
Now preserves the previous log output when using
bru_rerun()
,
andbru_log()
is now a set of S3 methods, supporting extracting the
full inlabru log as wellbru
-object specific logs (version2.8.0.9008
).Note: From version
2.9.0
, usebru_log()
to access the global log, and
bru_log(fit)
to access a stored estimation log.Up to version
2.8.0
,bru_log()
was a deprecated alias for
bru_log_message()
. When running on2.8.0
or earlier, usebru_log_get()
to access the global log, andcat(fit$bru_iinla$log, sep = "\n")
to print
a stored estimation object log.
Bug fixes and speed improvements
- Covariate object component inputs of type
SpatialPolygonsDataFrame
were not automatically passed on toeval_spatial()
. The logic has now changed
so that any object with aeval_spatial()
method will trigger a call to
eval_spatial()
. See?input_eval
for further information.
(version2.8.0.9001
) fm_crs_is_null()
,fm_transform()
now supports obliquefm_crs
CRS objects,
andis.na()
methods for thefm_crs
andinla.CRS
classes have been added.
(version2.8.0.9003
)- Significant speed up
predict()
by usingquantile(..., names = FALSE)
.
(version2.8.0.9004
) - Improved
row_kron()
code, causing speedups of a factor 2-30 in randomised
test cases. (version2.8.0.9005
) - Removed incorrect code for
sf
method foreval_spatial()
, causing failure
when extracting from multiple layers in a single call.
(version2.9.0.9007
) - Improved handling of posterior sample variable extraction in
generate()
andpredict()
. Now much faster for large models. (version2.8.0.9009
) - Fixed linearisation issue when using only the
*_latent
form of a component.
(version2.8.0.9015
) - Workaround for equivalent but textually different CRS/WKT information in
bru_fill_missing()
. (version2.9.0.9016
, fixes #200)
Deprecation of old functions
eval_SpatialDF
removed, deprecated since2.8.0
. Seeeval_spatial
instead.stransform
,ibm_amatrix
,ibm_valid_input
removed, deprecated since2.7.0
.
Seefm_transform
andibm_jacobian
instead.bru_mapper_offset
, deprecated since2.6.0
now returns a purebru_mapper_const
object, and allbru_mapper_offset
ibm_*
methods have been removed.init.tutorial
removed, deprecated since2.5.0
generate.inla
andpredict.inla
removed, deprecated since2.1.0
inlabru 2.8.0
Feature updates
-
The iterative inla method has been given both sharper internal
inla()
optimisation
criteria for the iterations (thanks to Haavard Rue), and a more relaxed
nonlinear iteration stopping criterion; the defaultbru_method$rel_tol
values has been changed from 1 to 10 percent change. The iterations are
terminated when all latent and hyper-parameter mode changes fullfil
|change|/SD < rel_tol
, and the non-linear line search is inactive.
This seems to strike a useful balance between the different optimisation
criteria, allowing the iterations to converge faster and also detect that
convergence sooner. -
The logic for which components are needed for a predictor expression
(inlike()
orgenerate()
/predict()
) has been updated to when possible
extract the list of components from the expression itself.
The user can override this default if necessary, using theinclude
/exclude
arguments.The
bru_used()
methods are used to guess the needed component names, applied
to the right-hand side of theformula
arguments. Theallow_latent
argument
tolike()
has been deprecated in favour ofinclude_latent
(by default auto-detected for use of_latent
and_eval
).The internal information storage is handled by the new
bru_used()
methods, that can also be used directly by the user and supplied via the
used
argument tolike()
/generate()
/predict()
. -
Add
fm_int()
integration methods, replacing the oldipmaker()
andipoints()
methods.
Supports bothsf
andsp
sampler objects. -
Add
fm_pixels()
methods for gridded points. The old
pixels()
method now callsfm_pixels(..., format = "sp")
-
eval_spatial
support for sf objects (for point-in-polygon data lookups) -
Allow precomputed spatial covariates in the data for point process observations
-
Add
edge|int|ext.linewidth
arguments togg.inla.mesh
#188 -
Rename the
predict()
andgenerate()
data
arguments tonewdata
, for
better compatibility with otherpredict()
methods. The old argument name
will still be accepted, but give a warning. Code that does not name thedata
argument is not affected. -
Note: Coordinate names for
Spatial*
objects have been inconsistently
available in the predictor expression evaluation. However, due to how internal
conversions might inadvertently change these names, they can not be relied
on, and they are no longer being made available to the predictor expression.
As a side effect, this change also speeds up somebru()
runs by around a
factor 2, since it avoids converting theSpatial*
to a regulardata.frame
in time-sensitive core evaluation code.If you need access to the raw coordinate values, use explicit calls to
sp::coordinates(.data.)
(e.g. for custom spatial covariate evaluation.).
When possible, use the built-in covariate evaluation method,eval_spatial()
,
either implicitly withcomp(covariate, ...)
or explicitly,
comp(eval_spatial(covariate, where = .data.), ...)
, that handlescrs
information
correctly. Also consider transitioning fromsp
tosf
data storage, using
geometry
instead of raw coordinates.
Bug and dependency updates
-
Remove
rgdal
andmaptools
dependencies #178 -
Add
bru_safe_sp()
to check ifsp
can be used safely (checksrgdal
availability
andsp
evolution status, optionally forcing use ofsf
) #178 -
Remove PROJ4 support #178
-
Change
rgl.*
functions to*3d
. Thanks to Duncan Murdoch #181 -
Speed up
ibm_jacobian.bru_mapper_harmonics
for large models -
Add workarounds for inconsistent polygon orientation resulting from
sf::st_*
calls that don't account for thegeos
canonical representation being CW,
whereas the canonical Simple Features representation being CCW. See
r-spatial/sf#2096
inlabru 2.7.0
Feature overview
-
Added support for
sf
andterra
inputs to most methods -
Expanded geometry and mesh handling methods
-
Expanded
bru_mapper
system -
Added convergence diagnostics plot with
bru_convergence_plot()
Feature details
-
Allow
NA
input for default 1D mappers to generate effect zero, like
ininla()
. -
New and expanded methods
fm_crs
,fm_CRS
,fm_transform
,
fm_ellipsoid_radius
, andfm_length_unit
to further supportsf
objects.
Thefm_crs
extraction method also supportsterra
objects. -
bru_fill_missing
now supportsterra
SpatRaster
data and andsf
locations. -
New experimental methods
fm_evaluator
andfm_evaluate
, replacing the
INLA
inla.mesh.projector
andinla.mesh.project
methods. -
Experimental integration support for sphere and globe meshes. Fixes #166
-
Allow
sf
input tofamily="cp"
models. -
Further
bru_mapper
method updates;-
Deprecated
ibm_amatrix()
andnames()
methods, replaced byibm_jacobian()
andibm_names()
. -
Introduced
bru_mapper_pipe()
, used to link mappers in sequence. -
Introduced
bru_mapper_aggregate()
andbru_mapper_logsumexp()
,
used for blockwise weighted sums and log-sum-exp mappings,
output[k] = sum(weights[block==k]*state[block==k])))
and
output[k] = log(sum(weights[block==k]*exp(state[block==k])))
,
with optional weight normalisation within each block. Allows
providing the weights as log-weights, and uses block-wise shifts to
avoid potential overflow. -
summary
methods forbru_mapper
objects -
Removed
methods
argument frombru_mapper_define()
. Implementations
should register S3 methods instead.
-
Bug fixes
-
Remove unused
spatstat.core
dependency. Fixes #165 -
Fixed issue with plain mapper evaluation in the
ibm_eval.default
andibm_eval.bru_mapper_collect
methods, where they would return zeros
instead of the intended values.
The main component evaluation and estimation code was not directly affected
as that is based on thebru_mapper_multi
class methods that rely on the
Jacobians instead. The bug would therefore mainly have impacted the future,
not yet supported nonlinear mapper extensions. -
Fix for
eval_spatial.SpatRaster
; Work around inconsistent logic in
terra::extract(..., layer)
whenlength(layer)==1
ornrow(where)==1
.
Fixes #169- Add
indexed
logical option tobru_mapper_factor()
, to allow
factor inputs to be mapped to index values, as needed forgroup
and
replicate
. Fixes #174
- Add
inlabru 2.6.0
Features
-
Add
bru_get_mapper
generic, and associated methods forinla.spde
and
inla.rgeneric
objects. This allowsinlabru
to automatically extract
the appropriatebru_mapper
object for each model component, and can be used
as a hook by external packages implementing new INLA object classes. -
Add a
weights
argument forlike()
, for likelihood-specific log-likelihood
weights, passed on to theINLA::inla()
weights argument. Evaluated in the
data context. -
The
<component>_eval()
methods available in predictor expressions
now handle optional scaling weights, like in ordinary component effect
evaluation. -
Add
terra
support for covariate inputs -
The component
*_layer
arguments are now evaluated in the data context,
to allow dynamic layer selection for spatial raster covariates. A new
genericeval_spatial()
provides support for grid/pixel based
Spatial*DataFrame
evaluation, andSpatRaster
. Expanded support
is in progress. -
New vignettes on the
bru_mapper
system,component
definitions,
andprediction_scores
-
General overhaul of the
bru_mapper
and linearised predictor system,
to prepare for new features.-
Add
ibm_eval
generic for evaluating mappers for given states. -
Add
bru_mapper_taylor
, used as an internal mapper for linearised
mappers. This andibm_eval
is aimed at future support for nonlinear
mappers. Associated new generic methods:ibm_{is_linear,jacobian,linear}
. -
New mapper implementations should use
ibm_jacobian
instead ofibm_amatrix
.
This allows defining a linearised mapper via
ibm_eval(input, state0) + ibm_jacobian(input, state0) %*% (state - state0)
. -
New mapper class
bru_mapper_const
, which replacesbru_mapper_offset
.
bru_mapper_offset
is now deprecated and will produce warnings.
-
Bug fixes
inlabru 2.5.3
Features
-
Add
bru_mapper_harmonics
mapper forcos
andsin
basis sets. -
Allow
predict()
input data to be be a list. -
Allow arbitrary quantile summaries in
predict()
-
Remove
cv
,var
,smin
,smax
summaries frompredict()
-
Add
mean.mc_std_err
andsd.mc_std_err
output topredict()
-
Add
robins_subset
data set and associated variable coefficient web vignette
Bug fixes
-
Propagate multi-likelihood A-matrix information instead of recomputing.
Fixes iteration issue for bym2 and otherbru_mapper_collect
models. -
Turn on predictor summaries during iterations to allow
inla.mode="classic"
to use proper line search. -
Avoid deprecated Matrix (>=1.4-2) class coercion methods
-
Work around for lack of full Matrix and ModelMatrix support for the
unique
method. Fixes #145