errorSims: Simulations, with error

Description Usage Arguments Examples

View source: R/makeSims.R

Description

Produces simulations of extinction dates and sightings on a known landscape with mixed-certainty, mixed-accuracy data

Returns a list of two objects: sightings (data frame of sightings with columns "year", "longitude", "latitude", "sighting", and "real") and grid (raster onto which to interpolate your results)

Usage

1
errorSims(n = 10, pts = 1, ipts = 2, p = 0.1)

Arguments

n

Dimension of simulated landscape (nxn grid)

pts

Number of valid sightings per year

ipts

Number of invalid points total (any year)

p

Proportion of valid sightings recorded as uncertain

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
x <- errorSims(n=10,pts=2,ipts=5,p=0.2)

ole <- spat.OLE(x$sightings[,1:4], x$grid[[2]], k.nn=7, N.nn=10, randomize=TRUE, adaptive=FALSE, reps=100, qualitycontrol = FALSE)
ole.qc <- spat.OLE(x$sightings[,1:4], x$grid[[2]], k.nn=7, N.nn=10, randomize=TRUE, adaptive=FALSE, reps=100, qualitycontrol = TRUE)
sb1 <- spat.SB(x$sightings[,1:4], x$grid[[2]], k.nn=5, N.nn=7, randomize=TRUE, reps=100, T.bound=60, model.num=1)
sb2 <- spat.SB(x$sightings[,1:4], x$grid[[2]], k.nn=5, N.nn=7, randomize=TRUE, reps=100, T.bound=60, model.num=2)



par(mfrow=c(1,1))
plot(r)
points(x$sightings[,1:2],col=ifelse(x$sightings$real==0,"blue",ifelse(x$sightings$sighting==2,"red","black")),pch=16,cex=1.3)
par(mfrow=c(2,2))
plot(ole$Mean.OLE)
plot(ole.qc$Mean.OLE)
plot(sb1$Mean.SB)
plot(sb2$Mean.SB)

cjcarlson/spatExtinct documentation built on Aug. 29, 2018, 10:31 p.m.