inlabru (development version)
Remove
rgdal
andmaptools
dependencies #178Add
bru_safe_sp()
to check ifsp
can be used safely (checksrgdal
availability andsp
evolution status, optionally forcing use ofsf
) #178Remove PROJ4 support #178
Warning: Coordinate names for
Spatial*
objects have been inconsistently available in the predictor expression evaluation. Avoid relying on those being present, and use explicit calls tocoordinates(.data.)
if you need the coordinate values (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.), ...)
.Change rgl.* functions to *3d. Thanks to Duncan Murdoch #181
Speed up
ibm_jacobian.bru_mapper_harmonics
for large modelseval_spatial
supported to sf objects (for point-in-polygon data lookups)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 https://github.com/r-spatial/sf/issues/2096Allow precomputed spatial covariates in the data for point process observations
Add
edge|int|ext.linewidth
arguments togg.inla.mesh
#188Rename 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.Add
fm_int()
integration methods, replacing the oldipmaker()
andipoints()
methods. Supportssf
sampler objects.Add
fm_pixels()
methods for gridded points.pixels()
callsfm_pixels(..., format = "sp")
inlabru 2.7.0
CRAN release: 2022-12-02
Feature overview
Added support for
sf
andterra
inputs to most methodsExpanded geometry and mesh handling methods
Expanded
bru_mapper()
systemAdded 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 theINLA
inla.mesh.projector
andinla.mesh.project
methods.Experimental integration support for sphere and globe meshes.
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])))
andoutput[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 (summary.bru_mapper()
)Removed
methods
argument frombru_mapper_define()
. Implementations should register S3 methods instead.
Bug fixes
Remove unused
spatstat.core
dependency. Fixes #165Fixed 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 interra::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
andreplicate
. Fixes #174
- Add
inlabru 2.6.0
CRAN release: 2022-10-24
Features
Add
bru_get_mapper
generic, and associated methods forinla.spde
andinla.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 inputsThe 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 basedSpatial*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 viaibm_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.
inlabru 2.5.3
CRAN release: 2022-09-05
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 other
bru_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
inlabru 2.5.2
CRAN release: 2022-03-30
More robust package checks
More robust namespace and INLA availability checks
Add package vignette with links to the website examples
inlabru 2.5.1
Revert to R language features compatible with R 4.0.5
Use
strategy="gaussian"
during iterations.
inlabru 2.5.0
CRAN release: 2022-03-21
Features
Add
bru()
timing information in$bru_timings
and$bru_iinla$timings
Add
SpatialPolygonsDataFrame
support togg()
methodsAllow accessing
E
andNtrials
fromresponse_data
anddata
(further special arguments remain to be added)deltaIC
improvementsNew transformation helper tools
bru_{forward/inverse}_transformation()
Experimental support for matrix and formula component inputs. E.g. with
~ name(~ -1 + a + b + a:b, model = "fixed")
, covariate fixed effect interaction specifications can be made. For formula input,MatrixModels::model.Matrix()
is called to construct matrix input that is then used as the A-matrix for fixed effects, one per column, added up to form the combined effect.Documentation and examples improvements
Bug fixes
Fix A-matrix construction for
evaluate_model()
for cases where theinla_f
argument mattersMore efficient and robust mesh integration code
Cleanup of environment handling for component lists
inlabru 2.4.0
CRAN release: 2021-12-19
Features
Allow predictors to have different size than the input data. The
data
argument is now allowed to be alist()
, and the new argumentresponse_data
allows separate specification of component inputs and response variables.Add
bru_mapper_collect
class for handling sequential collections of mappers, including collections where all but the first mapper is hidden from theINLA::f()
argumentsn
andvalues
, as needed to support e.g. “bym2” models.Add
control.family
as a direct argument tolike()
. Gives a warning if acontrol.family
argument is supplied to the theoptions
argument ofbru()
, but at least one likelihood hascontrol.family
information. (Issue #109)
Bugfixes
Fix support for
SpatialPointsDataFrame
andSpatialGridDataFrame
input tobru_fill_missing()
Force explicit
model = "offset"
components instead of special options, to avoid interfering with the linearisation system (Issue #123)Make the iterations more robust by resetting the internal INLA predictor states to initial value zero at each step
Miscellaneous
Rename the option
bru_method$stop_at_max_rel_deviation
tobru_method$rel_tol
. Automatic conversion to the new name, but a warning is given.Add option
bru_method$max_step
to control the largest allowed line search scaling factor. See?bru_options
New default option
bru_compress_cp
set toTRUE
to compress the predictor expression forfamily="cp"
to use a single element for the linear predictor sum.
inlabru 2.3.1
CRAN release: 2021-03-22
Documentation and dependency updates for CRAN compatibility
See NEWS for version 2.3.0 for the major updates since version 2.1.13
inlabru 2.3.0
CRAN release: 2021-03-16
Breaking changes since version 2.1.13
The model component argument
map
has been deprecated. Usemain
to specify the main component input,~ elev(main = elevation, model = "rw2")
. Unlike the oldmap
argument,main
is the first one, so the shorter version~ elev(elevation, model = "rw2")
also works.Intercept-like components should now have explicit inputs, e.g.
~ Intercept(1)
to avoid accidental confusion with other variables.The argument list for
bru()
has been simplified, so that all arguments exceptcomponents
andoptions
must either be outputs from calls tolike()
, or arguments that can be sent to a singlelike()
call.The option setting system has been replaced with a more coherent system; see
?bru_options()
for details.The
samplers
anddomain
system forlgcp
models is now stricter, and requires explicitdomain
definitions for all the point process dimensions. Alternatively, user-defined integration schemes can be supplied via theips
argument.
New features since version 2.1.13
The model component input arguments
main
,group
,replicate
, andweights
can now take general R expressions using the data inputs. Special cases are detected:SpatialPixels/GridDataFrame
objects are evaluated at spatial locations if the input data is aSpatialPointsDataFrame
object. Functions are evaluated on the data object, e.g.field(coordinates, model = spde)
The component arguments
mapper
,group_mapper
, andreplicate_mapper
can be used for precise control of the mapping between inputs and latent variables. See?bru_mapper
for more details. Mapper information is automatically extracted fromINLA::inla.spde2.pcmatern()
model objects.The R-INLA
weights
andcopy
features are now supported.The predictor expressions can access the data object directly via
.data.
If data from several rows can affect the same output row, the
allow_combine = TRUE
argument must be supplied tolike()
The
include
andexclude
arguments tolike()
,generate()
, andpredict()
can be used to specify which components are used for a given likelihood model or predictor expression. This can be used to prevent evaluation of components that are invalid for a likelihood or predictor.Predictor expressions can access the latent state of a model component directly, by adding the suffix
_latent
to the component name, e.g.name_latent
. Forlike()
, this requiresallow_latent = TRUE
to activate the needed linearisation code for this.Predictor expressions can evaluate component effects for arbitrary inputs by adding the suffix
_eval
to access special evaluator functions, e.g.name_eval(1:10)
. This is useful for evaluating the 1D effect of spatial covariates. See the NEWS item for version 2.2.8 for further details.The internal system for predictor linearisation and iterated INLA inference has been rewritten to be faster and more robust
See the NEWS entries for versions 2.1.14 to 2.2.8 for further details on new features and bug fixes
inlabru 2.2.8
-
Add
_eval
suffix feature forgenerate.bru
andpredict.bru
, that provides a general evaluator function for each component, allowing evaluation of e.g. nonlinear effects of spatial covariates as a function of the covariate value instead of the by the spatial evaluator used in the component definition. For example, withcomponents = ~ covar(spatial_grid_df, model = "rw1")
, the prediction expression can have~ covar_eval(covariate)
, wherecovariate
is a data column in the prediction data object.For components with
group
andreplicate
features, these also need to be provided to the_eval
function, with..._eval(..., group = ..., replicate = ...)
This feature is built on top of the
_latent
suffix feature, that gives direct access to the latent state variables of a component, so in order to use_eval
in the model predictor itself, you must uselike(..., allow_latent = TRUE)
in the model definition.
inlabru 2.2.7
Add support for
ngroup
andnrep
in component definitionsUpdated
mexdolphin
andmrsea
data sets, with consistent km units and improved mesh designs
inlabru 2.2.6
Add
predict(..., include)
discussion to distance sampling vignette, for handling non-spatial prediction in spatial models.Fix bugs in
gg.SpatialLines
inlabru 2.2.5
Vignette corrections
Documentation improvements
Fix minor bug in
Spatial*
object handling and plotting
inlabru 2.2.4
- Properly extract the joint latent conditional mode instead of the marginal latent conditional mode
inlabru 2.2.2
Fixed issue with
predict()
logic for converting output toSpatial*DataFrame
Use
control.mode=list(restart=FALSE)
in the final inla run for nonlinear models, to avoid an unnecessary optimisation.Fix issues in
pixels()
andbru_fill_missing()
forSpatial*DataFrame
objects withncol=0
data frame parts.
inlabru 2.2.0
Support for the INLA “copy” feature,
comp2(input, copy = "comp1")
Allow component weights to be an unnamed parameter,
comp(input, weights, ...)
Direct access to the data objects in component inputs and predictor expressions, as
.data.
, allowing e.g.covar(fun(.data.), ...)
for a complex covariate extractor methodfun()
Partial support for spherical manifold meshes
Uses INLA integration strategy “eb” for initial nonlinear iterations, and a specified integration strategy only for the final iteration, so that the computations are faster, and uses the conditional latent mode as linearisation point.
inlabru 2.1.15
New options system
New faster linearisation method
New line search method to make the nonlinear inla iterations robust
Method for updating old stored estimation objects
System for supplying mappings between latent models and evaluated effects via
bru_mapper
objectsImproved factor support; Either as “contrast with the 1st level”, via the special
"factor_contrast"
model, or all levels with model"factor_full"
. Further options planned (e.g. a simpler options to fix the precision parameter). The estimated coefficients appear as random effects in theinla()
output.Interface restructuring to support new features while keeping most backwards compatibility. Change
map=
tomain=
or unnamed first argument; Sincemain
is the first parameter, it doesn’t need to be a named argument.Keep components with zero derivative in the linearisation
PROJ6 support
Add random seed option for posterior sampling
Add package unit testing
New backend code to make extended feature support easier
New
int.args
option to control spatial integration resolution, thanks to Martin Jullum (martinju
)
inlabru 2.1.12
CRAN release: 2019-06-24
- Workaround an integration points error for old (ca pre-2018) INLA versions
inlabru 2.1.7
Added a
NEWS.md
file to track changes to the package.Added
inla
methods forpredict()
andgenerate()
that convertinla
output intobru
objects before calling thebru
prediction and posterior sample generator.Added protection for examples requiring optional packages
Fix
sample.lgcp
output formatting, extended CRS support, and more efficient sampling algorithmAvoid dense matrices for effect mapping
inlabru 2.1.4
-
iinla()
tracks convergence of both fixed and random effects