evaluation: Model statistical evaluation

View source: R/evaluate.R

evaluationR Documentation

Model statistical evaluation

Description

Statistical evaluation from 2 data.frames. The input data.frames (model and observation) must contain a date column (with POSIXlt data) and also contains the same station (or pollutant) name. The function test and combine the time pairs and perform some basic tests. If a data.frame is provided to table argument a crbind is performed with a new row.

Usage

evaluation(
  mo,
  ob,
  station = "ALL",
  fair = NULL,
  table = NULL,
  wd = FALSE,
  cutoff = NA,
  cutoff_NME = NA,
  no_tz = FALSE,
  nobs = 8,
  clean = FALSE,
  formate = FALSE,
  ndig = 2,
  summaryze = FALSE,
  use_n = FALSE,
  NAME = "AVERAGE",
  verbose = TRUE,
  ...
)

Arguments

mo

model data.frame

ob

observed data.frame

station

name of the station or ALL, see notes

fair

model data.frame (or list of names) to perform a fair comparison, see notes

table

a data.frame with output from evaluate or stats

wd

default is FALSE, see notes

cutoff

minimum (optionally the maximum) valid value for observation

cutoff_NME

minimum (optionally the maximum) valid value for observation for NME

no_tz

ignore tz from input

nobs

minimum number of valid observations, default is 8

clean

remove rows with zero observations

formate

format the output for 2 digit (default)

ndig

number of digits for formate

summaryze

add a last line with the the average values and format the table

use_n

only for summaryze = TRUE, use n as weight to calculate the average

NAME

row.name for summaryze option

verbose

display additional information

...

arguments to be passing to stats and plot

Note

for wind direction some the ME and MB are calculated using Mughal et al. (2017)

station == 'ALL' make the function put all observations and model together, for this option a additional data.frame (or character containging the station names) can be used to perform a fair comparison, considering only stations (ie columns) in the fair data.frame and ob data.frame (or the name list).

Special thanks to Kiarash and Libo to help to test the wind direction option.

References

Mughal MO, Lynch M, Yu F, McGann B, Jeanneret F, Sutton J (2017) Wind modeling, validation and sensitivity study using Weather Research and Forecasting model in complex terrain. Environ Model Softw 90:107–125. https://doi.org/10.1016/j.envsoft.2017. 01.009

Examples

model <- readRDS(paste0(system.file("extdata",package="hackWRF"),"/model.Rds"))
obs   <- readRDS(paste0(system.file("extdata",package="hackWRF"),"/obs.Rds"))

# if first a test with no observed data
# the function return an empty row
table <- evaluation(mo = model, ob = obs, station = "VVIbes")
print(table)

# now a test with a few observed values
table <- evaluation(mo = model, ob = obs, station = "Americana", table = table)
print(table)

# new tests with no data will be discated
table <- evaluation(mo = model, ob = obs, station = "VVIbes", table = table)
print(table)

# if the station are not in the input data frame a message is displayed
# and the function return an empty row
table <- evaluation(mo = model, ob = obs, station = "Ibirapuera", table = table)
print(table)

# if the first evaluation has no data, the last call can remove the line
table <- evaluation(mo = model, ob = obs, station = "Americana", table = table, clean = TRUE)
print(table)

Schuch666/hackWRF documentation built on June 9, 2025, 1:46 p.m.