Package 'trafficlight'

Title: traffic light - Tools for data validation
Description: The package contains tools for data validation and aggregation of validation results.
Authors: Jan Philipp Dietrich [aut, cre], Markus Bonsch Bonsch [aut]
Maintainer: Jan Philipp Dietrich <[email protected]>
License: LGPL-3
Version: 1.15.1
Built: 2024-12-11 03:55:29 UTC
Source: https://github.com/pik-piam/trafficlight

Help Index


Traffic light - Tools for data validation

Description

The package contains tools for data validation and aggregation of validation results.

Details

Package: trafficlight
Type: Package
Version: 1.000
Date: 2016-10-07
License: LGPL-3

Author(s)

Markus Bonsch, Jan Philipp Dietrich

Maintainer: Jan Philipp Dietrich <[email protected]>


testLevel

Description

A collection of tests to compare the level of data with comparison data

Usage

testLevel(x, xc)

Arguments

x

a data vector of a single data set named and sorted by years

xc

a data vector of a single data set named and sorted by years

Details

Details about the employed tests can be found here: http://redmine.pik-potsdam.de/projects/x-intern/wiki/Traffic_light_validation

Value

A named vector containing results of multiple tests for the single combination of data and comparison data.

Author(s)

Markus Bonsch, Jan Philipp Dietrich

See Also

TLstatistics,trafficlight

Examples

#create some test data
test <- 1:40; names(test) <- 1995:2034
x <- test[20:40]
xc <- test[1:30] + rnorm(30)

testLevel(x,xc)

testOverlap

Description

A collection of tests to compare the overlap of data with comparison data

Usage

testOverlap(x, xc)

Arguments

x

a data vector of a single data set named and sorted by years

xc

a data vector of a single data set named and sorted by years

Details

Details about the employed tests can be found here: http://redmine.pik-potsdam.de/projects/x-intern/wiki/Traffic_light_validation

Value

A named vector containing results of multiple tests for the single combination of data and comparison data.

Author(s)

Markus Bonsch, Jan Philipp Dietrich

See Also

TLstatistics,trafficlight

Examples

#create some test data
test <- 1:40; names(test) <- 1995:2034
x <- test[20:40]
xc <- test[1:30] + rnorm(30)

testOverlap(x,xc)

testTrend

Description

A collection of tests to compare the trend of data with comparison data

Usage

testTrend(x, xc, t = 40)

Arguments

x

a data vector of a single data set named and sorted by years

xc

a data vector of a single data set named and sorted by years

t

window size in years for which the trend should be tested. It is tried to create a window -t/2 to t/2 around the start year for trend testing. If this does not work the window can be moved in the range of -t to t around the start year to find comparison data. Comparison data is shifted from the given window to start year to start year + t for analysis

Details

Details about the employed tests can be found here: http://redmine.pik-potsdam.de/projects/x-intern/wiki/Traffic_light_validation

Value

A named vector containing results of multiple tests for the single combination of data and comparison data.

Author(s)

Markus Bonsch, Jan Philipp Dietrich

See Also

TLstatistics,trafficlight

Examples

#create some test data
test <- 1:80; names(test) <- 1995:2074
x <- test
xc <- test + rnorm(30)
names(xc) <- 1925:2004

testOverlap(x,xc)

TLevaluate

Description

Function to evaluate statistical tests concerning model-data compatibility with respect to predefined thresholds to determine agreement classes.

Usage

TLevaluate(TLstatistics)

Arguments

TLstatistics

MAgPIE object containing statistical test results as returned by TLstatistics.

Details

Details about the thresholds and the aggregation can be found here: https://redmine.pik-potsdam.de/projects/magpie-intern/wiki/Traffic_light_validation

Value

matrix containing agreement classes (0 = red, 1 = yellow, 2 = green).

Author(s)

Markus Bonsch

See Also

TLstatistics,trafficlight,TLplot

Examples

library(magclass)
data("population_magpie")
x <- population_magpie
xc <- x + runif(length(x)[1],0,10^5)
tl <- TLstatistics(x[,,1],xc)

TLevaluate(tl)

TLplot

Description

Function to plot the results of the automatic validation procedure as a traffic light symbol

Usage

TLplot(mode, detailed = TRUE, linesize = 0.5)

Arguments

mode

A matrix containing traffic light values returned by TLevaluate.

detailed

boolean deciding whether detailed information should be plotted or not. In detailed mode each block represents a test group with the first traffic light showing the overall performance in this group and the following traffic lights showing the results of single tests.

linesize

line size of the traffic light borders

Value

A ggplot object.

Author(s)

Jan Philipp Dietrich, Markus Bonsch

See Also

TLevaluate,TLstatistics,trafficlight

Examples

library(magclass)
data("population_magpie")
x <- population_magpie
xc <- x + runif(length(x)[1],-10^5,10^5)
tl <- TLstatistics(x[,,1],xc)
tle <- TLevaluate(tl)

TLplot(tle)

TLstatistics

Description

Calculates several statistical measures to compare model results with data.

Usage

TLstatistics(x, xc)

Arguments

x

model output which should be tested in magclass format. Only a single element in data dimension is allowed

xc

comparison data on which x should be tested (magclass format)

Details

Details about the employed tests can be found here: https://redmine.pik-potsdam.de/projects/magpie-intern/wiki/Traffic_light_validation

Value

A matrix containing results of multiple tests for all available comparison datasets.

Author(s)

Markus Bonsch, Jan Philipp Dietrich

See Also

TLevaluate,trafficlight,TLplot

Examples

library(magclass)
data("population_magpie")
x <- population_magpie
xc <- x + runif(length(x)[1],0,10^5)
TLstatistics(x[,,1],xc)

trafficlight

Description

Function to perform an automatic validation routine

Usage

trafficlight(x, xc, plot = TRUE, ...)

Arguments

x

model output which should be tested in magclass format

xc

comparison data on which x should be tested (magclass format)

plot

TRUE or FALSE. If TRUE, a plot with a visualization of te treffic light is returned. If FALSE, a MAgPIE object with the test result is returned.

...

Additional arguments provided to TLplot

Details

The procedure is explained in detail here: https://redmine.pik-potsdam.de/projects/magpie-intern/wiki/Traffic_light_validation

Value

If plot==TRUE, a ggplot object. If plot==FALSE, a matrix with traffic light result (0 = red, 1 = yellow, 2 = green)

Author(s)

Markus Bonsch, Jan Philipp Dietrich, Benjamin Leon Bodirsky

See Also

TLevaluate,TLstatistics,TLplot

Examples

library(magclass)
data("population_magpie")
x <- population_magpie
xc <- x + runif(length(x)[1],0,10^5)

trafficlight(x[,,1], xc)
trafficlight(x[,,1], xc, detailed=FALSE)