Skip to contents

calc_gof() calculates goodness-of-fit inices for simulated time series sim and observations obs applying the functions passed as a list with funs.

Usage

calc_gof(sim, obs, funs, period = NULL)

Arguments

sim

Data frame with one date column and one or many columns with values of the simulated variable.

obs

Data frame with one date and one value column.

funs

A list of functions used to calculate goodness-of-fit (GoF) values. This can be a named or unnamed list. If named (e.g., list(nse_q = NSE, pb_q = pbias)), the names will be used as column names in the returned results. If unnamed, the function names themselves will be used as column names. Commonly used functions (such as NSE, pbias, KGE, etc.) are available in the documentation of the hydroGOF package.

period

Optional. A character string specifying the time period for aggregating data before calculating GoF. One of "second", "minute", "hour", "day", "week", "month", "bimonth", "quarter", "season", "halfyear", "year", or NULL (default, no aggregation). Aggregation is done using the mean. Period names match the unit strings accepted by lubridate::floor_date().

Value

A table with the calculated goodness-of-fit values.

See also

For available goodness-of-fit functions, see the hydroGOF package documentation.

Examples

if (FALSE) { # \dontrun{
date_flow <- seq(as.Date('2000-01-01'), as.Date('2000-12-31'), by = 'day')

flow_sim <- data.frame(date = date_flow,
                       run_1 = runif(length(date_flow)),
                       run_2 = runif(length(date_flow))
                       )
flow_obs <- data.frame(date = date_flow,
                       qobs = runif(length(date_flow))
                       )

obj_tbl <- calc_gof(sim = flow_sim, obs = flow_obs, funs = list(cor_q = cor))
} # }