Skip to contents

[Stable]

Add columns flagging sites that represent possible statistical outliers.

Usage

Flag_NormalApprox(dfAnalyzed, vThreshold = NULL)

Arguments

dfAnalyzed

data.frame where flags should be added.

vThreshold

vector of 4 numeric values representing lower and upper threshold values. All values in strColumn are compared to vThreshold using strict comparisons. Values less than the lower threshold or greater than the upper threshold are flagged as -1 and 1 respectively. Values equal to the threshold values are set to 0 (i.e. not flagged). If NA is provided for either threshold value it is ignored, and no values are flagged based on the threshold. NA and NaN values in strColumn are given NA flag values.

Value

data.frame with "Flag" column added

Details

This function flags sites based on the funnel plot with normal approximation analysis result as part of the GSM data model (see vignette("DataModel")).

Data Specification

Flag_NormalApprox is designed to support the input data (dfAnalyzed) from Analyze_NormalApprox function. At a minimum, the input data must have a GroupID column and a column of numeric values (identified by the strColumn parameter) that will be compared to the specified thresholds (vThreshold) to calculate a new Flag column. In short, the following columns are considered:

  • GroupID - Group ID (required)

  • GroupLevel - Group Type

  • strColumn - A column to use for Thresholding (required)

  • strValueColumn - A column to be used for the sign of the flag (optional)

Examples

dfTransformed <- Transform_Rate(analyticsInput)

# Binary
dfAnalyzed <- Analyze_NormalApprox(dfTransformed, strType = "binary")
#> `OverallMetric`, `Factor`, and `Score` columns created from normal
#> approximation.
dfFlagged <- Flag_NormalApprox(dfAnalyzed, vThreshold = c(-3, -2, 2, 3))

# Rate
dfAnalyzed <- Analyze_NormalApprox(dfTransformed, strType = "rate")
#> `OverallMetric`, `Factor`, and `Score` columns created from normal
#> approximation.
dfFlagged <- Flag_NormalApprox(dfAnalyzed, vThreshold = c(-3, -2, 2, 3))