cv_adj {reasonabletools} | R Documentation |
Find the adjusted coefficient of variation
Description
Calculates adjusted coefficient of variation (CV) according to methods described in EPA's Technical Support Document for Water Quality-based Toxics Control.
Usage
cv_adj(qual, result, nd = c("<", "nd", "ND"), nd_adjustment = 0.5)
Arguments
qual |
A character vector containing non-detect indicator strings, e.g., "<" or "ND". The strings used to indicate censored status can be edited in the "nd" argument. |
result |
A numeric vector of concentration measurements. |
nd |
A list indicating all the censoring flags included in the dataset. Defaults to "<", "nd", and "ND". |
nd_adjustment |
Adjustment factor for non-detect values. Non-detect values (as indicated in qual vector) are multiplied by nd_adjustment factor; i.e. result * nd_adjustment. Typically, method detection limits or reporting limits are used as result values for non-detects. |
Value
A numeric coefficient of variation (CV) value
Examples
# CV for all detected values
cen_result <- rep("", 10)
result <- c(1:10)
cv_adj(cen_result, result)
# CV for all non-detected values
cen_result <- rep("<", 10)
cv_adj(cen_result, result)
# CV for fewer than 10 measurements
cen_result <- rep("", 5)
result <- c(1:5)
cv_adj(cen_result, result)
# Change the default substitution value
cen_result <- c(rep("<", 5), rep("", 15))
result <- c(101:120)
cv_adj(cen_result, result) # Use default 0.5 multiplier
# Use 1.0 multiplier (equivalent to using MDL)
cv_adj(cen_result, result, nd_adjustment = 1.0)
# Use 0.0 multiplier (equivalent to zero substitution)
cv_adj(cen_result, result, nd_adjustment = 0)