Add columns flagging sites that represent possible statistical outliers when the Poisson statistical method is used.
Arguments
- dfAnalyzed
data.frame where flags should be added.
- vThreshold
Vector of 4 numeric values representing lower and upper threshold values. All values in the
Score
column are compared tovThreshold
using strict comparisons. Values less than the lower thresholds or greater than the upper thresholds are flagged. 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 thresholds. NA and NaN values inScore
are given NA flag values.
Value
data.frame
with one row per site with columns: GroupID
, Numerator
, Denominator
, Metric
, Score
, PredictedCount
, Flag
Details
This function flags sites based on the Poisson analysis result as part of vignette("DataModel")
.
Data Specification
Flag_Poisson
is designed to support the input data (dfAnalyzed
) generated from the Analyze_Poisson
function. At a minimum, the input must define a dfAnalyzed
data frame with a Score
variable included and a vThreshold
. These inputs will be used to identify possible statistical outliers in a new Flag
column by comparing Score
values to the specified thresholds.
The following columns are considered required:
GroupID
- Group ID; default isSiteID
GroupLevel
- Group TypeScore
- Site residuals calculated from the rates of exposure provided toAnalyze_Poisson()
Examples
dfTransformed <- Transform_Rate(analyticsInput)
dfAnalyzed <- Analyze_Poisson(dfTransformed)
#> ℹ Fitting log-linked Poisson generalized linear model of [ Numerator ] ~ [ log( Denominator ) ].
dfFlagged <- Flag_Poisson(dfAnalyzed, vThreshold = c(-7, -5, 5, 7))