rescale_classic | R Documentation |
Rescale inputs to prepare data for habitat mask to be used.
rescale_classic(X, ext, s.st, site, hab_mask)
X |
Either a matrix or array representing the coordinates of traps in UTMs. An array is used when traps are clustered over a survey area. |
ext |
An |
s.st |
A matrix of starting activity center coordinates. This is
returned from |
site |
Either |
hab_mask |
A matrix or arary output from |
This function is only meant to be used when habitat masking is
incorporated into the model. The functions properly rescales inputs based on
the dimensions of the habitat mask. Note that the pixelWidth
needs to
be included as an input in the model after inputs are rescaled to correctly
estimate the scaling parameter (i.e., 'sigma').
X
Rescaled trap coordinates
ext
Rescaled Extent
object from the raster
package.
s.st
A matrix of rescaled starting activity center coordinates.
Daniel Eacker
mask_polygon
, mask_raster
# simulate a single trap array with random positional noise x <- seq(-800, 800, length.out = 5) y <- seq(-800, 800, length.out = 5) traps <- as.matrix(expand.grid(x = x, y = y)) # add some random noise to locations traps <- traps + runif(prod(dim(traps)),-20,20) mysigma = 300 # simulate sigma of 300 m mycrs = 32608 # EPSG for WGS 84 / UTM zone 8N # create grid Grid = grid_classic(X = traps, crs_ = mycrs, buff = 3*mysigma, res = 100) # create polygon to use as a mask library(sf) poly = st_sfc(st_polygon(x=list(matrix(c(-1765,-1765,1730,-1650,1600,1650, 0,1350,-800,1700,-1850,1000,-1765,-1765),ncol=2, byrow=TRUE))), crs = mycrs) # make simple plot par(mfrow=c(1,1)) plot(Grid$grid, pch=20) points(traps, col="blue",pch=20) plot(poly, add=TRUE) # create habitat mask hab_mask = mask_polygon(poly = poly, grid = Grid$grid, crs_ = mycrs, prev_mask = NULL) # simulate SCR data data3d = sim_classic(X = traps, ext = Grid$ext, crs_ = mycrs, sigma_ = mysigma, prop_sex = 1, N = 200, K = 4, base_encounter = 0.25, enc_dist = "binomial", hab_mask = hab_mask, setSeed = 50) # generate initial activity center coordinates for 2D trap array without #habitat mask s.st3d = initialize_classic(y=data3d$y, M=500, X=traps, ext=Grid$ext, hab_mask = hab_mask) # build rescaled constants list for 2D trap array constList = rescale_classic(X = traps, ext = Grid$ext, s.st = s.st3d, site = NULL, hab_mask = hab_mask) # inspect list str(constList)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.