Giter Site home page Giter Site logo

Comments (5)

mhesselbarth avatar mhesselbarth commented on June 1, 2024 1

This is related to the mesh that INLA/INLABRU uses to predict into space. For all (most?) other engines the spatial dimensions are exactly the same.

Not sure it's possible to force INLA/INLABRU to use a mesh with exactly the same characteristics...

from ibis.isdm.

jeffreyhanson avatar jeffreyhanson commented on June 1, 2024

Ah, I see - thanks for explaining that! To ensure that I can get model predictions at a particular resolution and spatial extent, would you recommend resampling the data to a finer resolution prior to model fitting? Or manually specifying the mesh?

from ibis.isdm.

jeffreyhanson avatar jeffreyhanson commented on June 1, 2024

Just to follow up, I've found that using something like this (see code below) tends to produce rasters with approximately the correct the spatial resolution so that I can subsequently resample the output prediction raster to match the original background raster.

ibis.iSDM::engine_inlabru(x, proj_stepsize = max(terra::res(bg_data)) * 0.85)

Although this increases the overall computatio time quite a bit, does this seem like a reasonable solution?

from ibis.isdm.

Martin-Jung avatar Martin-Jung commented on June 1, 2024

INLA does not use the predictor covariates to create the prediction output frame, but makes predictions on the created (if parameters are supplied) or provided (if directly passed on) mesh. A gridded prediction is only created afterwards by essentially turning each mesh node back into a gridded surface (linearly interpolating per unit stepsize). This unfortunately can result to mismatches with the original covariate spatial resolution.

Changing the stepsize can be a way but I would guess this is quite problem/dataset dependent and hard to find a golden rule there... Generally you would want a fine mesh with many nodes particular where your data is distributed which unfortunately is almost always linked to higher computational effort.
The mesh can be checked via plot( model$engine$data$mesh ) and I think there was also an in INLA function to build meshes (INLA::INLA::meshbuilder()).
Note: The denseness and location of mesh nodes has been shown to affect predictions, so the choice of creating a mesh is ultimately a parameter choice and left to users. See Dambly et al.

My recommendation if INLA is heavily used would be to create a 'default' reasonably fine mesh a priori and then supply this mesh to all predictions via engine_inlabru(optional_mesh = mymesh).

There is also build-in convenience functions for aligning/resampling grids which in cases where the prediction is larger might help sometimes (alignRasters(layer, templater) )).

from ibis.isdm.

jeffreyhanson avatar jeffreyhanson commented on June 1, 2024

Ah I see - thank you very much for explaining all that @Martin-Jung!

from ibis.isdm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.