Processing math: 100%
Skip to contents

Compute the Normalised Mean Square Error of observed and predicted data.

Usage

nmse(obs, pred, use = "everything")

Arguments

obs

A numeric vector, data.frame or data.table.

pred

A numeric vector, data.frame or data.table.

use

An optional character string giving a method for computing NMSE in the presence of missing values. This must be one of the strings "everything" or "complete.obs".

Value

The Normalized Mean Square Error of input data as a numeric.

Details

The function computes the Normalised Mean Square Error (NMSE) of obs and pred according to the following definition: NMSE=¯(OP)2¯O¯P

If use is "everything", NAs will propagate, i.e. a resulting value will be NA whenever one of its contributing observation is NA. If use is "complete.obs" then missing values are handled by casewise deletion and if there are no complete cases, that gives an error.

Examples

if (FALSE) {
validationData[, .(nmse = nmse(obs, mod, use = "complete.obs"))]
}