predictResources: predictResources

Description Usage Arguments Details Value See Also Examples

View source: R/predictResources.R

Description

Spatially stratified predictive modeling of resource suitability based on presence/absence samples.

Usage

1
predictResources(x, y, z, env.data = NULL)

Arguments

x

Object of class data.frame with environmental variables for presence samples.

y

Object of class data.frame with environmental variables for background samples.

z

Numeric or character vector with sample region labels. If missing, x is assumed as being one region.

env.data

Object of class RasterStack or RasterBrick with environmental variables in x and y.

Details

Modeling of resource suitability using animal movement data following the method of Remelgado et al (2017). Each unique label in z is kept for validation while the remaining samples are used for training. Then, the function evaluates the performance of this model reporting (internally) on the number of true positives, false positives and the number of cases for both presences and absences. Once all sample regions are used for validation, the reported values are summed and used to derive a F1-measure. The F1-measure is estimated as 2 * (P * R) / (P + R) where P is the Precision (ratio of true positives within the number of predicted values) and R is the Recall (ratio of true positives within the number of validation samples). As a consequence, rather than reporting on an average performance, the final performance assessment reported by predictResources depicts an objective picture on how the model performed among the different sets sample regions. This metric is provided for presences (x) and absences (y) separately informing on the stability of the model. This analysis is performed using a Random Forest model as provided within the train function of the caret package. The final predictive model is then derived with all samples. The output of the function is a list object consisting of:

Value

A list.

See Also

sampleMove labelSample backSample train

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
## Not run: 

 require(raster)

 # read remote sensing data
 file <- list.files(system.file('extdata', '', package="rsMove"), 'ndvi.tif', full.names=TRUE)
 r.stk <- stack(file)

 # read movement data
 data(shortMove)

 # observation time
 obs.time <- strptime(paste0(shortMove@data$date, ' ', shortMove@data$time),
 format="%Y/%m/%d %H:%M:%S")

 # remove redundant samples
 shortMove <- moveReduce(shortMove, r.stk, obs.time)$points

 # retrieve remote sensing data for samples
 rsQuery <- extract(r.stk, shortMove)

 # identify unique sample regions
 label <- labelSample(shortMove, r.stk, agg.radius=30)

 # select background samples
 bSamples <- backSample(shortMove, r.stk, label, sampling.method='pca')

 # derive model predictions
 out <- predictResources(rsQuery, bSamples@data, label, env.data=r.stk)


## End(Not run)

rsMove documentation built on July 1, 2020, 6:02 p.m.