detect_outliers: Detect outliers given a fitted model

Description Usage Arguments Value Author(s)

View source: R/detect-outliers.R

Description

This function uses a trained model stored as antrendbing_model_fit object to derive the prediction interval (PI) for a given alpha threshold; it classifies as outliers every data point falling outside the interval.

Usage

1
detect_outliers(data, model, alpha = 0.05, ...)

Arguments

data

a data.frame containing data for which predictions are to be derived

model

a fitted model as trending::trending_model_fit object; this can be obtained by running trending::fit() on a trending::trending_model.

alpha

the alpha threshold to be used for prediction intervals, defaulting to 0.05, i.e. 95% prediction intervals are derived

...

additional arguments passed to the underlying model prediction function

Value

A data.frame containing the original data, the mean model predictions, the lower and upper bounds of the prediction interval, a variable outlier indicating which point is an outlier as a logical, and the classification of data points as a factor with values normal for points within the PI, increase for outliers above the PI, and decrease for outliers below the PI.

Author(s)

Thibaut Jombart, Dirk Schumacher


reconhub/epichange documentation built on April 8, 2021, 3:45 a.m.