Accuracy: sAccuracy

Description Usage Arguments Details Value See Also Examples

View source: R/Accuracy.R

Description

sAccuracy

Usage

1
Accuracy(obs, pred, na.rm = FALSE, response = c("discrete", "continuous"), ...)

Arguments

obs

A numeric vector or matrix, the observed data.

pred

A numeric vector or matrix with predictions, in the same order as obs.

na.rm

(optional) Logical (default FALSE). TRUE removes all NA rows in pred or obs jointly (list-wise removal).

response

(optional) A string (default "discrete"), data format. Can also be "continuous". Can be abbreviated. If "discrete", will apply an cr_argmax before computing accuracy.

...

more arguments to be passed on to the fitting functions, see e.g. loglikelihood()

Details

Note. Accuracy corrects for perfect chance. Perfect chance predictions for discrete responses (e.g. 0.50 for binary responses) yield chance-level accuracy (50 %), rather than zero accuracy.

Value

The percent of accurate predictions between 0 and 1, inclusive, where 1 indicates 100

See Also

Other goodness of fit functions: APE(), MAPE(), MDAPE(), MSE(), RMSE(), SSE(), gof()

Examples

1
2
3
4
Accuracy(obs = c(1,0,0), pred = c(1,1,1))        # 33% accuracy

# Note how it deals with perfect-chance predictions (0.5)
Accuracy(obs = c(1,0,0), pred = c(1,0.5,0.5))        # 66% accuracy

JanaJarecki/cognitiveutils documentation built on Sept. 9, 2020, 9:11 a.m.