R/est_dist.R
est_dist.Rd
Function to return either normal, lognormal, or non-parametric distribution
est_dist(df, alpha = 0.05, method = "sw", choices = c("norm", "lnorm"), combine_locations = FALSE, keep_data_object = FALSE)
df | groundwater data frame in tidy format |
---|---|
alpha | alpha |
method | default is "sw" |
choices | vector of distributions to check. Default is c("norm, "lnorm") |
combine_locations | TRUE/FALSE to estimate distribution by individual location, or grouped together. Default is FALSE. |
keep_data_object | Default is FALSE |
data("gw_data") wells <- c("MW-1", "MW-2", "MW-3", "MW-4") params <- c("Sulfate, total", "Arsenic, dissolved", "Boron, dissolved") gw_data <- gw_data %>% filter(location_id %in% wells, param_name %in% params) %>% percent_lt() %>% filter(percent_lt <=15) gw_data %>% group_by(location_id, param_name, default_unit) %>% est_dist(., alpha = 0.05, keep_data_object = FALSE)#> Warning: `cols` is now required. #> Please use `cols = c(distribution)`#> # A tibble: 12 x 4 #> # Groups: location_id, default_unit, param_name [12] #> location_id default_unit param_name distribution #> <chr> <chr> <chr> <chr> #> 1 MW-2 mg/L Sulfate, total Lognormal #> 2 MW-2 ug/L Arsenic, dissolved Nonparametric #> 3 MW-2 mg/L Boron, dissolved Normal #> 4 MW-1 mg/L Sulfate, total Normal #> 5 MW-1 ug/L Arsenic, dissolved Nonparametric #> 6 MW-1 mg/L Boron, dissolved Nonparametric #> 7 MW-3 mg/L Sulfate, total Normal #> 8 MW-3 ug/L Arsenic, dissolved Nonparametric #> 9 MW-3 mg/L Boron, dissolved Normal #> 10 MW-4 mg/L Sulfate, total Nonparametric #> 11 MW-4 ug/L Arsenic, dissolved Normal #> 12 MW-4 mg/L Boron, dissolved Normalgw_data %>% group_by(param_name, default_unit) %>% est_dist(., combine_locations = TRUE, keep_data_object = FALSE)#> Warning: `cols` is now required. #> Please use `cols = c(distribution)`#> # A tibble: 3 x 3 #> # Groups: default_unit, param_name [3] #> default_unit param_name distribution #> <chr> <chr> <chr> #> 1 mg/L Sulfate, total Normal #> 2 ug/L Arsenic, dissolved Nonparametric #> 3 mg/L Boron, dissolved Nonparametric