Skip to content

oscarperpinan/tdr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Target Diagrams

R implementation of Target Diagrams proposed in Jolliff, J.; Kindle, J. C.; Shulman, I.; Penta, B.; Friedrichs, M. A. M.; Helber, R. & Arnone, R. A. Summary diagrams for coupled hydrodynamic-ecosystem model skill assessment Journal of Marine Systems, 2009, 76, 64-82.

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.

Installation

The stable release of tdr can be found at CRAN. The development version is at GitHub.

Install the stable version with:

install.packages('tdr)

To install the development version you need the devtools package:

install.packages('devtools')
devtools::install_github('tdr', 'oscarperpinan')

Usage

There are two main functions, targetDiagram for lattice users, and target_diagram for ggplot2 users. Both of them have a data argument, a data.frame with three columns containing the error statistics between a set of models and a vector of observations. This data.frame can be produced with the applyStats function included in the package.

There is an example data set in the package.

library(tdr)

data(modelEx)     

Now in your environment you will find a data.frame named pvModels and a vector named pvObs.

library(zoo)

z <- zoo(cbind(pvModels, pvObs),
         order =  as.Date(rownames(pvModels)))
plot(z, plot.type  = 'single',
     col = c(rep('gray', 22), 'red'),
     ylab = '', xlab = '')

figs/z.png

The applyStats function computes the error statistics between models and observations required by the target diagram:

errModel <- applyStats(pvModels, pvObs)

We are ready to display the result, using lattice:

targetDiagram(errModel, groups = model)

figs/targetDiagram.png

or ggplot2:

target_diagram(errModel, fill = 'model')

figs/target_diagram.png

Releases

No releases published

Packages

No packages published

Languages