Closed khufkens closed 11 months ago
Sampler is optional
# From BT docs on createPrior density = function(par){ d1 = dunif(par[1], -2,6, log =TRUE) d2 = dnorm(par[2], mean= 2, sd = 3, log =TRUE) return(d1 + d2) } sampler = function(n=1){ d1 = runif(n, -2,6) d2 = rnorm(n, mean= 2, sd = 3) return(cbind(d1,d2)) } prior <- createPrior(density = density, sampler = sampler, lower = c(-10,-20), upper = c(10,20), best = NULL)
Random sampling within an sf polygon
sf
h = st_sample(sfc, 100, type = "hexagonal")
Can probably be combined to form a density function (however the third parameter is not spatially defined so needs a normal setup).
Can also be done by constraining the objective function. In this case memoise needs to be used to ensure speed in calculation or provisioning of the spatial mask.
memoise
Sampler is optional
Random sampling within an
sf
polygonCan probably be combined to form a density function (however the third parameter is not spatially defined so needs a normal setup).