Processing math: 100%
Skip to contents

Compute factor of 2 of observed and predicted data.

Usage

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

Arguments

obs

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

pred

A numeric vector, data.frame or data.table of predicted (model) data.

use

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

Value

The fraction of predictions within a factor of 2 of observations as a numeric.

Details

The function computes the fraction of predictions within a factor of 2 of observations according to:

FAC2=(R>0.5R<2)length(R)

with:

R=PO

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[, .(fb = fb(obs, mod, use = "complete.obs"))]
}