Skip to contents

Determine the threshold using Locally estimated or weighted Scatterplot Smoothing.

Usage

search_threshold(
  data,
  outliers,
  sp = NULL,
  plot = FALSE,
  var_col = NULL,
  warn = FALSE,
  verbose = FALSE,
  colors = c("darkblue", "orange"),
  useropt = 0.8
)

Arguments

data

Dataframe. The reference dataframe were absolute outliers will be removed.

outliers

datacleaner. Datacleaner output with outliers flagged in multidetect function.

sp

string. Species name or index if multiple species are considered during outlier detection.

plot

logical. to show plot of loess fitted function with minima and maxima (optimal threshold and clean data).

var_col

string. A column with species names if dataset for species is a dataframe not a list. See pred_extract for extracting environmental data.

warn

logical. If TRUE, warning on whether absolute outliers obtained at a low threshold is indicated. Default TRUE.

verbose

logical. If true, then messages about the outlier flagging will be displayed.

colors

vector. Colors for both the true data and the loess fitted data lines.

useropt

numeric The default is 0.8, to ensure that the loess maximum does not fall below user optima if it is not properly searched using the loess model.

Value

Returns numeric of most suitable threshold at maxima of the loess smoothing.