modelsValid: Generate validation statistics for a list of models; a...

Description Usage Arguments Value See Also Examples

View source: R/Models.R

Description

Given a list of models, this function runs validate on each. See details for a description of how the data is encapsulated for return.

Usage

1
modelsValid(models, valid, ...)

Arguments

models

is either a list of model objects on which to find error statistics, or a single model to evaluate.

valid

a validation dataset with which to test the accuracy of the models provided.

...

(optional) other parameters to pass to classAcc and/or npelVIMP.

Value

As with modelAccs, this function returns different values depending on whether the model is categorical or continuous. For categorical data it returns a named list of accuracy statistics:

For continuous data:

See Also

classAcc for more on the computation of continuous and categorical accuracies, and modelAccs for the corresponding function that will compute accuracy based on the dataset used for model building.

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
# With categorical data
data ('siteData')
gen <- sample(1:nrow(siteData),floor(nrow(siteData)*0.5))
modelRun <- generateModels(data = siteData[sort(gen),],
                           modelTypes = suppModels,
                           x = c('brtns','grnns','wetns','dem','slp','asp','hsd'),
                           y = 'ecoType',
                           grouping = ecoGroup[['identity','transform']],
                           echo = FALSE)
valid <- siteData[-gen,]
valid$ecoType <- as.factor(ecoGroup[['identity','transform']][valid$ecoType])
mV <- modelsValid(modelRun,valid)
str(mV,2)

# With continuous data
gen <- sample(1:nrow(siteData),floor(nrow(siteData)*0.5))
modelRun <- generateModels(data = siteData[sort(gen),],
                           modelTypes = contModels,
                           x = c('brtns','grnns','wetns','dem','slp','asp','hsd'),
                           y = 'easting',
                           echo = FALSE)
valid <- siteData[-gen,]
mV <- modelsValid(modelRun,valid)
str(mV,2)

henkelstone/NPEL.Classification documentation built on May 17, 2019, 3:42 p.m.