rstat: Calculate retrieval statistics

Description Usage Arguments Details Value References Examples

View source: R/stats.R

Description

The function calculates useful descriptive statistics to evaluate the estimation and create a vector of strings for plotting.

Usage

1
2
3
rstat(x, y, log = FALSE, ux = FALSE, units = "")

lstat(stats, digits = 3)

Arguments

x

Reference data.

y

Estimated data.

log

Logical. Should log based performance statistics be computed?

ux

Logical. Calculate unbiased differences?

units

Units of the data.

stats

object created by rstat.

digits

number of digits to be passed to round.

Details

Those functions are wrappers for descriptive statistics and convenient text strings for addition to a plot. They provide the statistics of the agreement of the estimated data against the reference data; i.e. evaluates estimations against the 1:1 relation. Statistics include the mean absolute percentage difference (MAPD), the mean percentage error (bias), the root mean squared difference (RMSD), the coefficient of determination (R^2), the number of data points, and the range of the reference data.

The parameter 'units' is also available for convenience of use with the lstats function, to add those statistics to a plot. It should be a character string that can be used in expressions. See examples.

When x does not present smaller uncertainty than y, ux can be set to TRUE to calculate unbiased statistics in linear space. In that case, the normalization of MAPD and bias is not on x by on the average of x and y. This approach might also be used if some values are very close to zero.

For heterocedastic data or data spanning multiple orders of magnitude, log can be set to TRUE to calculate performance statistics in log space. Note in this case the units are set to ” (unitless). The MAPD and bias are retrieved in

MAPD = 100 * (10^((1 / n) * sum(|log10(x) - log10(y)|)) - 1) Bias = 100 * (10^((1 / n) * sum(log10(x) - log10(y))) - 1)

Value

A named list with component statistics and units for rstat and a vector of expressions for plot legend.

References

IOCCG. 2019. Uncertainties in Ocean Colour Remote Sensing. Mélin F. (ed.), IOCCG Report Series, No. 18, International Ocean Colour Coordinating Group, Dartmouth, Canada. http://dx.doi.org/10.25607/OBP-696 Seegers, B. N.; Stumpf, R. P.; Schaeffer, B. A.; Loftin, K. A.; Werdell, P. J. 2018. Performance metrics for the assessment of satellite data products: an ocean color case study. Optics Express 26, 6, 7404. DOI: 10.1364/OE.26.007404

Examples

1
2
3
4
5
x <- 1:10
y <- x + rnorm(10)
(rs <- rstat(x, y, units = bquote(m^-1)))
plot(x, y)
legend("bottomright", lstat(rs), bty = "n")

AlexCast/rho documentation built on Dec. 14, 2021, 9:47 a.m.