Skip to contents

This function processes market data to identify outliers in the price per kilogram. It selects necessary columns, unnests market data, and calculates the price per kilogram. The data is grouped by gear type, market group, and species in the market. Outliers are detected using the alert_outlier function, which applies the LocScaleB method for outlier detection based on the Median Absolute Deviation (MAD) method. The k parameter is used within the MAD method to determine the extension of bounds for outlier detection.

Usage

validate_market(data = NULL, k_max_price = NULL)

Arguments

data

A data frame containing market information. Expected to include columns _id, gear_type, and market.

k_max_price

Nonnegative constant used in the LocScaleB function, based on the MAD method, to determine the extension of bounds for outlier detection in price per kilogram. Common values are 2, 2.5, and 3.

Value

A data frame with the original market data, additional columns for detected outliers, and nested market data.

Examples

if (FALSE) { # \dontrun{
# Assuming you have a data frame `market_data` with the necessary structure:
validated_market <- validate_market(data = market_data, k_max_price = 100)
} # }