Description Usage Arguments Examples
This function interpolates the Solow & Beet model in a spatial format using a base grid and a sighting data frame. Unlike spat.SB
or spat.SB.par
, which both return the most likely year of extinction, spat.SB.probs
returns the probability of persistence for a cell for a given year of interest.
1 2 3 4 |
sightings |
Data frame of sightings with columns 'year', 'longitude', 'latitude', and 'sighting' which gives quality |
grid |
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 |
T.bound |
The year used as the test year for probability of persistence (different from in spat.SB); 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) |
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 44 | # EXAMPLE 1: NO INVALID SIGHTINGS
x <- makeSims(10,2)
x$sightings <- x$sightings[x$sightings$year<25,]
sb <- spat.SB.probs(x$sightings,x$grid$blank,k.nn=10,N.nn=15,T.bound=26,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>=25,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.probs(x$sightings,x$grid$layer.2,k.nn=10,N.nn=15,T.bound=26,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)
x$sightings <- x$sightings[x$sightings$year<25,]
sb <- spat.SB.probs(x$sightings,x$grid$blank,k.nn=10,N.nn=15,T.bound=26,model.num=2,parallel=TRUE,setCores=TRUE,cores=4)
sb2 <- spat.SB.probs(x$sightings,x$grid$blank,k.nn=10,N.nn=15,T.bound=26,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>=25,main='True Extinction Date')
plot(sb[[1]], main='100 Reps')
plot(sb[[2]], main='Variance')
plot(sb2[[1]], main='Adptive')
plot(sb2[[2]], main='Variance')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.