random_density: Create a random density

View source: R/random_density.R

random_densityR Documentation

Create a random density

Description

The function random_density creates a random density in the study area region_obj. The random density consists of the creation of a number of hotspots nb_simu randomly generated amplitude, size (sigma) and location. The function retruns a density object.

Usage

random_density(
  region_obj,
  grid_m,
  density_base,
  crs,
  amplitude,
  sigma,
  nb_simu
)

Arguments

region_obj

region object. Region create with the dsims package.

grid_m

numeric. Length of the grid (side length of a square in m).

density_base

numeric. Density in each cell.

crs

numeric. Coordinate system.

amplitude

numeric. Minimal and maximal height of the hotspot at its center.

sigma

numeric. Minimal and maximal value giving the scale parameter for a gaussian decay.

nb_simu

numeric. Number of hotspot to be created.

Details

For the creation of the baseline density (homogeneous density on the study area) to which this function add randomly hotspot on the study area, the make.density function of the dsims package is used. Then, baseline density density_base as well as the desired grid size to use on the study area grid_m are requested.

Value

density object. The map with the densities for each cell.

Examples


library(dsims)

# Create the region object with the make.region function of the dsims package
shapefile.name <- system.file("extdata", "StAndrew.shp", package = "dssd")
region <- make.region(region.name = "St Andrews bay",
                      shape = shapefile.name,
                      units = "m")

# Create a random density on the study area (with a 500m square grid) with a baseline density of 10.
# 15 hotspots added with random amplitudes chosen between -5 and 5 
# and different sizes (`sigma`) chosen between 2000 and 6000.  

density <- random_density(region_obj = region,
                          grid_m = 500,
                          density_base = 10,
                          crs = 2154,
                          amplitude = c(-5, 5),
                          sigma = c(2000, 6000),
                          nb_simu = 15)

# plot(density)


maudqueroue/intercali documentation built on Oct. 8, 2022, 2:09 p.m.