Description Usage Arguments Details Value Author(s) Examples
View source: R/extractFromModel.R
Extract values returned by function mopaTrain
1 2 | extractFromModel(models, value = c("model", "auc", "kappa", "tss",
"fold.models", "ObsPred"))
|
models |
Object returned by |
value |
Any character of the following: "model", "auc", "kappa", "tss", "fold.models", "ObsPred" |
ObsPred
allows to calculate further accuracy measures.
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 |
M. Iturbide
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.