extractFromModel: Extrac objects from lists returned by function 'mopaTrain'

Description Usage Arguments Details Value Author(s) Examples

View source: R/extractFromModel.R

Description

Extract values returned by function mopaTrain

Usage

1
2
extractFromModel(models, value = c("model", "auc", "kappa", "tss",
  "fold.models", "ObsPred"))

Arguments

models

Object returned by mopaTrain.

value

Any character of the following: "model", "auc", "kappa", "tss", "fold.models", "ObsPred"

Details

ObsPred allows to calculate further accuracy measures.

Value

Depending on the specified value:

"model"

fitted model using all data for training

"auc"

AUC statistic in the cross validation

"kappa"

kappa statistic in the cross validation

"tss"

true skill statistic in the cross validation

"fold.models"

fitted model with partitioned data

"ObsPred"

Observed and prediced (cross model prediction) values

Author(s)

M. Iturbide

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
## Load presence data
data(Oak_phylo2)

## Load Climate data
destfile <- tempfile()
data.url <- "https://raw.githubusercontent.com/SantanderMetGroup/mopa/master/data/biostack.rda"
download.file(data.url, destfile)
load(destfile, verbose = TRUE)

## Spatial reference
r <- biostack$baseline[[1]]

## Create background grid
bg <- backgroundGrid(r)
## Generate pseudo-absences
RS_random <-pseudoAbsences(xy = Oak_phylo2, background = bg$xy, 
                           exclusion.buffer = 0.083*5, prevalence = -0.5, kmeans = FALSE)
## Model training
fittedRS <- mopaTrain(y = RS_random, x = biostack$baseline, 
                      k = 10, algorithm = "glm", weighting = TRUE)
## Extract fitted models
mods <- extractFromModel(models = fittedRS, value = "model")
## Extract observed and predicted values
ObsPred <- extractFromModel(models = fittedRS, value = "ObsPred")

mopa documentation built on May 2, 2019, 6:47 a.m.