Skip to content
Snippets Groups Projects
Commit 1b330d2f authored by Sebastian Henz's avatar Sebastian Henz
Browse files

Merge branch 'first-release' into 'master'

Last changes for first public version. Closes #11.

See merge request !12
parents 1a185912 0c326e31
No related branches found
No related tags found
No related merge requests found
...@@ -4,3 +4,4 @@ ...@@ -4,3 +4,4 @@
^\.Rproj\.user$ ^\.Rproj\.user$
^LICENSE\.md$ ^LICENSE\.md$
^Notizen\.md$ ^Notizen\.md$
^LICENSE\.txt$
...@@ -2,7 +2,7 @@ Package: stressaddition ...@@ -2,7 +2,7 @@ Package: stressaddition
Type: Package Type: Package
Title: Modeling Tri-Phasic Concentration-Response Relationships Title: Modeling Tri-Phasic Concentration-Response Relationships
Version: 1.11.1 Version: 1.11.1
Date: 2020-02-04 Date: 2020-02-13
Authors@R: c(person("Sebastian", Authors@R: c(person("Sebastian",
"Henz", "Henz",
role = c("aut", "cre"), role = c("aut", "cre"),
...@@ -18,8 +18,8 @@ Description: The implementation of the tri-phasic concentration-response model ...@@ -18,8 +18,8 @@ Description: The implementation of the tri-phasic concentration-response model
introduced in "Predicting low-concentration effects of pesticides" by introduced in "Predicting low-concentration effects of pesticides" by
Liess, Henz and Knillmann (2019) <doi: 10.1038/s41598-019-51645-4>. It Liess, Henz and Knillmann (2019) <doi: 10.1038/s41598-019-51645-4>. It
allows modeling of ecotoxicological experiments where the response shows allows modeling of ecotoxicological experiments where the response shows
signs of a hormesis effect. signs of hormesis.
License: none yet License: GPL-3
Copyright: file inst/COPYRIGHTS Copyright: file inst/COPYRIGHTS
URL: https://git.ufz.de/oekotox/stressaddition URL: https://git.ufz.de/oekotox/stressaddition
Encoding: UTF-8 Encoding: UTF-8
......
This diff is collapsed.
# stressaddition 1.11.1
* First public version.
* Added a `NEWS.md` file to track changes to the package.
...@@ -53,5 +53,5 @@ ec <- function(model, effect_name, target_effect) { ...@@ -53,5 +53,5 @@ ec <- function(model, effect_name, target_effect) {
dist <- (target_effect - effect[below]) / (effect[above] - effect[below]) dist <- (target_effect - effect[below]) / (effect[above] - effect[below])
output$concentration <- dist * output$concentration <- dist *
(concentration[above] - concentration[below]) + concentration[below] (concentration[above] - concentration[below]) + concentration[below]
return(output) output
} }
...@@ -124,8 +124,7 @@ ecxsys <- function(concentration, ...@@ -124,8 +124,7 @@ ecxsys <- function(concentration,
stop("effect_max must be >= 0") stop("effect_max must be >= 0")
} }
if (length(concentration) != length(effect_tox_observed)) { if (length(concentration) != length(effect_tox_observed)) {
stop("concentration and effect_tox_observed must have the ", stop("concentration and effect_tox_observed must have the same length.")
"same length.")
} }
if (length(concentration) > length(unique(concentration))) { if (length(concentration) > length(unique(concentration))) {
stop("Concentrations must be unique.") stop("Concentrations must be unique.")
...@@ -139,8 +138,8 @@ ecxsys <- function(concentration, ...@@ -139,8 +138,8 @@ ecxsys <- function(concentration,
stop("Use either hormesis_concentration or hormesis_index but not both.") stop("Use either hormesis_concentration or hormesis_index but not both.")
} else if (!m_hc) { } else if (!m_hc) {
if (!hormesis_concentration %in% concentration) { if (!hormesis_concentration %in% concentration) {
stop("hormesis_concentration must be one of the values in ", stop("hormesis_concentration must be one of the values ",
"concentration.") "in concentration.")
} }
hormesis_index = which(hormesis_concentration == concentration) hormesis_index = which(hormesis_concentration == concentration)
} }
...@@ -162,8 +161,8 @@ ecxsys <- function(concentration, ...@@ -162,8 +161,8 @@ ecxsys <- function(concentration,
all_observations <- effect_tox_observed all_observations <- effect_tox_observed
if (with_env) { if (with_env) {
if (length(effect_tox_observed) != length(effect_tox_env_observed)) { if (length(effect_tox_observed) != length(effect_tox_env_observed)) {
stop("effect_tox_observed and effect_tox_env_observed must have the ", stop("effect_tox_observed and effect_tox_env_observed must have ",
"same length.") "the same length.")
} }
all_observations <- c(all_observations, effect_tox_env_observed) all_observations <- c(all_observations, effect_tox_env_observed)
} }
...@@ -172,8 +171,7 @@ ecxsys <- function(concentration, ...@@ -172,8 +171,7 @@ ecxsys <- function(concentration,
} }
if (any(all_observations > effect_max) || if (any(all_observations > effect_max) ||
any(all_observations < 0)) { any(all_observations < 0)) {
stop("Observed effect must be between 0 and ", stop("Observed effect must be between 0 and effect_max.")
"effect_max.")
} }
conc_shift <- 2 # Powers of ten to shift the control downwards from the conc_shift <- 2 # Powers of ten to shift the control downwards from the
# second lowest concentration. This is required to approximate 0 because # second lowest concentration. This is required to approximate 0 because
...@@ -483,9 +481,6 @@ ecxsys <- function(concentration, ...@@ -483,9 +481,6 @@ ecxsys <- function(concentration,
# also be broken in two. The left part of the axis is supposed to be at # also be broken in two. The left part of the axis is supposed to be at
# 0 but because it's a log axis I have to make the values just really # 0 but because it's a log axis I have to make the values just really
# small. The concentrations in the gap won't be used for plotting later. # small. The concentrations in the gap won't be used for plotting later.
# TODO: Also return the LL.5-curves with and without env.
n_smooth <- 1000 # number of points to approximate the curves n_smooth <- 1000 # number of points to approximate the curves
concentration_smooth <- 10 ^ seq( concentration_smooth <- 10 ^ seq(
log10(min_conc * conc_adjust_factor), log10(min_conc * conc_adjust_factor),
...@@ -496,8 +491,7 @@ ecxsys <- function(concentration, ...@@ -496,8 +491,7 @@ ecxsys <- function(concentration,
output$curves$use_for_plotting <- output$curves$use_for_plotting <-
concentration_smooth < min_conc * conc_adjust_factor * 1.5 | concentration_smooth < min_conc * conc_adjust_factor * 1.5 |
concentration_smooth > min_conc * 1.5 concentration_smooth > min_conc * 1.5
output
return(output)
} }
......
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment