SimonDedman / movegroup

Home Range for marine animals using dynamic brownian bridge movement models
Other
16 stars 1 forks source link

Weighting in ScaleRaster produces incorrect results #7

Closed SimonDedman closed 1 year ago

SimonDedman commented 1 year ago

For (e.g.) 3 regions: Region A: 9000 location points. Region B: 27 location points. Region C: 9000 location points.

ScaleRaster will scale them all to 1, then Align & Scale will join them. Region B will be scaled up so its UD centres (for hardly any points) become a blinding hotspot on the final map, looking comparable to hotspots powered by thousands of hits, even though it's powered by few hits. This is wrong.

Find out how Felipe Carvalho did his maths in the Yannis et al 2013 paper, then check our weighting math and update.

SimonDedman commented 1 year ago

"This is wrong." But what's the proposed solution? Describe current system mathematically, then propose the solution.

scaleraster::L150 lapply(function(x) x / weighting) scales all rasters in rasterlist by the same amount, default 1.

Since you can only add 1 value, how is the user supposed to be able to use this to scale/weight multiple rasters differently? They've already been scaled to 1 (L149), so whatever the value of weighting is, it'll just divide all of the (max1) rasters by the same amount, so they'll all be max1/weighting. This is pointless?

Presumably the max value across all / of any raster in rasterlist needs to be 1. Therefore weighting COULD be a vector of values, 1 per n rasters, to divide by, with one of the weightings being 1 (i.e. no change to that raster), and the others being >1 (i.e. make those rasters smaller).

Might not be able to use lapply in L150 to do this, but cross that bridge.

Need to update docs to convey this.