Title: | Confidence Estimation of Environmental State Classifications |
Version: | 1.1-3 |
Date: | 2025-07-05 |
Description: | Functions for estimating and reporting multi-year averages and corresponding confidence intervals and distributions. A potential use case is reporting the chemical and ecological status of surface waters according to the European Water Framework Directive. |
Depends: | R (≥ 4.0.0), tcltk |
Imports: | knitr, markdown, plyr, xtable, ggplot2 |
Suggests: | testthat |
Encoding: | UTF-8 |
VignetteBuilder: | knitr |
License: | GPL (≥ 3) |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-07-04 22:52:50 UTC; dennis |
Author: | Willem van Loon [aut, cph], Dennis Walvoort [aut, cre] |
Maintainer: | Dennis Walvoort <dennis.Walvoort@wur.nl> |
Repository: | CRAN |
Date/Publication: | 2025-07-04 23:10:02 UTC |
Confidence Estimation of Environmental State Classifications
Description
This package can be used to estimate the confidence of state classifications (e.g., with the classification ‘bad’, ‘moderate’, ‘good’) produced using environmental indicators and associated targets. The implementation closely follows Baggelaar et al. (2010) where the confidence intervals for the estimated multiyear averages are derived by assuming a Student's t distribution for the errors. For more information about the package see the package-vignette (type: vignette("confidence")
at the R-prompt to view the vignette.).
Author(s)
Willem M.G.M. van Loon and Dennis J.J. Walvoort
References
Baggelaar, P., O. van Tongeren, R. Knoben, and W. van Loon, 2010. Rapporteren van de betrouwbaarheid van KRW-beoordelingen (in Dutch, English translation: Reporting the confidence of WFD-assessments). H2O 16: 21–25
See Also
conf
and the package vignette mentioned above.
Annual Average 1,2-dichloroethane Concentration
Description
Annual arithmetic average concentration of 1,2-dichloroethane (DCA) in
a specific water body (\mu g/l
), based on Baggelaar et al., (2010)
Details
The columns represent the following information:
- OBJECTID
water body code
- PAR
parameter, in this case 1,2-dichloroethane
- color
colors in density function
- DATE
year
- VALUE
annual arithmetic average concentration
- TARGET
target according to the European Water Framework Directive
- UNIT
measurement unit (
\mu g/l
)
Source
Baggelaar, P., O. van Tongeren, R. Knoben, & W. van Loon, 2010. Rapporteren van de betrouwbaarheid van KRW-beoordelingen. H2O 16, p.21–25
Annual Average Environmental Quality Ratio for Macrofauna.
Description
Annual artithmetic average environmental quality ratio's (EQR) for Macrofauna in a specific water body, based on Baggelaar et al., (2010)
Details
The columns represent the following information:
- OBJECTID
water body code
- PAR
parameter, in this case EQR
- color
colors in density function
- DATE
year
- VALUE
annual arithmetic average EQR
- TARGET
target EQR
- transfrom
applied transform
Source
Baggelaar, P., O. van Tongeren, R. Knoben, & W. van Loon, 2010. Rapporteren van de betrouwbaarheid van KRW-beoordelingen. H2O 16, p.21–25
Back-transformations Performs inverse log or logit transformations.
Description
Back-transformations
Performs inverse log or logit transformations.
Usage
backtransform(x, type = c("identity", "log", "logit", "none", NA_character_))
Arguments
x |
value to back-transform |
type |
type of transform (log, logit). |
Value
backtransformed value
Perform Confidence Run
Description
This function starts the 'confidence tool'. The results will be stored in a subdirectory in the current working directory. See details section below.
Usage
conf(x = NULL, tmpdir = tempfile(pattern = "confidence"), browse = TRUE)
Arguments
x |
name of the input file or a |
tmpdir |
directory to store temporary files (for debugging only) |
browse |
load resulting report directly in a browser? |
Details
This function will create a subdirectory
in the same directory as
x
, in casex
is a filename orin the current working directory (see
getwd
), in casex
is adata.frame
.
The computer should have write permission to this directory, if not an error message will be raised. The subdirectory contains an HTML-report with all analysis results. For convenience, the results are also stored in CSV-format (tables) and png-format (figures) for further processing.
See Also
confidence and the package vignette
(vignette("confidence")
).
Check Confidence data
Description
This function checks data.frames
to be used by the confidence
package. The format has been specified in Van Loon (2014) and should
contain the following columns:
OBJECTID: water body code, e.g., NL89_os;
PAR: parameter, e.g., Cadmium;
DATE: date according to ISO 8601 (YYYY-mm-dd) for point values or year YYYY for annual means;
VALUE: numerical value.
TARGET: target value for the European Water Framework Directive;
UNIT: measurement unit of PAR. This unit should be the same for all records with the same PAR and is the same for both VALUE and TARGET;
transform: data transformation, i.e., log, logit, NA.
Usage
conf_input(x)
Arguments
x |
|
Details
The function performs the following tasks:
checks availablitity of required columns (case insensitive);
make column names case-insensitive;
removes redundant spaces;
checks on missing values in required columns;
checks if DATE-field adheres to ISO 8601 (YYYY-mm-dd) or YYYY;
checks mixtures of annual averages and point values for a each year;
checks if measurement units are the same for a specific OBJECTID-PAR-pair;
checks if TARGET-value is the same for a specific OBJECTID-PAR-pair;
checks if transform is one of log, logit, NA in transform column;
checks that the EQR-column contains identical values fo each OBJECTID-PAR combination.
Value
data.frame
that has passed all checks
Simulated Metal Contents
Description
A data set with two time-series of simulated metal contents. These data have mainly been used to test the package. Users may find this dataset convenient as an example to construct their own data sets. The columns represent the following information:
- OBJECTID
water body code, e.g., NL89_os
- PAR
parameter, e.g., Cadmium
- color
colors in density function
- DATE
date according to ISO 8601 (YYYY-mm-dd) for point values or year YYYY for annual means
- VALUE
numerical value
- TARGET
e.g., the target value for the European Water Framework Directive
- UNIT
measurement unit of PAR. This unit should be the same for all records with the same PAR and is the same for both VALUE and TARGET
- transform
data transformation, i.e., log, logit, NA
Multi-Year Average
Description
Estimates the multi-year average of environmental properties and associated confidence intervals.
Usage
mya(x, ...)
Arguments
x |
object of class |
... |
further arguments to be passed to other methods |
Value
a data.frame
with the following columns:
MYA
:the multi-year arithmetic average;
PROB_LTT
:the probability that
MYA
is less than the target value specified;PROB_GTT
:the probability that
MYA
is greater than the target value specified;q05
:the lowerbound of the 90% confidence interval of
MYA
;q95
:the upperbound of the 90% confidence interval of
MYA
.
See Also
Sanitize Text to Give Proper Filenames
Description
Sanitize Text to Give Proper Filenames
Usage
sanitize(x)
Arguments
x |
character vector to sanitize |
Value
sanitized character vector
Remove Redundant Spaces
Description
This function removes redundant spaces from character vectors
Usage
strip_spaces(x)
Arguments
x |
character vector |
Value
character vector without trailing or multiple spaces
Examples
stopifnot(confidence:::strip_spaces(" Hello World ") == "Hello World")
Transformations Performs log or logit transformations.
Description
Transformations
Performs log or logit transformations.
Usage
transform(x, type = c("identity", "log", "logit", "none", NA_character_))
Arguments
x |
value to transform |
type |
type of transform (log, logit). |
Value
transformed value
Internal Functions For Writing HTML
Description
Internal Functions For Writing HTML
Usage
write_html(x, ...)
Arguments
x |
object |
... |
further arguments passed to or from other methods. |