Skip to content

Releases: inlabru-org/inlabru

inlabru 2.12.0

21 Nov 23:10
Compare
Choose a tag to compare

General changes

  • Introduce bru_obs() as a replacement to like(), to help avoid namespace
    clashes with e.g. data.table::like() (version 2.11.1.9026)
  • Change logic for like/bru_obs(allow_combine) to allow user override, and
    add warnings for ambiguous cases (version 2.11.1.9011)
  • Add bru_response_size() method for extracting the response size for each
    observation bru_like object (version 2.11.1.9013)
  • Add sf output format support for sline and spoly (version 2.11.1.9006)
  • Add [ and ] to special character set in bru_standardise_names()
    (version 2.11.1.9012)
  • Add bru_index() method for accessing predictor index information for
    sub-models, and a tag argument for bru_obs() to identify individual
    sub-models by name, which is also propagated to lists of bru_like objects
    (version 2.11.1.9017 and 2.12.0)
  • Allow bru_mapper_multi() sub-mappers to have non-zero offsets, that are
    added to generate the combined offset (version 2.11.1.9019)
  • Add general bru_mapper_fmesher() mapper, for indexed mapping of
    all objects supporting fm_dof() and fm_basis() (version 2.11.1.9021)
  • Add bru_mapper_repeat() mapper, for automated single-mapper sums
    (version 2.11.1.9022)

Data set updates

  • Convert mrsea to sf format (version 2.11.1.9009)
  • Convert the shrimp data set to sf format (version 2.11.1.9007)
  • Remove seals_sp data set due to excessive size (version 2.11.1.9010)
  • Replace the mexdolphin dataset with a function mexdolphin_sp()
    to avoid sp data objects in the package (version 2.11.1.9015)
  • Replace the gorillas dataset with a function gorillas_sp()
    to avoid sp data objects in the package (version 2.11.1.9016)

Namespace changes

  • Move sp from Imports to Suggests. Component definitions using
    coordinates as input require either sp::coordinates or sp having been
    already loaded with e.g. library(sp) (version 2.11.1.9003)
  • Remove ggmap support (version 2.11.1.9002)
  • Remove unnecessary INLA namespace loading in ggplot methods
    (version 2.11.1.9008)
  • Move terra from Imports to Suggests (version 2.11.1.9014)
  • Stop re-exporting fmesher methods (version 2.11.1.9020)

Deprecated methods

  • Deprecated (since 2.8.0) method is.inside() have been removed.
    Use fmesher::fm_is_within() instead.
  • Deprecated (since 2.7.0) bru_mapper.default() to define new mapper classes
    has been removed. Use bru_mapper_define() instead.
  • Deprecated (since 2.6.0) bru_mapper_offset() method has been removed.
    Use bru_mapper_const() instead.

Internal changes

  • Remove unneeded "list" class inheritance from solitary classes
    (version 2.11.1.9001)
  • Expand the summary and print method class coverage (version 2.11.1.9002)
  • Reduced the amount of diagnostic messages in bru_safe_inla()
    (version 2.11.1.9005)
  • Change name of component and component_list methods to bru_component
    and bru_component_list (version 2.11.1.9026)

inlabru 2.11.1

01 Jul 22:00
Compare
Choose a tag to compare

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

01 Jul 15:06
Compare
Choose a tag to compare

New features

  • Add support for the scale parameter to like().
  • Add support for special response objects like inla.mdata() and inla.surv(),
    when INLA version > 24.06.02 (for mdata) or > 24.06.26 (for surv) are
    available (version 2.10.1.9011)
  • New toypoints example data set, for basic modelling examples
    (version 2.10.1.9003)

Feature updates

  • Updated convergence plots, reducing random effect aspects to summary statistics,
    improving speed and visual coherence (version 2.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
    (version 2.10.1.9005)
  • Switch timing mechanism from Sys.time() to proc.time() to capture CPU time
    instead of elapsed clock time. Added bru_timings() method to extract the timings
    safely from a fitted bru object (version 2.10.1.9007 and 2.10.1.9010)
  • Add verbosity level information to the bru log data structure,
    allowing filtered log extraction and more flexible log display
    (version 2.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 (version 2.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 (version 2.10.1.9006)
  • Improved backwards compatibility support for sp data input for family = "cp"
    (version 2.10.1.9008)

Deprecated methods

  • Deprecated (since 2.9.0) method ipoints(samplers, domain) is no longer available.
    Use fmesher::fm_int(domain, samplers) instead.
  • The allow_latent, include_latent arguments to like() have been deprecated in favour
    of the general bru_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.
    Use fmesher::fm_cprod() instead.
  • The integration_weight_aggregation method has been removed (deprecated since 2.8.0).
    Use fmesher::fm_vertex_projection() instead.
  • The mesh_triangle_integration method has been removed (deprecated since 2.8.0).
    Use fmesher::fm_int() instead.
  • Old use of bru_mapper.default() to define new mapper classes has been disabled
    (deprecated since 2.7.0). Use bru_mapper_define() instead.
  • Deprecated (since 2.8.0) methods is.inside(), vertices.inla.mesh(), and
    pixels() have been disabled. Use fmesher::fm_is_within(), fmesher::fm_vertices(),
    and fmesher::fm_pixels() instead.

inlabru 2.10.1

21 Dec 09:12
Compare
Choose a tag to compare

Feature updates

Bug fixes and dependency simplification

  • Remove dependence on the ggpolypath package, and the
    ggplot2::fortify.SpatialPolygons/DataFrame() methods that were deprecated in
    ggplot2 version 3.4.4. Code using gg.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
    allow bru_mapper_marginal to be applied with e.g. spatially varying parameters.
    (version 2.10.0.9001)
  • Detect terra version >= 1.7-66 that removes the need for
    detecting special cases (nrow(where) == 1 and terra::nlyr(data) == 1).
    Workaround code used for versions < 1.7-66. (version 2.10.0.9002)
    (Thanks to Robert J. Hijmans)

inlabru 2.10.0

29 Oct 13:09
Compare
Choose a tag to compare

Feature updates

  • Add new ibm_simplify() generic to handle mapper simplification more generally;
    needed to properly support non-linear component mappers. (version 2.9.0.9004)
  • Add new bru_mapper_marginal() mapper class that can be used as part of component
    mapper pipelines. (version 2.9.0.9004)
  • Add new ibm_eval2() generic that computes both evaluation and Jacobian,
    avoiding double-computing of the Jacobian, when practical. (version 2.9.0.9005)
  • Add new bru_timings_plot() function that plots the time used for each nonlinear iteration
    (version 2.9.0.9007)
  • Speed up bru_fill_missing() (by orders of magnitude) by changing method for
    finding the nearest available data point. (version 2.9.0.9011)
  • Add new bru_mapper_shift() mapper class that works like bru_mapper_scale()
    but for additive shifts instead of multiplicative scaling. (version 2.9.0.9012)
  • Added more checks for invalid component or predictor evaluations, to help
    catch user errors sooner, and with more informative messages. (version 2.9.0.9013)
  • Expand bru_mapper_matrix, previously used only for component model = "fixed",
    to allow integer indexing in addition to the previous factor/character-only indexing.
    (version 2.9.0.9014)

Bug fixes

  • The is_linear flag wasn't correctly set for bru_mapper_logsumexp mappers.
    Since previous versions did not accept non-linear component mappers, this
    is unlikely to have affected any user code. (Fixed in version 2.9.0.9001)
  • Improved error messages for missing or incomplete LGCP domain specification.
    (version 2.9.0.9002 and 2.9.0.9006)
  • Allow NULL in automatic component usage detection. (version 2.9.0.9003)
  • Corrected the crs information for gorillas$plotsample$counts and
    gorillas_sf$plotsample$counts from +units=m to +units=km. (version 2.9.0.9010)
    The geometry information in counts 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. (version 2.9.0.9011)
  • Make eval_spatial() transform the where coordinates to the same crs as the
    input data, for SpatRaster and sf inputs, to allow different crs specifications.
    (version 2.9.0.9012)

inlabru 2.9.0

28 Aug 18:04
Compare
Choose a tag to compare

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 via eval_spatial().
    (version 2.8.0.9007)

  • Move the sp package from 'Depends' to 'Imports'. This means that user code
    should either use sp:: or library("sp") to access sp methods.
    The bru_safe_sp() helper function can be used to check for a safe
    sp package configuration during the transition from rgdal to sf, and
    is only needed if you may run on systems with sp installations older than
    "2.0-0" or with sp::get_evolution_status() < 2. (version 2.8.2011)

  • Now preserves the previous log output when using bru_rerun(),
    and bru_log() is now a set of S3 methods, supporting extracting the
    full inlabru log as well bru-object specific logs (version 2.8.0.9008).

    Note: From version 2.9.0, use bru_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 on 2.8.0 or earlier, use bru_log_get()
    to access the global log, and cat(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 to eval_spatial(). The logic has now changed
    so that any object with a eval_spatial() method will trigger a call to
    eval_spatial(). See ?input_eval for further information.
    (version 2.8.0.9001)
  • fm_crs_is_null(), fm_transform() now supports oblique fm_crs CRS objects,
    and is.na() methods for the fm_crs and inla.CRS classes have been added.
    (version 2.8.0.9003)
  • Significant speed up predict() by using quantile(..., names = FALSE).
    (version 2.8.0.9004)
  • Improved row_kron() code, causing speedups of a factor 2-30 in randomised
    test cases. (version 2.8.0.9005)
  • Removed incorrect code for sf method for eval_spatial(), causing failure
    when extracting from multiple layers in a single call.
    (version 2.9.0.9007)
  • Improved handling of posterior sample variable extraction in generate()
    and predict(). Now much faster for large models. (version 2.8.0.9009)
  • Fixed linearisation issue when using only the *_latent form of a component.
    (version 2.8.0.9015)
  • Workaround for equivalent but textually different CRS/WKT information in
    bru_fill_missing(). (version 2.9.0.9016, fixes #200)

Deprecation of old functions

  • eval_SpatialDF removed, deprecated since 2.8.0. See eval_spatial instead.
  • stransform, ibm_amatrix, ibm_valid_input removed, deprecated since 2.7.0.
    See fm_transform and ibm_jacobian instead.
  • bru_mapper_offset, deprecated since 2.6.0 now returns a pure bru_mapper_const
    object, and all bru_mapper_offset ibm_* methods have been removed.
  • init.tutorial removed, deprecated since 2.5.0
  • generate.inla and predict.inla removed, deprecated since 2.1.0

inlabru 2.8.0

20 Jun 14:18
Compare
Choose a tag to compare

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 default bru_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
    (in like() or generate()/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 the include/exclude arguments.

    The bru_used() methods are used to guess the needed component names, applied
    to the right-hand side of the formula arguments. The allow_latent argument
    to like() has been deprecated in favour of include_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 to like()/generate()/predict().

  • Add fm_int() integration methods, replacing the old ipmaker() and ipoints() methods.
    Supports both sf and sp sampler objects.

  • Add fm_pixels() methods for gridded points. The old
    pixels() method now calls fm_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 to gg.inla.mesh #188

  • Rename the predict() and generate() data arguments to newdata, for
    better compatibility with other predict() methods. The old argument name
    will still be accepted, but give a warning. Code that does not name the data
    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 some bru() runs by around a
    factor 2, since it avoids converting the Spatial* to a regular data.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 with comp(covariate, ...) or explicitly,
    comp(eval_spatial(covariate, where = .data.), ...), that handles crs information
    correctly. Also consider transitioning from sp to sf data storage, using
    geometry instead of raw coordinates.

Bug and dependency updates

  • Remove rgdal and maptools dependencies #178

  • Add bru_safe_sp() to check if sp can be used safely (checks rgdal availability
    and sp evolution status, optionally forcing use of sf) #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 the geos canonical representation being CW,
    whereas the canonical Simple Features representation being CCW. See
    r-spatial/sf#2096

inlabru 2.7.0

02 Dec 11:20
Compare
Choose a tag to compare

Feature overview

  • Added support for sf and terra 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
    in inla().

  • New and expanded methods fm_crs, fm_CRS, fm_transform,
    fm_ellipsoid_radius, and fm_length_unit to further support sf objects.
    The fm_crs extraction method also supports terra objects.

  • bru_fill_missing now supports terra SpatRaster data and and sf locations.

  • New experimental methods fm_evaluator and fm_evaluate, replacing the
    INLA inla.mesh.projector and inla.mesh.project methods.

  • Experimental integration support for sphere and globe meshes. Fixes #166

  • Allow sf input to family="cp" models.

  • Further bru_mapper method updates;

    • Deprecated ibm_amatrix() and names()
      methods, replaced by ibm_jacobian() and ibm_names().

    • Introduced bru_mapper_pipe(), used to link mappers in sequence.

    • Introduced bru_mapper_aggregate() and bru_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 for bru_mapper objects

    • Removed methods argument from bru_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
    and ibm_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 the bru_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) when length(layer)==1 or nrow(where)==1.
    Fixes #169

    • Add indexed logical option to bru_mapper_factor(), to allow
      factor inputs to be mapped to index values, as needed for group and
      replicate. Fixes #174

inlabru 2.6.0

24 Oct 15:33
Compare
Choose a tag to compare

Features

  • Add bru_get_mapper generic, and associated methods for inla.spde and
    inla.rgeneric objects. This allows inlabru to automatically extract
    the appropriate bru_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 for like(), for likelihood-specific log-likelihood
    weights, passed on to the INLA::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
    generic eval_spatial() provides support for grid/pixel based
    Spatial*DataFrame evaluation, and SpatRaster. Expanded support
    is in progress.

  • New vignettes on the bru_mapper system, component definitions,
    and prediction_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 and ibm_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 of ibm_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 replaces bru_mapper_offset.
      bru_mapper_offset is now deprecated and will produce warnings.

Bug fixes

  • Enable both datum/ensemble container for ellipsoid information, to support
    epsg:4326. Fixes #154

  • Make duplicated component names an error instead of a warning.
    Relates to #155

  • Fix Tsparse assumptions in row_kron to prepare for Matrix 1.5-2.
    Fixes #162

inlabru 2.5.3

05 Sep 08:48
Compare
Choose a tag to compare

Features

  • Add bru_mapper_harmonics mapper for cos and sin basis sets.

  • Allow predict() input data to be be a list.

  • Allow arbitrary quantile summaries in predict()

  • Remove cv, var, smin, smax summaries from predict()

  • Add mean.mc_std_err and sd.mc_std_err output to predict()

  • 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