inlabru-org / inlabru

inlabru
https://inlabru-org.github.io/inlabru/
76 stars 21 forks source link

Probability of point presence within a spatio-temporal LGCP model #76

Closed ghost closed 1 year ago

ghost commented 4 years ago

I am creating a spatio temporal log gaussian cox process model using inlabru. The following model composition seems to work. mdl.comp <- ~ Intercept + spat(map = coordinates, model = my.pcmatern, group = YTime, ngroup = nYTime, control.group = list(model = "iid")) + time.cov(map = Time, model = "rw1", n = nTime) + year.cov(map = IYear, model = "iid", n = nIYear) + cov.a(map = cov.a.stan, model = “linear”) + cov.b(map = cov.b.stan, model = “linear”)

mdl.form <- coordinates ~ Intercept + spat + time.cov + year.cov + cov.a + cov.b

fit.model.spat <- inlabru::lgcp(components = mdl.comp, data = survey.all.data, ips = ips.all.data, formula = mdl.form)

The point process has been partially observed during a common survey window (Time) across multiple years (IYear). YTime (Time * IYear), is an index for Time across the full dataset so that the SPDE effect at identical values for Time, but different values for Year, are integrated separately. This current model runs on data which assumes the presence or absence of a point is known as a certainty across the range of Time.

This currently is implemented by:

Truncating the survey.all.data spatialpoint dataframe, so that it has rows which correspond to a limited time period within the full time period, during which we can be highly certain of a point record being present e.g. 40-60. Whereas the integration points ips.all.data dataframe has rows which correspond to the full time period e.g. 1-100.

However, across the full range of time, we can make a more reasonable assumption which reflects our uncertainty in the presence or absence of a point at a particular time.

So instead of truncating the survey.all.data, so that we only have records during the limited time band. We would use the point data for the full time period, and have another variable e.g. probability of presence, with a value of 1 at a particular point in time, and decrease gradually until the start (1), or end (100), of our study period. I can create this variable based upon the species biology before modelling. However, I am trying to figure out how this could be written into the model formula.

The intention is to allow the model to take into account our confidence in whether a point who’s location is known is actually observed in reality, dependent upon our confidence in that point being present and our other covariates.

I thought an adaptation of the detection probability example in the inlabru R package methods paper would work but my attempts so far are failing. I believe that example accommodates for unobserved detection, whereas I want to do something like the opposite. I was wondering if you knew how/if this could be done?

(https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/2041-210X.13168)

Side note: Ideally the SPDE effect would have some grouped effect between neighbouring points in time. So, the spatial effect of an individual point, is correlated to its position at the next time point. I have tried using control.group = list(model = "rw1")) instead of “iid”, however this doesn’t seem to work. I assume this is because it tries to correlate the entire SPDE effect to the entire SPDE effect at the next time step? Nonetheless for our purposes having iid SPDE effects for each time point should be fine.

finnlindgren commented 4 years ago

Hi, the grouped models are supposed to work with model="rw1", but there are bugs. If you can provide more information about precisely in what way it doesn't work (error messages, traceback() output, etc), that might allow a workaround to be found. First of all, please try running with the devel version instead of the CRAN version, since that's closer to the current major code overhaul that I'm hoping to complete in July, and that is expected to allow many more INLA models to run in inlabru. I'm unable to delve into the more general modelling questions at the moment, sorry.

ghost commented 4 years ago

No problem, ill rerun some example with the grouped model and report back at the next oppourtunity. Cheers