Learn R Programming

SCE (version 1.0.0)

Model_evaluation: Evaluate SCE and SCA Model Performances

Description

These functions evaluate the performance of SCE and SCA models using six distinct metrics: Mean Absolute Error (MAE), Root Mean Square Error (RMSE), Nash-Sutcliffe Efficiency (NSE), Log-transformed NSE, R-squared, and Kling-Gupta Efficiency (KGE). The functions handle both single and multiple predictants, with comprehensive input validation and proper handling of NaN values and zero/negative values.

Usage

SCA_Model_evaluation(Testing_data, Simulations, Predictant, digits = 3)

SCE_Model_evaluation(Testing_data, Training_data, Simulations, Predictant, digits = 3)

Value

For SCA_Model_evaluation:

  • If single predictant: Returns a data.frame with column "Testing"

  • If multiple predictants: Returns a list of data.frames, one for each predictant

For SCE_Model_evaluation:

  • If single predictant: Returns a data.frame with columns "Training", "Validation", and "Testing"

  • If multiple predictants: Returns a list of data.frames, one for each predictant

Each data.frame contains the following metrics:

  • MAE: Mean Absolute Error (mean(abs(obs - sim)))

  • RMSE: Root Mean Square Error (sqrt(mean((obs - sim)^2)))

  • NSE: Nash-Sutcliffe Efficiency (1 - (sum((obs - sim)^2) / sum((obs - mean(obs))^2)))

  • Log.NSE: NSE calculated on log-transformed values

  • R2: R-squared calculated using linear regression

  • kge: Kling-Gupta Efficiency (1 - sqrt((r-1)^2 + (alpha-1)^2 + (beta-1)^2))

Arguments

Testing_data

A data.frame containing the observations used during model testing. Must include all specified predictants.

Training_data

A data.frame containing the observations used during model training. Required only for SCE_Model_evaluation.

Simulations

A list containing model predictions:

  • For SCE: must contain 'Training', 'Validation', and 'Testing' components

  • For SCA: must contain 'Testing_sim' component

The structure should align with the output generated by the respective model training function.

Predictant

A character vector specifying the name(s) of the dependent variable(s) to be evaluated (e.g., c("swvl3", "swvl4")). The specified names must exactly match those used in model training.

digits

An integer specifying the number of decimal places to retain when reporting evaluation metrics. Default value is 3.

Author

Kailong Li <lkl98509509@gmail.com>

Details

The functions perform comprehensive input validation:

  1. Data frame structure validation

  2. Presence of required components in Simulations list

  3. Existence of predictants in both data and simulations

  4. Matching row counts between data and simulations

  5. Proper handling of NaN values and zero/negative values

The evaluation process:

  1. Removes NaN values from both observed and simulated data

  2. Handles zero or negative values by replacing them with 0.0001

  3. Calculates all six metrics for each predictant

  4. Formats the results with specified number of decimal places

See Also

SCE