APE.Med: Average Percent Error (APE) Estimation

View source: R/precision_functions.R

APE.MedR Documentation

Average Percent Error (APE) Estimation

Description

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

Usage

APE.Med(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

APE for APE calculation using the mean age as the basis APE calculation.

Other APE functions: APE()

Examples

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

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

#Another example with missing data
APE.Med(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(na.exclude(RedPorgy[, c(1, 2)]), 1,
 APE.Med))
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.Med))
df
mean(data.frame(df)$APE)

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