simLgcp: Simulate a log-Gaussian Cox process

Description Usage Arguments Value Examples

View source: R/simLgcp.R

Description

Give covariates and model parameters, simulates a log-Gaussian Cox process

Usage

1
2
3
4
	simLgcp(param, covariates=NULL, betas=NULL, 
	offset=NULL,
	  rasterTemplate=covariates[[1]], n=1, ...)
	simPoissonPP(intensity)

Arguments

param

A vector of named model parameters with, at a minimum names range and shape (see Details), and optionally variance (defaults to 1). For Geometric Anisotropy add anisoRatio and either anisoAngleDegrees or anisoAngleRadians

covariates

Either a raster stack or list of rasters and SpatialPolygonsDataFrames (with the latter having only a single data column).

betas

Coefficients for the covariates

offset

Vector of character strings corresponding to elements of covariates which are offsets

rasterTemplate

Raster on which the latent surface is simulated, defaults to the first covariate.

n

number of realisations to simulate

...

additional arguments, see RFsimulate.

intensity

Raster of the intensity of a Poisson point process.

Value

A list with a events element containing the event locations and a raster element containing a raster stack of the covariates, spatial random effect, and intensity.

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
mymodel = c(mean=-0.5, variance=1, 
				range=2, shape=2)

myraster = raster(nrows=15,ncols=20,xmn=0,xmx=10,ymn=0,ymx=7.5)

# some covariates, deliberately with a different resolution than myraster
covA = covB = myoffset = raster(extent(myraster), 10, 10)
values(covA) = as.vector(matrix(1:10, 10, 10))
values(covB) = as.vector(matrix(1:10, 10, 10, byrow=TRUE))
values(myoffset) = round(seq(-1, 1, len=ncell(myoffset)))

myCovariate = list(a=covA, b=covB, offsetFooBar = myoffset)

myLgcp=simLgcp(param=mymodel, 
	covariates=myCovariate, 
	betas=c(a=-0.1, b=0.25), 
	offset='offsetFooBar',
	rasterTemplate=myraster)

plot(myLgcp$raster[["intensity"]], main="lgcp")
points(myLgcp$events)

myIntensity = exp(-1+0.2*myCovariate[["a"]])
myPoissonPP = simPoissonPP(myIntensity)[[1]]
plot(myIntensity, main="Poisson pp")
points(myPoissonPP)

geostatsp documentation built on Oct. 5, 2021, 9:10 a.m.