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

Remove concentration vector length restriction

parent 24704632
No related branches found
No related tags found
1 merge request!27Some bugfixes and more flexible concentration lengths
Pipeline #3034 failed with stage
in 10 minutes and 17 seconds
Package: stressaddition
Type: Package
Title: Modeling Tri-Phasic Concentration-Response Relationships
Version: 2.4.1
Version: 2.5.0
Date: 2020-03-16
Authors@R: c(person("Sebastian",
"Henz",
......
# stressaddition 2.4.1
# stressaddition 2.5.0
* Fixed unintended behaviour in `plot_effect()` and `plot_stress()` where supplying an empty vector caused the four standard curves to show. Now setting `which` to an empty vector or `NULL` shows just the axes. The default value is NA.
* Renamed the `mixture_effect` column in the `predict_mixture` output data frame to `effect`.
* Remove the restriction that the concentration vectors in `predict_mixture()` must be the same length. The longer length must be a multiple of the shorter length because the shorter vector gets recycled to the longer length.
# stressaddition 2.4.0
......
......@@ -31,7 +31,9 @@
#'
#' @param model_a,model_b The ecxsys models of the toxicants.
#' @param concentration_a,concentration_b The concentrations of the toxicants in
#' the mixture. Both vectors must be the same length.
#' the mixture. Both vectors must either be the same length or the longer
#' length must be a multiple of the shorter length. That's because the shorter
#' concentration vector gets recycled to the length of the longer one.
#' @param proportion_ca The proportion of concentration addition in the
#' calculation of the toxicant stress of the mixture. Must be between 0 and 1.
#' @param effect_max Controls the scaling of the result. This represents the
......@@ -61,7 +63,7 @@
#'
#' # Example of symmetric prediction:
#' conc_a <- c(0, 0.03, 0.3, 3)
#' conc_b <- rep(5.5, 4)
#' conc_b <- 5.5
#' prop_ca <- 0.75
#' mix_a <- predict_mixture(toxicant_a , toxicant_b , conc_a, conc_b, prop_ca)
#' mix_b <- predict_mixture(toxicant_b , toxicant_a , conc_b, conc_a, prop_ca)
......@@ -81,7 +83,6 @@ predict_mixture <- function(model_a,
is.numeric(concentration_b),
length(concentration_a) > 0,
length(concentration_b) > 0,
length(concentration_a) == length(concentration_b),
all(!is.na(concentration_a)),
all(!is.na(concentration_b)),
proportion_ca >= 0,
......
......@@ -17,7 +17,9 @@ predict_mixture(
\item{model_a, model_b}{The ecxsys models of the toxicants.}
\item{concentration_a, concentration_b}{The concentrations of the toxicants in
the mixture. Both vectors must be the same length.}
the mixture. Both vectors must either be the same length or the longer
length must be a multiple of the shorter length. That's because the shorter
concentration vector gets recycled to the length of the longer one.}
\item{proportion_ca}{The proportion of concentration addition in the
calculation of the toxicant stress of the mixture. Must be between 0 and 1.}
......@@ -63,7 +65,7 @@ predict_mixture(
# Example of symmetric prediction:
conc_a <- c(0, 0.03, 0.3, 3)
conc_b <- rep(5.5, 4)
conc_b <- 5.5
prop_ca <- 0.75
mix_a <- predict_mixture(toxicant_a , toxicant_b , conc_a, conc_b, prop_ca)
mix_b <- predict_mixture(toxicant_b , toxicant_a , conc_b, conc_a, prop_ca)
......
......@@ -38,7 +38,7 @@ test_that("results have not changed", {
model_a,
model_b,
c(0, 0.01, 0.1, 1, 7, 15),
rep(5, 6),
5,
0.3
)$effect
reference <- c(88.574578, 84.361552, 80.633762, 56.730550, 2.882718, 0)
......@@ -71,7 +71,7 @@ test_that("results have not changed", {
test_that("predictions are symmetric", {
conc_a <- c(0, 10^seq(log10(0.001), log10(40), length.out = 50))
conc_b <- rep(3.5, length(conc_a))
conc_b <- 3.5
prop_ca <- 0.8
effect_12 <- predict_mixture(model_a, model_b, conc_a, conc_b, prop_ca)$effect
effect_21 <- predict_mixture(model_b, model_a, conc_b, conc_a, prop_ca)$effect
......
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