calc_gof: Calculate goodness of fit stats

View source: R/calc_gof.R

calc_gofR Documentation

Calculate goodness of fit stats

Description

Returns a data frame of calculated goodness of fit stats for each monitoring site and all sites combined. The function accepts multiple sites and variable timeseries. preds and obs are matched based on the Monitoring.Location.ID, constituent, and nearest datetime within a set number of minutes defined using tolerance.If the difference in datetimes exceeds the tolerance a match will not be made. Goodness of fit statistics are calculated using the metrica package. Statistics calculated are Mean Bias Error (MBE), Mean Absolute Error (MAE), Root Mean Square Error (RMSE), Nash-Sutcliffe Efficiency (NSE), and Coefficient of Determination (R2). Goodness of fit results are rounded to the hundredths. The count of preds and obs comparisons at each monitoring location are also included (n).

Usage

calc_gof(preds, obs, tolerance = 60)

Arguments

preds

Data frame of model prediction results. The preds data frame must include the following columns:

  • Monitoring.Location.ID: Character value of the obs monitoring location ID

  • constituent: Character value of the constituent (e.g. 'Temperature, water').

  • datetime: POSIXct datetime.

  • model_km: numeric model stream kilometer

  • value: Constituent value.

obs

Data frame of field observation results. The obs data frame must include the following columns:

  • Monitoring.Location.ID: Character value of the obs monitoring location ID

  • constituent: Character value of the constituent (e.g. 'Temperature, water').

  • datetime: POSIXct datetime.

  • model_km: numeric model stream kilometer

  • value: Constituent value.

tolerance

The maximum number of minutes allowed between the datetimes in preds and obs to establish a match. If the difference exceeds the tolerance the prediction is not included in the goodness of fit stats. The tolerance cannot be greater than 1440 minutes (1 day). The default tolerance is 60 minutes.

Value

data frame

See Also

MBE, MAE, RMSE, NSE, cor


DEQrmichie/heatsourcetools documentation built on Jan. 25, 2025, 2:31 p.m.