`R/compute_frequency_analysis.R`

`compute_frequency_analysis.Rd`

Performs a volume frequency analysis on custom data. Defaults to ranking by minimums; use `use_max`

for to
rank by maximum flows. Calculates the statistics from events and flow values provided. Columns of events (e.g. years), their
values (minimums or maximums), and identifiers (low-flows, high-flows, etc.). Function will calculate using all values in the
provided data (no grouped analysis). Analysis methodology replicates that from
HEC-SSP. Returns a list of tibbles and plots.

compute_frequency_analysis( data, events = Year, values = Value, measures = Measure, use_max = FALSE, use_log = FALSE, prob_plot_position = c("weibull", "median", "hazen"), prob_scale_points = c(0.9999, 0.999, 0.99, 0.9, 0.5, 0.2, 0.1, 0.02, 0.01, 0.001, 1e-04), fit_distr = c("PIII", "weibull"), fit_distr_method = ifelse(fit_distr == "PIII", "MOM", "MLE"), fit_quantiles = c(0.975, 0.99, 0.98, 0.95, 0.9, 0.8, 0.5, 0.2, 0.1, 0.05, 0.01), plot_curve = TRUE )

data | A data frame of data that contains columns of events, flow values, and measures (data type). |
---|---|

events | Column in |

values | Column in |

measures | Column in |

use_max | Logical value to indicate using maximums rather than the minimums for analysis. Default |

use_log | Logical value to indicate log-scale transforming of flow data before analysis. Default |

prob_plot_position | Character string indicating the plotting positions used in the frequency plots, one of |

prob_scale_points | Numeric vector of probabilities to be plotted along the X axis in the frequency plot. Inverse of
return period. Default |

fit_distr | Character string identifying the distribution to fit annual data, one of |

fit_distr_method | Character string identifying the method used to fit the distribution, one of |

fit_quantiles | Numeric vector of quantiles to be estimated from the fitted distribution.
Default |

plot_curve | Logical value to indicate plotting the computed curve on the probability plot. Default |

A list with the following elements:

Data frame with computed annual summary statistics used in analysis.

Data frame with co-ordinates used in frequency plot.

ggplot2 object with frequency plot

List of fitted objects from fitdistrplus.

Data frame with fitted quantiles.

if (FALSE) { # Working example: # Calculate some values to use for a frequency analysis # (requires years, values for those years, and the name of the measure/metric) low_flows <- calc_annual_lowflows(station_number = "08NM116", start_year = 1980, end_year = 2000, roll_days = 7) low_flows <- dplyr::select(low_flows, Year, Value = Min_7_Day) low_flows <- dplyr::mutate(low_flows, Measure = "7-Day") # Compute the frequency analysis using the default parameters results <- compute_frequency_analysis(data = low_flows, events = Year, values = Value, measure = Measure) }