Skip to contents

Compute fractional bias of observed and predicted data.

Usage

fb(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 fractional bias in the presence of missing values. This must be one of the strings "everything" or "complete.obs".

Value

The Fractional Bias of input data as a numeric.

Details

This function compute the fractional bias of observed and predicted data, according to the following definition:

$$ \mathrm{FB} = \frac{\overline{P} - \overline{O}}{0.5 * (\overline{P} + \overline{O})} $$

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) {
# validtionData is a data.table with obs and mod columns:
validationData[, .(fb = fb(obs, mod, use = "complete.obs"))]
}