diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2020-11-12 11:04:45 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-11-12 11:11:03 +0100 |
commit | 7b807680b66269ff911df137f56e26775d84e283 (patch) | |
tree | 407c3118ba48580952017244bfba1f9647661271 | |
parent | c0c82d9523da8965f5fb7a5f8cf1410750885d30 (diff) |
mkindsg class to hold groups of datasets
- D24_2014 dataset on aerobic soil degradation of 2,4-D from the EU
assessment as mkindsg object with metadata
- f_time_norm_focus() to do time-step normalisation using the FOCUS
method
- focus_soil_moisture data with default moisture contents at pF1,
pF 2 and pF 2.5 for USDA soil types from FOCUS GW guidance
- Dataset generation scripts in inst/dataset_generation
- Depend on R >= 2.15.1 in order to facilitate the use of
utils::globalVariables()
-rw-r--r-- | DESCRIPTION | 3 | ||||
-rw-r--r-- | GNUmakefile | 3 | ||||
-rw-r--r-- | NAMESPACE | 5 | ||||
-rw-r--r-- | NEWS.md | 8 | ||||
-rw-r--r-- | R/D24_2014.R | 28 | ||||
-rw-r--r-- | R/f_time_norm_focus.R | 77 | ||||
-rw-r--r-- | R/focus_soil_moisture.R | 11 | ||||
-rw-r--r-- | R/mkin_wide_to_long.R | 2 | ||||
-rw-r--r-- | R/mkinds.R | 117 | ||||
-rw-r--r-- | R/mkinerrmin.R | 2 | ||||
-rw-r--r-- | R/mkinerrplot.R | 2 | ||||
-rw-r--r-- | R/mkinfit.R | 2 | ||||
-rw-r--r-- | R/mkinresplot.R | 2 | ||||
-rw-r--r-- | R/plot.mixed.mmkin.R | 2 | ||||
-rw-r--r-- | R/plot.mkinfit.R | 2 | ||||
-rw-r--r-- | R/saem.R | 2 | ||||
-rw-r--r-- | data/D24_2014.rda | bin | 0 -> 20470 bytes | |||
-rw-r--r-- | data/focus_soil_moisture.rda | bin | 0 -> 279 bytes | |||
-rw-r--r-- | inst/dataset_generation/D24_2014.R | 71 | ||||
-rw-r--r-- | inst/dataset_generation/focus_soil_moisture.R | 11 | ||||
-rw-r--r-- | man/D24_2014.Rd | 42 | ||||
-rw-r--r-- | man/experimental_data_for_UBA.Rd | 8 | ||||
-rw-r--r-- | man/f_time_norm_focus.Rd | 72 | ||||
-rw-r--r-- | man/focus_soil_moisture.Rd | 24 | ||||
-rw-r--r-- | man/mkinds.Rd | 14 | ||||
-rw-r--r-- | man/mkindsg.Rd | 100 | ||||
-rw-r--r-- | man/print.mkinds.Rd | 16 |
27 files changed, 585 insertions, 41 deletions
diff --git a/DESCRIPTION b/DESCRIPTION index b56c77c7..e85cf3d1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: mkin Type: Package Title: Kinetic Evaluation of Chemical Degradation Data Version: 0.9.50.4 -Date: 2020-10-14 +Date: 2020-11-12 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), email = "jranke@uni-bremen.de", comment = c(ORCID = "0000-0003-4371-6538")), @@ -16,6 +16,7 @@ Description: Calculation routines based on the FOCUS Kinetics Report (2006, equation models are solved using automatically generated C functions. Please note that no warranty is implied for correctness of results or fitness for a particular purpose. +Depends: R (>= 2.15.1) Imports: stats, graphics, methods, deSolve, R6, inline, parallel, numDeriv, lmtest, pkgbuild, nlme (>= 3.1-150.1), purrr, saemix (>= 3.1.9000) Suggests: knitr, rbenchmark, tikzDevice, testthat, rmarkdown, covr, vdiffr, diff --git a/GNUmakefile b/GNUmakefile index 09933ee7..49f64c45 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -23,6 +23,7 @@ pkgfiles = \ data/* \ DESCRIPTION \ inst/WORDLIST \ + inst/extdata/* \ inst/testdata/fit_old_FOCUS_D.rda \ man/* \ NAMESPACE \ @@ -42,7 +43,7 @@ $(TGZ): $(pkgfiles) vignettes $(RM) Rplots.pdf "$(RBIN)/R" CMD build . 2>&1 | tee build.log -roxygen: +roxygen: "$(RBIN)/Rscript" -e 'devtools::document()' $(TGZVNR): $(pkgfiles) @@ -6,6 +6,8 @@ S3method(BIC,mmkin) S3method(aw,mkinfit) S3method(aw,mmkin) S3method(confint,mkinfit) +S3method(f_time_norm_focus,mkindsg) +S3method(f_time_norm_focus,numeric) S3method(loftest,mkinfit) S3method(logLik,mkinfit) S3method(lrtest,mkinfit) @@ -21,6 +23,7 @@ S3method(plot,mkinfit) S3method(plot,mmkin) S3method(plot,nafta) S3method(print,mkinds) +S3method(print,mkindsg) S3method(print,mkinmod) S3method(print,mmkin) S3method(print,nafta) @@ -48,6 +51,7 @@ export(add_err) export(aw) export(backtransform_odeparms) export(endpoints) +export(f_time_norm_focus) export(get_deg_func) export(ilr) export(invilr) @@ -63,6 +67,7 @@ export(mean_degparms) export(mkin_long_to_wide) export(mkin_wide_to_long) export(mkinds) +export(mkindsg) export(mkinerrmin) export(mkinerrplot) export(mkinfit) @@ -1,5 +1,13 @@ # mkin 0.9.50.4 (unreleased) +- 'f_norm_temp_focus' generic function to normalise time intervals using the FOCUS method, with methods for numeric vectors and 'mkindsg' objects + +- 'mkindsg' R6 class for groups of 'mkinds' datasets with metadata + +- 'D24_2014' dataset + +- 'focus_soil_moisture' FOCUS default soil moisture data + - 'plot.mixed.mmkin' method used for 'nlme.mmkin' and 'saem.mmkin', both inheriting from 'mixed.mmkin' (currently virtual) - 'saem' generic function to fit saemix models, with a generator 'saem.mmkin', summary and plot methods diff --git a/R/D24_2014.R b/R/D24_2014.R new file mode 100644 index 00000000..81316833 --- /dev/null +++ b/R/D24_2014.R @@ -0,0 +1,28 @@ +#' Aerobic soil degradation data on 2,4-D from the EU assessment in 2014 +#' +#' The five datasets were extracted from the active substance evaluation dossier +#' published by EFSA. Kinetic evaluations shown for these datasets are intended +#' to illustrate and advance kinetic modelling. The fact that these data and +#' some results are shown here does not imply a license to use them in the +#' context of pesticide registrations, as the use of the data may be +#' constrained by data protection regulations. +#' +#' Metabolite residues at early sampling times reported as 0.0 were set to NA. +#' +#' The R code used to create this data object is installed with this package +#' in the 'dataset_generation' directory. In the code, page numbers are given for +#' specific pieces of information in the comments. +#' +#' @format An [mkindsg] object grouping five datasets +#' @source Hellenic Ministry of Rural Development and Agriculture (2014) +#' Final addendum to the Renewal Assessment Report - public version - 2,4-D +#' Volume 3 Annex B.8 Fate and behaviour in the environment p. 638, 640, +#' 644-646. +#' \url{http://registerofquestions.efsa.europa.eu/roqFrontend/outputLoader?output=ON-3812} +#' @examples +#' print(D24_2014) +#' print(D24_2014$ds[[1]], data = TRUE) +#' m1 = mkinmod(D24 = list(type = "SFO", to = "phenol"), +#' phenol = list(type = "SFO", to = "anisole"), +#' anisole = list(type = "SFO")) +"D24_2014" diff --git a/R/f_time_norm_focus.R b/R/f_time_norm_focus.R new file mode 100644 index 00000000..be5cf583 --- /dev/null +++ b/R/f_time_norm_focus.R @@ -0,0 +1,77 @@ +utils::globalVariables("D24_2014") + +#' Normalisation factors for aerobic soil degradation according to FOCUS guidance +#' +#' Time step normalisation factors for aerobic soil degradation as described +#' in Appendix 8 to the FOCUS kinetics guidance (FOCUS 2014, p. 369). +#' +#' @param object An object containing information used for the calculations +#' @param temperature Numeric vector of temperatures in °C +#' @param moisture Numeric vector of moisture contents in \\% w/w +#' @param field_moisture Numeric vector of moisture contents at field capacity +#' (pF2) in \\% w/w +#' @param Q10 The Q10 value used for temperature normalisation +#' @param walker The Walker exponent used for moisture normalisation +#' @param f_na The factor to use for NA values. If set to NA, only factors +#' for complete cases will be returned. +#' @param \dots Currently not used +#' @references +#' FOCUS (2006) \dQuote{Guidance Document on Estimating Persistence +#' and Degradation Kinetics from Environmental Fate Studies on Pesticides in +#' EU Registration} Report of the FOCUS Work Group on Degradation Kinetics, +#' EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, +#' \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} +#' FOCUS (2014) \dQuote{Generic guidance for Estimating Persistence +#' and Degradation Kinetics from Environmental Fate Studies on Pesticides in +#' EU Registration} Report of the FOCUS Work Group on Degradation Kinetics, +#' Version 1.1, 18 December 2014 +#' \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} +#' @seealso [focus_soil_moisture] +#' @examples +#' f_time_norm_focus(25, 20, 25) # 1.37, compare p. 184 +#' +#' D24_2014$meta +#' # No moisture normalisation in the first dataset, so we use f_na = 1 to get +#' # Temperature only normalisation as in the EU evaluation +#' f_time_norm_focus(D24_2014, f_na = 1) +#' # Moisture normalisation for the other four soils is one, as soil moisture +#' # is higher than the approximate field capacity derived from the USDA soil +#' # type +#' @export +f_time_norm_focus <- function(object, ...) { + UseMethod("f_time_norm_focus") +} + +#' @rdname f_time_norm_focus +#' @export +f_time_norm_focus.numeric <- function(object, + moisture = NA, field_moisture = NA, + temperature = object, + Q10 = 2.58, walker = 0.7, f_na = NA, ...) +{ + f_temp <- ifelse(is.na(temperature), + f_na, + ifelse(temperature <= 0, + 0, + Q10^((temperature - 20)/10))) + f_moist <- ifelse(is.na(moisture), + f_na, + ifelse(moisture >= field_moisture, + 1, + (moisture / field_moisture)^walker)) + f_time_norm <- f_temp * f_moist + f_time_norm +} + +#' @rdname f_time_norm_focus +#' @export +f_time_norm_focus.mkindsg <- function(object, Q10 = 2.58, walker = 0.7, f_na = NA, ...) { + meta <- object$meta + field_moisture <- focus_soil_moisture[meta$usda_soil_type, "pF2"] + study_moisture <- meta$rel_moisture * meta$moisture_ref + object$f_time_norm <- f_time_norm_focus(meta$temperature, + moisture = study_moisture, field_moisture = field_moisture, + Q10 = Q10, walker = walker, f_na = f_na) + cat("$time_norm was set to\n") + print(object$f_time_norm) +} diff --git a/R/focus_soil_moisture.R b/R/focus_soil_moisture.R new file mode 100644 index 00000000..7b22fbcc --- /dev/null +++ b/R/focus_soil_moisture.R @@ -0,0 +1,11 @@ +utils::globalVariables("focus_soil_moisture") + +#' FOCUS default values for soil moisture contents at field capacity, MWHC and 1/3 bar +#' +#' @format A matrix with upper case USDA soil classes as row names, and water tension +#' ('pF1', 'pF2', 'pF 2.5') as column names +#' @source Anonymous (2014) Generic Guidance for Tier 1 FOCUS Ground Water Assessment +#' Version 2.2, May 2014 \url{https://esdac.jrc.ec.europa.eu/projects/ground-water} +#' @examples +#' focus_soil_moisture +"focus_soil_moisture" diff --git a/R/mkin_wide_to_long.R b/R/mkin_wide_to_long.R index 971f5273..3d0428d2 100644 --- a/R/mkin_wide_to_long.R +++ b/R/mkin_wide_to_long.R @@ -1,4 +1,4 @@ -if(getRversion() >= '2.15.1') utils::globalVariables(c("name", "time", "value")) +utils::globalVariables(c("name", "time", "value")) #' Convert a dataframe with observations over time into long format #' @@ -1,5 +1,5 @@ #' A dataset class for mkin -#' +#' #' @description #' At the moment this dataset class is hardly used in mkin. For example, #' mkinfit does not take mkinds datasets as argument, but works with dataframes @@ -7,12 +7,11 @@ #' provided by this package come as mkinds objects nevertheless. #' #' @importFrom R6 R6Class -#' @seealso The S3 printing method \code{\link{print.mkinds}} #' @examples -#' +#' #' mds <- mkinds$new("FOCUS A", FOCUS_2006_A) #' print(mds) -#' +#' #' @export mkinds <- R6Class("mkinds", public = list( @@ -62,15 +61,117 @@ mkinds <- R6Class("mkinds", ) #' Print mkinds objects -#' -#' @param x An \code{\link{mkinds}} object. +#' +#' @rdname mkinds +#' @param x An [mkinds] object. +#' @param data Should the data be printed? #' @param \dots Not used. #' @export -print.mkinds <- function(x, ...) { +print.mkinds <- function(x, data = FALSE, ...) { cat("<mkinds> with $title: ", x$title, "\n") cat("Observed compounds $observed: ", paste(x$observed, collapse = ", "), "\n") - cat("Sampling times $sampling_times: ", paste(x$sampling_times, collapse = ", "), "\n") + cat("Sampling times $sampling_times:\n") + cat(paste(x$sampling_times, collapse = ", "), "\n") cat("With a maximum of ", x$replicates, " replicates\n") if (!is.na(x$time_unit)) cat("Time unit: ", x$time_unit, "\n") if (!is.na(x$unit)) cat("Observation unit: ", x$unit, "\n") + if (data) print(mkin_long_to_wide(x$data)) +} + +#' A class for dataset groups for mkin +#' +#' @description +#' A container for working with datasets that share at least one compound, +#' so that combined evaluations are desirable. +#' +#' Time normalisation factors are initialised with a value of 1 for each +#' dataset if no data are supplied. +#' +#' @examples +#' +#' mdsg <- mkindsg$new("Experimental X", experimental_data_for_UBA_2019[6:10]) +#' print(mdsg) +#' print(mdsg, verbose = TRUE) +#' print(mdsg, verbose = TRUE, data = TRUE) +#' +#' @export +mkindsg <- R6Class("mkindsg", + public = list( + + #' @field title A title for the dataset group + title = NULL, + + #' @field ds A list of mkinds objects + ds = NULL, + + #' @field observed_n Occurrence counts of compounds in datasets + observed_n = NULL, + + #' @field f_time_norm Time normalisation factors + f_time_norm = NULL, + + #' @field meta A data frame with a row for each dataset, + #' containing additional information in the form + #' of categorical data (factors) or numerical data + #' (e.g. temperature, moisture, + #' or covariates like soil pH). + meta = NULL, + + #' @description + #' Create a new mkindsg object + #' @param title The title + #' @param ds A list of mkinds objects + #' @param f_time_norm Time normalisation factors + #' @param meta The meta data + initialize = function(title = "", ds, + f_time_norm = rep(1, length(ds)), meta) + { + self$title <- title + if (all(sapply(ds, inherits, "mkinds"))) { + self$ds <- ds + } else { + stop("Please supply a list of mkinds objects") + } + + all_observed <- unlist(lapply(ds, function(x) x$observed)) + observed <- factor(all_observed, levels = unique(all_observed)) + self$observed_n <- table(observed) + names(dimnames(self$observed_n)) <- NULL + self$f_time_norm <- f_time_norm + + if (!missing(meta)) { + self$meta <- meta + } + } + ) +) + +#' Print mkindsg objects +#' +#' @rdname mkindsg +#' @param x An [mkindsg] object. +#' @param verbose Should the mkinds objects be printed? +#' @param data Should the mkinds objects be printed with their data? +#' @param \dots Not used. +#' @export +print.mkindsg <- function(x, data = FALSE, verbose = data, ...) { + cat("<mkindsg> holding", length(x$ds), "mkinds objects\n") + cat("Title $title: ", x$title, "\n") + cat("Occurrene of observed compounds $observed_n:\n") + print(x$observed_n) + if (any(x$f_time_norm != 1)) { + cat("Time normalisation factors $f_time_norm:\n") + print(x$f_time_norm) + } + if (!is.null(x$meta)) { + cat("Meta information $meta:\n") + print(x$meta) + } + if (verbose) { + cat("\nDatasets $ds:") + for (ds in x$ds) { + cat("\n") + print(ds, data = data) + } + } } diff --git a/R/mkinerrmin.R b/R/mkinerrmin.R index f52692ba..388060d4 100644 --- a/R/mkinerrmin.R +++ b/R/mkinerrmin.R @@ -1,4 +1,4 @@ -if(getRversion() >= '2.15.1') utils::globalVariables(c("name", "value_mean")) +utils::globalVariables(c("name", "value_mean")) #' Calculate the minimum error to assume in order to pass the variance test #' diff --git a/R/mkinerrplot.R b/R/mkinerrplot.R index 36e22a43..02a12672 100644 --- a/R/mkinerrplot.R +++ b/R/mkinerrplot.R @@ -1,4 +1,4 @@ -if(getRversion() >= '2.15.1') utils::globalVariables(c("variable", "residual")) +utils::globalVariables(c("variable", "residual")) #' Function to plot squared residuals and the error model for an mkin object #' diff --git a/R/mkinfit.R b/R/mkinfit.R index 7fa1c56e..a6efc858 100644 --- a/R/mkinfit.R +++ b/R/mkinfit.R @@ -1,4 +1,4 @@ -if(getRversion() >= '2.15.1') utils::globalVariables(c("name", "time", "value")) +utils::globalVariables(c("name", "time", "value")) #' Fit a kinetic model to data with one or more state variables #' diff --git a/R/mkinresplot.R b/R/mkinresplot.R index 0bfdd02f..bad28ae8 100644 --- a/R/mkinresplot.R +++ b/R/mkinresplot.R @@ -1,4 +1,4 @@ -if(getRversion() >= '2.15.1') utils::globalVariables(c("variable", "residual")) +utils::globalVariables(c("variable", "residual")) #' Function to plot residuals stored in an mkin object #' diff --git a/R/plot.mixed.mmkin.R b/R/plot.mixed.mmkin.R index 903c3213..0d6b15c0 100644 --- a/R/plot.mixed.mmkin.R +++ b/R/plot.mixed.mmkin.R @@ -1,4 +1,4 @@ -if(getRversion() >= '2.15.1') utils::globalVariables("ds") +utils::globalVariables("ds") #' Plot predictions from a fitted nonlinear mixed model obtained via an mmkin row object #' diff --git a/R/plot.mkinfit.R b/R/plot.mkinfit.R index 48df9483..6ac4e45d 100644 --- a/R/plot.mkinfit.R +++ b/R/plot.mkinfit.R @@ -1,4 +1,4 @@ -if(getRversion() >= '2.15.1') utils::globalVariables(c("type", "variable", "observed")) +utils::globalVariables(c("type", "variable", "observed")) #' Plot the observed data and the fitted model of an mkinfit object #' @@ -102,7 +102,7 @@ saem.mmkin <- function(object, grDevices::png(tmp) } fit_time <- system.time({ - capture.output(f_saemix <- saemix::saemix(m_saemix, d_saemix, control), split = !quiet) + utils::capture.output(f_saemix <- saemix::saemix(m_saemix, d_saemix, control), split = !quiet) f_pred <- try(saemix::saemix.predict(f_saemix), silent = TRUE) if (!inherits(f_pred, "try-error")) { f_saemix <- f_pred diff --git a/data/D24_2014.rda b/data/D24_2014.rda Binary files differnew file mode 100644 index 00000000..78a2a4f4 --- /dev/null +++ b/data/D24_2014.rda diff --git a/data/focus_soil_moisture.rda b/data/focus_soil_moisture.rda Binary files differnew file mode 100644 index 00000000..398e0c6f --- /dev/null +++ b/data/focus_soil_moisture.rda diff --git a/inst/dataset_generation/D24_2014.R b/inst/dataset_generation/D24_2014.R new file mode 100644 index 00000000..bea74da5 --- /dev/null +++ b/inst/dataset_generation/D24_2014.R @@ -0,0 +1,71 @@ +# From the Addendum to the RAR 2014, see the help file for D24_2014 +# Soil characterisation from EFSA conclusion 2014 +D24_2014 <- mkindsg$new( + title = "Aerobic soil degradation data on 2,4-D from the EU assessment in 2014", + ds = list( + mkinds$new("Mississippi", + data.frame( + name = "D24", + time = c(0, 2, 4, 7, 15, 24, 35, 56, 71, 114, 183, 273, 365), + value = c(96.8, 81.0, 81.7, 88.2, 66.3, 72.9, 62.6, 54.6, 35.2, 18.0, + 11.3, 9.9, 6.3)) + ), + mkinds$new("Fayette", + mkin_wide_to_long( + data.frame( + t = rep(c(0, 0.1, 0.3, 1, 3, 5, 10, 17, 26), each = 2), + D24 = c(96.9, 96.6, 93.2, 93.2, 90.5, 91.5, 86.3, 87.1, 79.0, 80.8, + 74.0, 65.6, 35.0, 36.7, 6.6, 4.5, 1.6, 1.7), + DCP = c(NA, NA, 1.4, 1.6, 2.5, 2.4, 2.9, 3.1, 4.4, 4.2, 5.8, 5.4, + 8.2, 8.7, 5.8, 3.8, 1.8, 2.0), + DCA = c(rep(NA, 10), 3.2, 3.5, 9.5, 9.1, 15.0, 13.0, 11.8, 11.7)) + ) + ), + mkinds$new("RefSol 03-G", + mkin_wide_to_long( + data.frame( + t = rep(c(0, 0.1, 0.3, 1, 3, 5, 10, 17, 26), each = 2), + D24 = c(92.9, 93.1, 87.4, 87.9, 78.1, 78.8, 57.1, 56.1, 25.0, 32.3, + 14.7, NA, 3.1, 3.1, 2.7, 2.1, 2.0, 2.2), + DCP = c(NA, NA, 2.8, 2.5, 5.5, 5.4, 8.5, 8.6, 6.7, 5.3, 5.7, NA, + 3.2, 2.7, 2.3, 1.7, 1.3, 1.7), + DCA = c(rep(NA, 6), 3.3, 3.7, 8.0, 7.0, 10.6, NA, 7.7, 7.9, 5.2, + 6.7, 4.6, 4.2)) + ) + ), + mkinds$new("Site E1", + mkin_wide_to_long( + data.frame( + t = rep(c(0, 0.1, 0.3, 1, 3, 7, 10, 17, 26), each = 2), + D24 = c(97.5, 97.9, 97.9, 98.3, 92.4, 91.9, 65.8, 69.5, 37.5, + 40, 18.8, 14.4, 3.3, 5.7, 2.6, 2.3, 2.4, 2), + DCP = c(rep(NA, 4), 1.8, 2.3, 4.4, 3.6, 4.8, 4.3, 3.3, 3.7, + 1.7, 2.3, NA, 0.8, 0.8, 0.8), + DCA = c(rep(NA, 6), 3.9, 2.9, 6.3, 5.4, 5.7, 5.5, 4.5, 4.2, + 3.0, 2.5, 1.5, 1.7)) + ) + ), + mkinds$new("Site I2", + mkin_wide_to_long( + data.frame( + t = rep(c(0, 0.1, 0.3, 1, 3, 5, 10, 17, 26), each = 2), + D24 = c(94.1, 91.6, 90.1, 89.2, 86.3, 86.5, 76.7, 74.7, + 33.1, NA, 8.8, 6.7, 3.1, 3.2, 1.6, 1.7, 1.5, 1.9), + DCP = c(NA, NA, 0.9, 1.2, 1.7, 1.3, 2.5, 5.1, 2.5, NA, + 1.9, 1.7, 0.5, 0.9, 0.9, 1.2, 0.7, NA), + DCA = c(rep(NA, 8), 4.5, NA, 6.6, 5.7, 5.1, 4.3, 2.3, 2.2, + 2.1, 2.1)) + ) + ) + ), + meta = data.frame( + study = c("Cohen 1991", rep("Liu and Adelfinskaya 2011", 4)), + usda_soil_type = c("Silt loam", # p. 683 + "Clay loam", "Clay loam", "Sandy loam", "Sandy loam"), # EFSA 204 p. 41/42 + moisture_ref_type = c(NA, rep("% MWHC", 4)), # p. 687 + rel_moisture = c(NA, 0.5, 0.5, 0.5, 0.5), # p. 687 + moisture_ref = c(NA, 65.7, 59.9, 75.3, 48.5), # p. 687 + temperature = c(25, 20, 20, 20, 20) + ) +) +#save(D24_2014, file = "../../data/D24_2014.rda", version = 2) diff --git a/inst/dataset_generation/focus_soil_moisture.R b/inst/dataset_generation/focus_soil_moisture.R new file mode 100644 index 00000000..bfabc29a --- /dev/null +++ b/inst/dataset_generation/focus_soil_moisture.R @@ -0,0 +1,11 @@ +# FOCUS Generic GW 2014, p. 36 +focus_soil_moisture <- as.matrix( + data.frame( + usda_soil_type = c("Sand", "Loamy sand", "Sandy loam", "Sandy clay loam", + "Clay loam", "Loam", "Silt loam", "Silty clay loam", "Silt", + "Sandy clay", "Silty clay", "Clay"), + pF1 = c(24, 24, 27, 28, 32, 31, 32, 34, 31, 41, 44, 53), + pF2 = c(12, 14, 19, 22, 28, 25, 26, 30, 27, 35, 40, 48), + pF2.5 = c(7, 9, 15, 18, 25, 21, 21, 27, 21, 31, 36, 43), + row.names = "usda_soil_type")) +#save(focus_soil_moisture, file = "../../data/focus_soil_moisture.rda", version = 2) diff --git a/man/D24_2014.Rd b/man/D24_2014.Rd new file mode 100644 index 00000000..90b0605e --- /dev/null +++ b/man/D24_2014.Rd @@ -0,0 +1,42 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/D24_2014.R +\docType{data} +\name{D24_2014} +\alias{D24_2014} +\title{Aerobic soil degradation data on 2,4-D from the EU assessment in 2014} +\format{ +An \link{mkindsg} object grouping five datasets +} +\source{ +Hellenic Ministry of Rural Development and Agriculture (2014) +Final addendum to the Renewal Assessment Report - public version - 2,4-D +Volume 3 Annex B.8 Fate and behaviour in the environment p. 638, 640, +644-646. +\url{http://registerofquestions.efsa.europa.eu/roqFrontend/outputLoader?output=ON-3812} +} +\usage{ +D24_2014 +} +\description{ +The five datasets were extracted from the active substance evaluation dossier +published by EFSA. Kinetic evaluations shown for these datasets are intended +to illustrate and advance kinetic modelling. The fact that these data and +some results are shown here does not imply a license to use them in the +context of pesticide registrations, as the use of the data may be +constrained by data protection regulations. +} +\details{ +Metabolite residues at early sampling times reported as 0.0 were set to NA. + +The R code used to create this data object is installed with this package +in the 'dataset_generation' directory. In the code, page numbers are given for +specific pieces of information in the comments. +} +\examples{ +print(D24_2014) +print(D24_2014$ds[[1]], data = TRUE) +m1 = mkinmod(D24 = list(type = "SFO", to = "phenol"), + phenol = list(type = "SFO", to = "anisole"), + anisole = list(type = "SFO")) +} +\keyword{datasets} diff --git a/man/experimental_data_for_UBA.Rd b/man/experimental_data_for_UBA.Rd index e3386a2f..e28f15d2 100644 --- a/man/experimental_data_for_UBA.Rd +++ b/man/experimental_data_for_UBA.Rd @@ -30,12 +30,12 @@ (Austria, 2015, p. 16). Datasets 6 to 10 are from the Renewal Assessment Report (RAR) for glyphosate - (Germany, 2013a, pages 8, 28, 50, 51). For the initial sampling, + (Germany, 2013, pages 8, 28, 50, 51). For the initial sampling, the residues given for the metabolite were added to the parent value, following the recommendation of the FOCUS kinetics workgroup. Dataset 11 is from the Renewal Assessment Report (RAR) for 2,4-D - (Germany, 2013b, p. 644). Values reported as zero were set to NA, with + (Hellas, 2013, p. 644). Values reported as zero were set to NA, with the exception of the day three sampling of metabolite A2, which was set to one half of the LOD reported to be 1\% AR. @@ -66,10 +66,10 @@ Version 1.1, 18 December 2014 \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} - Germany (2013a). Renewal Assessment Report Glyphosate Volume 3 Annex B.8: Environmental Fate + Germany (2013). Renewal Assessment Report Glyphosate Volume 3 Annex B.8: Environmental Fate and Behaviour - Germany (2013b). Renewal Assessment Report 2,4-D Volume 3 Annex B.8: Fate and behaviour in the + Hellas (2013). Renewal Assessment Report 2,4-D Volume 3 Annex B.8: Fate and behaviour in the environment Ranke (2019) Documentation of results obtained for the error model expertise diff --git a/man/f_time_norm_focus.Rd b/man/f_time_norm_focus.Rd new file mode 100644 index 00000000..9d858312 --- /dev/null +++ b/man/f_time_norm_focus.Rd @@ -0,0 +1,72 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/f_time_norm_focus.R +\name{f_time_norm_focus} +\alias{f_time_norm_focus} +\alias{f_time_norm_focus.numeric} +\alias{f_time_norm_focus.mkindsg} +\title{Normalisation factors for aerobic soil degradation according to FOCUS guidance} +\usage{ +f_time_norm_focus(object, ...) + +\method{f_time_norm_focus}{numeric}( + object, + moisture = NA, + field_moisture = NA, + temperature = object, + Q10 = 2.58, + walker = 0.7, + f_na = NA, + ... +) + +\method{f_time_norm_focus}{mkindsg}(object, Q10 = 2.58, walker = 0.7, f_na = NA, ...) +} +\arguments{ +\item{object}{An object containing information used for the calculations} + +\item{\dots}{Currently not used} + +\item{moisture}{Numeric vector of moisture contents in \\\% w/w} + +\item{field_moisture}{Numeric vector of moisture contents at field capacity +(pF2) in \\\% w/w} + +\item{temperature}{Numeric vector of temperatures in °C} + +\item{Q10}{The Q10 value used for temperature normalisation} + +\item{walker}{The Walker exponent used for moisture normalisation} + +\item{f_na}{The factor to use for NA values. If set to NA, only factors +for complete cases will be returned.} +} +\description{ +Time step normalisation factors for aerobic soil degradation as described +in Appendix 8 to the FOCUS kinetics guidance (FOCUS 2014, p. 369). +} +\examples{ +f_time_norm_focus(25, 20, 25) # 1.37, compare p. 184 + +D24_2014$meta +# No moisture normalisation in the first dataset, so we use f_na = 1 to get +# Temperature only normalisation as in the EU evaluation +f_time_norm_focus(D24_2014, f_na = 1) +# Moisture normalisation for the other four soils is one, as soil moisture +# is higher than the approximate field capacity derived from the USDA soil +# type +} +\references{ +FOCUS (2006) \dQuote{Guidance Document on Estimating Persistence +and Degradation Kinetics from Environmental Fate Studies on Pesticides in +EU Registration} Report of the FOCUS Work Group on Degradation Kinetics, +EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, +\url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} +FOCUS (2014) \dQuote{Generic guidance for Estimating Persistence +and Degradation Kinetics from Environmental Fate Studies on Pesticides in +EU Registration} Report of the FOCUS Work Group on Degradation Kinetics, +Version 1.1, 18 December 2014 +\url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} +} +\seealso{ +\link{focus_soil_moisture} +} diff --git a/man/focus_soil_moisture.Rd b/man/focus_soil_moisture.Rd new file mode 100644 index 00000000..015dd261 --- /dev/null +++ b/man/focus_soil_moisture.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/focus_soil_moisture.R +\docType{data} +\name{focus_soil_moisture} +\alias{focus_soil_moisture} +\title{FOCUS default values for soil moisture contents at field capacity, MWHC and 1/3 bar} +\format{ +A matrix with upper case USDA soil classes as row names, and water tension +('pF1', 'pF2', 'pF 2.5') as column names +} +\source{ +Anonymous (2014) Generic Guidance for Tier 1 FOCUS Ground Water Assessment +Version 2.2, May 2014 \url{https://esdac.jrc.ec.europa.eu/projects/ground-water} +} +\usage{ +focus_soil_moisture +} +\description{ +FOCUS default values for soil moisture contents at field capacity, MWHC and 1/3 bar +} +\examples{ +focus_soil_moisture +} +\keyword{datasets} diff --git a/man/mkinds.Rd b/man/mkinds.Rd index 8d1860e8..4bdd39bb 100644 --- a/man/mkinds.Rd +++ b/man/mkinds.Rd @@ -2,7 +2,18 @@ % Please edit documentation in R/mkinds.R \name{mkinds} \alias{mkinds} +\alias{print.mkinds} \title{A dataset class for mkin} +\usage{ +\method{print}{mkinds}(x, data = FALSE, ...) +} +\arguments{ +\item{x}{An \link{mkinds} object.} + +\item{data}{Should the data be printed?} + +\item{\dots}{Not used.} +} \description{ At the moment this dataset class is hardly used in mkin. For example, mkinfit does not take mkinds datasets as argument, but works with dataframes @@ -15,9 +26,6 @@ mds <- mkinds$new("FOCUS A", FOCUS_2006_A) print(mds) } -\seealso{ -The S3 printing method \code{\link{print.mkinds}} -} \section{Public fields}{ \if{html}{\out{<div class="r6-fields">}} \describe{ diff --git a/man/mkindsg.Rd b/man/mkindsg.Rd new file mode 100644 index 00000000..919d3bb9 --- /dev/null +++ b/man/mkindsg.Rd @@ -0,0 +1,100 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/mkinds.R +\name{mkindsg} +\alias{mkindsg} +\alias{print.mkindsg} +\title{A class for dataset groups for mkin} +\usage{ +\method{print}{mkindsg}(x, data = FALSE, verbose = data, ...) +} +\arguments{ +\item{x}{An \link{mkindsg} object.} + +\item{data}{Should the mkinds objects be printed with their data?} + +\item{verbose}{Should the mkinds objects be printed?} + +\item{\dots}{Not used.} +} +\description{ +A container for working with datasets that share at least one compound, +so that combined evaluations are desirable. + +Time normalisation factors are initialised with a value of 1 for each +dataset if no data are supplied. +} +\examples{ + +mdsg <- mkindsg$new("Experimental X", experimental_data_for_UBA_2019[6:10]) +print(mdsg) +print(mdsg, verbose = TRUE) +print(mdsg, verbose = TRUE, data = TRUE) + +} +\section{Public fields}{ +\if{html}{\out{<div class="r6-fields">}} +\describe{ +\item{\code{title}}{A title for the dataset group} + +\item{\code{ds}}{A list of mkinds objects} + +\item{\code{observed_n}}{Occurrence counts of compounds in datasets} + +\item{\code{f_time_norm}}{Time normalisation factors} + +\item{\code{meta}}{A data frame with a row for each dataset, +containing additional information in the form +of categorical data (factors) or numerical data +(e.g. temperature, moisture, +or covariates like soil pH).} +} +\if{html}{\out{</div>}} +} +\section{Methods}{ +\subsection{Public methods}{ +\itemize{ +\item \href{#method-new}{\code{mkindsg$new()}} +\item \href{#method-clone}{\code{mkindsg$clone()}} +} +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-new"></a>}} +\if{latex}{\out{\hypertarget{method-new}{}}} +\subsection{Method \code{new()}}{ +Create a new mkindsg object +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{mkindsg$new(title = "", ds, f_time_norm = rep(1, length(ds)), meta)}\if{html}{\out{</div>}} +} + +\subsection{Arguments}{ +\if{html}{\out{<div class="arguments">}} +\describe{ +\item{\code{title}}{The title} + +\item{\code{ds}}{A list of mkinds objects} + +\item{\code{f_time_norm}}{Time normalisation factors} + +\item{\code{meta}}{The meta data} +} +\if{html}{\out{</div>}} +} +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-clone"></a>}} +\if{latex}{\out{\hypertarget{method-clone}{}}} +\subsection{Method \code{clone()}}{ +The objects of this class are cloneable with this method. +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{mkindsg$clone(deep = FALSE)}\if{html}{\out{</div>}} +} + +\subsection{Arguments}{ +\if{html}{\out{<div class="arguments">}} +\describe{ +\item{\code{deep}}{Whether to make a deep clone.} +} +\if{html}{\out{</div>}} +} +} +} diff --git a/man/print.mkinds.Rd b/man/print.mkinds.Rd deleted file mode 100644 index 51ef3b76..00000000 --- a/man/print.mkinds.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/mkinds.R -\name{print.mkinds} -\alias{print.mkinds} -\title{Print mkinds objects} -\usage{ -\method{print}{mkinds}(x, ...) -} -\arguments{ -\item{x}{An \code{\link{mkinds}} object.} - -\item{\dots}{Not used.} -} -\description{ -Print mkinds objects -} |