spat.OLE.2: Spatial OLE Interpolation

Description Usage Arguments Examples

Description

This function interpolates the optimal linear estimator (OLE) in a spatial format using a base grid and a sighting data frame. Defaults set by sensitivity analysis presented in Carlson et al. 2018

Usage

1
2
3
4
spat.OLE.2(sightings, grid, k.nn = 7, N.nn = 12, randomize = TRUE,
  reps = 100, parallel = FALSE, setCores = TRUE, cores = 1,
  adaptive = FALSE, epsilon = 0.001, qualitycontrol = FALSE,
  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.

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.

qualitycontrol

Eliminates all uncertain sightings from the dataset ("sighting">1).

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)
ole <- spat.OLE(x$sightings,x$grid$blank)
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,cex=1.5)
plot(x$grid$real,main='True Extinction Date')
plot(ole[[1]], main='Estimate')
plot(ole[[2]], main='Variance')

# EXAMPLE 2: MIXED VALIDITY SIGHTINGS

x <- errorSims(n=10,pts=2,ipts=5,p=0.1)
ole <- spat.OLE(x$sightings,x$grid$layer.2,qualitycontrol=TRUE)
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(ole[[1]], main='Estimate')
plot(ole[[2]], main='Variance')

# EXAMPLE 3: ADAPTIVE RESAMPLING

x <- makeSims(10,2)
ole <- spat.OLE(x$sightings,x$grid$blank,parallel=TRUE,setCores=TRUE,cores=4)
ole2 <- spat.OLE(x$sightings,x$grid$blank,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,cex=1.5)
plot(x$grid$real,main='True Extinction Date')
plot(ole[[1]], main='100 Reps')
plot(ole[[2]], main='Variance')
plot(ole2[[1]], main='Adaptive')
plot(ole2[[2]], main='Variance')

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