APE: Average Percent Error (APE) Estimation

View source: R/precision_functions.R

APER Documentation

Average Percent Error (APE) Estimation

Description

APE calculates the average percent error (APE) for multiple age determinations on the same fish. This function use the mean of the observed ages as the basis for APE calculation.

Usage

APE(x)

Arguments

x

Numeric vector of independent age determinations from a single fish.

Value

The APE of the vector of ages x from an individual fish.

See Also

Other APE functions: APE.Med()

Examples

# Example giving an estimate with an APE of 0.0
APE(c(1, 1, 1))

# Example using missing data
APE(c(1, NA, 2))

# Another example with missing data
APE(c(3, 5, 3, 4, NA, 6))

#Example showing how APE.Med can be used to calculate mean APE for many fish
w <- seq(1, 10, 1)
x <- seq(2, 11, 1)
y <- seq(3, 12, 1)
z <- seq(4, 13, 1)
df <- data.table::rbindlist(apply(data.frame(w, x, y, z), 1, APE)); df
mean(data.frame(df)$APE)
# Example with RedPorgy data
data(RedPorgy)
df <- data.table::rbindlist(apply(na.exclude(RedPorgy[, c(1, 2)]), 1,
 APE))
df
mean(data.frame(df)$APE)

ballengerj/FishyR documentation built on June 17, 2022, 10:33 p.m.