spat.SB: Spatial Solow & Beet Estimator

Description Usage Arguments Examples

Description

This function interpolates the Solow & Beet model in a spatial format using a base grid and a sighting data frame. The Solow & Beet method uses a Bayesian model to evaluate the extinction date of a species, using mixed certainty datsets. The spat.SB function can be used to implement model 1 (which assumes invalid sightings aren't generated until after a species is extinct) or model 2 (which assumes that valid and invalid sightings could be mixed before the true extinction date). Both models treat valid and invalid sightings as separate processes, and make inference on the likelihood of the extinction date based on what sighting rates would have generated the dataset in hand.

Usage

1
2
3
4
spat.SB(sightings, grid, k.nn = 5, N.nn = 10, T.bound, model.num,
  prior = "Unif", gamma.exp = 6, randomize = TRUE, reps = 100,
  parallel = FALSE, setCores = FALSE, cores = 1, adaptive = FALSE,
  epsilon = 0.001, verbose = FALSE)

Arguments

sightings

Data frame of sightings with columns "year", "longitude", "latitude", and "sighting" which gives quality. Long/lats must be given in decimal coordinates. Year records the date of a sighting (though it could be any continuous units of time) and sighting records the quality of the sighting. A "1" is a certain sighting (guaranteed valid) while a "2" or anything higher is uncertain. Uncertain sightings are not necessarily invalid, and researchers may want to differentiate within uncertain sightings by quality. We typically use three categories: 1 is physical evidence or certain expert sightings, 2 are plausible expert sightings, and 3 are dubious or novice sightings without strong evidence.

grid

Blank raster onto which to interpolate your results.

k.nn

The k nearest neighbors to pull (nonrandom method) or the k points to sample in every iteration from the N nearest neighbors (random method)

N.nn

The N nearest neighbors to pull from in the randomized method. N must be greater than k.

T.bound

The outer bound the model runs to; MUST be later than (T_last + increment2*(T_last-T_first))

model.num

Model 1 or 2 from Solow & Beet?

prior

Options are uniform ("Unif"), linear ("Tri"), or negative exponential ("Exp").

gamma.exp

Gamma for exponential prior. Defaults to 6 from Solow & Beet study.

randomize

Implement the random method

reps

How many iterations are used in the randomized method

parallel

Do you want to parallelize the function?

setCores

Do you want to manually set the number of cores to run the function on? Defaults to FALSE, and runs the function on all but one core detected automatically. Adaptive sampling and parallel processing cannot be turned on at the same time, and parallel supercedes adaptive.

cores

Manually specify how many cores.

adaptive

Do you want to run the model with adaptive estimation? Uses epsilon argument to set a convergence threshold, and after the first 10 runs in a cell, waits for the difference in the running mean before and after adding an iteration (delta) to drop below the convergence threshold (epsilon). Adaptive sampling and parallel processing cannot be turned on at the same time, and parallel supercedes adaptive.

epsilon

Convergence threshold for adaptive estimation.

verbose

Incredibly stupid, don't turn on (dead dove do not eat)

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
31
32
33
34
35
36
37
38
39
40
41
42
43
# EXAMPLE 1: NO INVALID SIGHTINGS

x <- makeSims(10,2)
sb <- spat.SB(x$sightings,x$grid$blank,T.bound=55,model.num=2)
rbPal <- colorRampPalette(c('blue','red'))
x$sightings$Col <- rbPal(10)[as.numeric(cut(x$sightings[,3],breaks = 10))]
par(mfrow=c(2,2))
plot(x$grid$blank,main='Sightings')
points(x$sightings[,c(1:2)], col=x$sightings$Col,pch=16)
plot(x$grid$real,main='True Extinction Date')
plot(sb[[1]], main='Estimate')
plot(sb[[2]], main='Variance')


# EXAMPLE 2: MIXED VALIDITY 

x <- errorSims(n=10,pts=2,ipts=5,p=0.1)
sb <- spat.SB(x$sightings,x$grid$layer.2,T.bound=55,model.num=2)
rbPal <- colorRampPalette(c('blue','red'))
x$sightings$Col <- rbPal(10)[as.numeric(cut(x$sightings[,3],breaks = 10))]
par(mfrow=c(2,2))
plot(x$grid$layer.2,main='Sightings')
points(x$sightings[x$sightings$real==1,c(1:2)], col=x$sightings$Col,pch=16,cex=1.5)
points(x$sightings[x$sightings$real==0,c(1:2)], col='black',pch=19,cex=1.5)
plot(x$grid$layer.1,main='True Extinction Date')
plot(sb[[1]], main='Estimate')
plot(sb[[2]], main='Variance')

# EXAMPLE 3: ADAPTIVE RESAMPLING

x <- makeSims(10,2)
sb <- spat.SB(x$sightings,x$grid$blank,T.bound=55,model.num=2,parallel=TRUE,setCores=TRUE,cores=4)
sb2 <- spat.SB(x$sightings,x$grid$blank,T.bound=55,model.num=2,adaptive=TRUE,epsilon=0.005)
rbPal <- colorRampPalette(c('blue','red'))
x$sightings$Col <- rbPal(10)[as.numeric(cut(x$sightings[,3],breaks = 10))]
par(mfrow=c(3,2))
plot(x$grid$blank,main='Sightings')
points(x$sightings[,c(1:2)], col=x$sightings$Col,pch=16)
plot(x$grid$real,main='True Extinction Date')
plot(sb[[1]], main='100 Reps')
plot(sb[[2]], main='Variance')
plot(sb2[[1]], main='Adaptive')
plot(sb2[[2]], main='Variance')

cjcarlson/spatExtinct documentation built on May 25, 2019, 3:26 p.m.