Performance: Performance metrics

Description Usage Arguments Details Value Examples

Description

Calculates performance metrics for regression and classification models..

Usage

1
2
Performance(..., samples = NULL, regression = TRUE, threshold = NULL,
  rnd = 3)

Arguments

...

objects of class inla with computed fitted marginals.

samples

NULL or list with resamples. If NULL, performance metrics are calculated using the entaire dataset. If list, each element should be a vector with indexes to train the model. Indexes out of the vector (out-of-bag samples) are used to calculate performance metrics.

regression

logical. If TRUE (default), the RMSE and R2 are calculated. If FALSE, the following mwtrics are calculated: accuracy, sensitivity, specificity, Positive Predictive Value (PPV) and Negative Predictive Value (NPV).

threshold

When regression = FALSE, the threshold to assign class probabilities to classes is the value that maximizes max(sensitivities + specificities) (see details). Class probabilities below the threshold are assigned to min(y), where y is the predicted variable (class probabilities above the threshold are assigned to the other class). If threshold is provided, it overrides the calculated threshold; it should be a number x such that 0 < x < 1.

rnd

integer indicating the number of decimal places to be used.

Details

When regression = FALSE, the threshold is calculated with the Youoden's algorithm, using the pROC::coords function.

Value

vector or matrix with performance metrics.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(sp)

mod1 <- inla(aan ~ f(id, model = 'bym', graph = sp.adj),
             family = 'poisson', data = spn, E = eaan,
             control.predictor=list(link = 1, compute = TRUE))

mod2 <- inla(aan ~ shvn + f(id, model = 'bym', graph = sp.adj),
             family = 'poisson', data = spn, E = eaan,
             control.predictor=list(link = 1, compute = TRUE))
RMSE(mod1, mod2, observed = spn$aan / spn$eaan)

oswaldosantos/INLAOutputs documentation built on May 24, 2019, 5 p.m.