Fpb: Fpb measure of model accuracy with weighting

fpbR Documentation

Fpb measure of model accuracy with weighting

Description

This function calculates Li and Guo's Fpb measure of model accuracy for test presences and randomly located background sites.

Usage

fpb(
  pres,
  bg,
  thresholds = seq(0, 1, by = 0.01),
  presWeight = rep(1, length(pres)),
  bgWeight = rep(1, length(bg)),
  na.rm = FALSE,
  tr = NULL,
  ...
)

Arguments

pres

Numeric vector. Predictions at presence sites.

bg

Numeric vector. Predictions at absence/background sites.

thresholds

Numeric value or numeric vector within the range [0, 1]. Threshold value(s) at which to calculate Fpb.

presWeight

Numeric same length as pres. Weights for presence predictions. The default is to assign each presence a weight of 1.

bgWeight

Numeric same length as bg. Weights for background predictions. The default is to assign each presence a weight of 1.

na.rm

Logical. If TRUE remove any NAs in predictions at presences and/or absences before calculation. If NAs occur but are not removed then the output will be NA.

tr

Same as thresholds. Deprecated, but included for backwards compatibility.

...

Other arguments (unused).

Value

Numeric.

References

Li, W. and Guo, Q. 2013. How to assess the prediction accuracy of species presence-absence models without absence data? Ecography 36:788-799.

See Also

aucWeighted, contBoyce, evaluate

Examples

pres <- seq(0.5, 1, by=0.1)
bg <- seq(0, 1, by=0.01)
thresholds <- seq(0, 1, by=0.1)

# unweighted
f1 <- fpb(pres, bg, thresholds)

# weighted (weight presences with low predictions more)
presWeight <- c(1, 1, 1, 0.5, 0.5, 0.5)
f2 <- fpb(pres, bg, thresholds, presWeight=presWeight)

# weighted (weight presences with high predictions more)
presWeight <- c(0.5, 0.5, 0.5, 1, 1, 1)
f3 <- fpb(pres, bg, thresholds, presWeight=presWeight)

# weight presences and absences
bgWeight <- sqrt(bg)
f4 <- fpb(pres, bg, thresholds, presWeight=presWeight, bgWeight=bgWeight)

plot(thresholds, f1, type='b', xlab='Threshold', ylab='fpb', ylim=c(0, 1.5))
points(thresholds, f2, type='b', pch=2)
points(thresholds, f3, type='b', pch=3)
points(thresholds, f4, type='b', pch=4)
legend('topright', inset=0.01,
   legend=c('no weights', 'high presences upweighted',
      'low presences upweighted', 'pres and bg weighted'),
   pch=1:4)

adamlilith/enmSdm documentation built on Jan. 6, 2023, 11 a.m.