Package 'tdr'

Title: Target Diagram
Description: Implementation of target diagrams using 'lattice' and 'ggplot2' graphics. Target diagrams provide a graphical overview of the respective contributions of the unbiased RMSE and MBE to the total RMSE (Jolliff, J. et al., 2009. "Summary Diagrams for Coupled Hydrodynamic-Ecosystem Model Skill Assessment." Journal of Marine Systems 76: 64–82.)
Authors: Oscar Perpinan Lamigueiro [cre, aut]
Maintainer: Oscar Perpinan Lamigueiro <[email protected]>
License: GPL-2
Version: 0.13
Built: 2024-10-18 02:59:17 UTC
Source: https://github.com/oscarperpinan/tdr

Help Index


Error Statistics

Description

Error Statistics

Usage

tdStats(m, o,
         functions = c("mo", "mm",
                       "sdo", "sdm",
                       "mbe", "mae", "rmse",
                       "nmbe", "cvmbe",
                       "nmae", "cvmae",
                       "nrmse", "cvrmse",
                       "r2", "tStone"))

applyStats(models, o,
           functions = c("mo", "mm",
                         "sdo", "sdm",
                         "mbe", "mae", "rmse",
                         "nmbe", "cvmbe",
                         "nmae", "cvmae",
                         "nrmse", "cvrmse",
                         "r2", "tStone"))

Arguments

m

Numeric, vector, model values

models

Numeric, matrix, model values

o

Numeric, vector, observation values

functions

Character, name of functions to compute model errors. The package includes definitions for these functions:

  • Mean: mo, mm

  • Standard Deviation: sdo, sdm

  • Mean Bias Error: mbe

  • Mean Absolute Error: mae

  • Root Mean Square Error: rmse

  • t of Stone: tStone

  • Coefficient of determination, R2R^2: r2

There are also functions that normalize the MBE, MAE and RMSE values. nmbe, nmae, and nrmse use the observation range as factor of normalization, while cvmbe, cvmae, and cvrmse, use the observation average to normalize.

Value

A data.frame with a column for each function, and a row for each model.

Author(s)

Oscar Perpiñán Lamigueiro

See Also

targetDiagram, target_diagram

Examples

data(modelEx)

## Analyze one model
tdStats(pvModels$M01, pvObs)

## Analyze a set of models
applyStats(pvModels, pvObs)

Target Diagrams

Description

Target diagrams with lattice, targetDiagram, and ggplot2, target_diagram.

Usage

targetDiagram(data, class = "",
              xlab = expression("RMSEc" %.% "sign(" * sigma^"*" * ")"),
              ylab = "MBE",
              auto.key = list(space = "right"),
              default.scales = list(cex = 0.6),
              scales = list(),
              type = "quantile",
              cuts = seq(0.25, 1, 0.25),
              par.settings = tdTheme(),
              ...)

target_diagram(data,
               xlab = expression("RMSEc"%.%"sign("*sigma^"*"*")"),
               ylab = 'MBE', 
               type = 'quantile', cuts = seq(0.25, 1, .25),
               ...)

tdTheme(pch = 21:25,
        col.points = brewer.pal(n= 8, 'Dark2'),
        fill = brewer.pal(n= 8, 'Pastel2'),
        cex = 1.1,
        ...)

Arguments

data

A data.frame with these columns: nrmse (Root Mean Square Error), nmbe (Mean Bias Error), sdm (Standard Deviation of the model), sdo (Standard Deviation of observations)

class

Character, the name of the variable that defines the panels of a trellis graphic.

xlab, ylab

Character or expression, define the axis labels.

auto.key, default.scales, scales

Legend and scales customization. Read the xyplot and panel.xyplot help pages for details.

type

Character, defines the type of cuts between 'quantile' and 'at'.

cuts

Numeric, defines the radius of the RMSE circles. If type = 'quantile' it defines the probabilities with values between 0 and 1, and the radius are such that the circles are the corresponding quantile. If type = 'at' cuts defines the radius of the circles.

par.settings

Definition of graphical parameters using simpleTheme or its wrapper tdTheme

pch, col.points, fill, cex

Arguments for simpleTheme

...

Additional arguments for xyplot or ggplot

Details

The Target Diagram is derived from the relation between the unbiased RMSE, MBE, and RMSE. In a Cartesian coordinate system, the x-axis represents the unbiased RMSE (variance of the error), and the y-axis represents the MBE. Therefore the distance between any point to the origin is equal to the RMSE. Because the unbiased RMSE is always positive, the left area of the coordinate system is empty with this scheme. With additional information this region may be also used: the unbiased RMSE is multiplied by the sign of the difference between the standard deviations of model and observations.

The resulting diagram provides three different measures: whether the model overestimates or underestimates (positive or negative values of the MBE on the y-axis, respectively), whether the model standard deviation is larger or smaller than the standard deviation of the measurements (positive or negative values on the x-axis, respectively), and the error performance as quantified by the RMSE represented as the distance to the coordinates origin. This tool is particularly powerful when comparing competing models.

targetDiagram is built around the lattice package, while target_diagram is the ggplot2 version.

targetDiagram uses tdTheme to define the graphical settings, which is just a wrapper around simpleTheme.

Value

targetDiagram produces a trellis object. target_diagram produces a ggplot object.

Author(s)

Oscar Perpiñán Lamigueiro

References

Jolliff, J. K., Kindle, J. C., Shulman, I., Penta, B., Friedrichs, M. A., Helber, R., & Arnone, R. A. (2009). Summary diagrams for coupled hydrodynamic-ecosystem model skill assessment. Journal of Marine Systems, 76(1), 64-82.

See Also

xyplot, ggplot, simpleTheme, tdStats

Examples

data(modelEx)

## Compute statistics
errModel <- applyStats(pvModels, pvObs)

## Display results
## Default settings use type = 'quantile'
targetDiagram(errModel, groups = model)

target_diagram(errModel, fill = 'model')

## whose breaks can be defined with 'cuts'
targetDiagram(errModel, groups = model,
              type = 'quantile',
              cuts = seq(0, 1, .1))

target_diagram(errModel, fill = 'model',
              type = 'quantile',
              cuts = seq(0, 1, .1))

## Alternatively, with type = 'at'
## one can define manually the breaks
targetDiagram(errModel, groups = model,
              type = 'at',
              cuts = seq(0, .1, .02))

target_diagram(errModel, fill = 'model',
              type = 'at',
              cuts = seq(0, .1, .02))