make.density: Creates a Density object

Description Usage Arguments Value Author(s) See Also Examples

View source: R/Class.Constructors.R

Description

The user has the option to create a grid describing the density of the objects and pass this in giving the x and y spacings used in the creation of this grid. Alternatively the user can specify a constant density and x, y spacings and this grid will be generated automatically. The user may also supply a mgcv gam object and x, y spacings and the density grid will be created from these.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
make.density(
  region.obj = make.region(),
  density.surface = list(),
  x.space = 5,
  y.space = NULL,
  buffer = numeric(0),
  constant = numeric(0),
  density.gam = NULL,
  dsm = NULL,
  formula = NULL
)

Arguments

region.obj

the Region object in which the density grid will be created

density.surface

Object of class list; list of data.frames with the columns x, y and density. There must be one data.frame for each strata.

x.space

the intervals in the grid in the x direction

y.space

the intervals in the grid in the y direction

buffer

the width of the buffer region for generating the density grid. If not supplied DSsim will use the maximum value provided for the x.space or y.space.

constant

a value describing a constant density across the surface. If not supplied a default value of 1 is used for all strata.

density.gam

gam object created using mgcv with only x and y as explanatory covariates.

dsm

not currently implemented

formula

not currently implemented

Value

object of class Density

Author(s)

Laura Marshall

See Also

make.region

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
# A simple density surface with a constant value of 1 can be created within a rectangular 
# region using 
# the default values:
density <- make.density()
plot(density)
plot(make.region(), add = TRUE)
  
# The example below shows hot to add high and low point to the density surface                   
## Not run: 
pop.density <- make.density(region.obj = region, x.space = 10, 
 y.space = 10, constant = 0.5) 
 
pop.density <- add.hotspot(pop.density, centre = c(50, 200), 
 sigma = 100, amplitude = 0.1)
pop.density <- add.hotspot(pop.density, centre = c(500, 700), 
 sigma = 900, amplitude = 0.05)
pop.density <- add.hotspot(pop.density, centre = c(300, 100), 
 sigma = 100, amplitude = -0.15)

#New plot features
plot(pop.density)
plot(region, add = TRUE)

#Block style plotting
plot(pop.density, contours = FALSE, style = "blocks")
plot(region, add = TRUE)


## End(Not run)

DSsim documentation built on March 26, 2020, 7:39 p.m.