cv_adj: Find the adjusted coefficient of variation

Description Usage Arguments Value Examples

View source: R/summary_functions.R

Description

Calculates adjusted coefficient of variation (CV) according to methods described in EPA's Technical Support Document for Water Quality-based Toxics Control.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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)  

reasonabletools documentation built on Nov. 8, 2020, 4:24 p.m.