diff --git a/NEWS.md b/NEWS.md index de153a815c687791560c69278e7ea5f0ddc89efa..4426786c1efcf9bb0ddf17e435908e3c5fa9448d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,7 +3,8 @@ * Renamed all instances of "effect" to "survival". * Renamed all instances of "ec" to "lc". * Renamed `predict_mixture()` to `multi_tox()`. -* The argument `proportion_ca` in the mixture model `multi_tox` was renamed and its value reversed. It is now called `sa_contribution` and specifies the proportion of stress addition in the calculation of toxicant stress. To convert your code from the old version use this equation: sa_contribution = 1 - proportion_ca. +* The argument `proportion_ca` in the mixture model `multi_tox()` was renamed and its value reversed. It is now called `sa_contribution` and specifies the proportion of stress addition in the calculation of toxicant stress. To convert your code from the old version use this equation: sa_contribution = 1 - proportion_ca. +* Renamed `stress_tox_sam` to `stress_tox_sa` in the output of `multi_tox()`. # stressaddition 2.7.0 diff --git a/R/multi_tox.R b/R/multi_tox.R index 84a75a6191ba749316eb65d8d9c45fdcbb69a2a1..01c4f8b51da17eddf7f8647dd78075fe6ec0acd3 100644 --- a/R/multi_tox.R +++ b/R/multi_tox.R @@ -96,7 +96,7 @@ multi_tox <- function(model_a, predicted_model_b <- predict_ecxsys(model_b, concentration_b) # tox stress ---------------------------------------------------------- - stress_tox_sam <- predicted_model_a$stress_tox + predicted_model_b$stress_tox + stress_tox_sa <- predicted_model_a$stress_tox + predicted_model_b$stress_tox # Convert the model_b concentration into an equivalent model_a concentration # and vice versa. @@ -129,7 +129,7 @@ multi_tox <- function(model_a, # combined stress and result ------------------------------------------ ca_contribution <- 1 - sa_contribution - stress_tox_total <- stress_tox_sam * sa_contribution + stress_tox_ca * ca_contribution + stress_tox_total <- stress_tox_sa * sa_contribution + stress_tox_ca * ca_contribution stress_total <- stress_tox_total + sys_total survival <- stress_to_survival(stress_total) * survival_max @@ -137,7 +137,7 @@ multi_tox <- function(model_a, concentration_a = concentration_a, concentration_b = concentration_b, survival = survival, - stress_tox_sam = stress_tox_sam, + stress_tox_sa = stress_tox_sa, stress_tox_ca = stress_tox_ca, stress_tox = stress_tox_total, sys = sys_total, diff --git a/tests/testthat/test-multi_tox.R b/tests/testthat/test-multi_tox.R index d1fd5524c72fb153635dcf758e10b29ed0ed5a19..0ac725683ba7e1b5af5eaad57fdd948bbac3be11 100644 --- a/tests/testthat/test-multi_tox.R +++ b/tests/testthat/test-multi_tox.R @@ -45,7 +45,7 @@ test_that("results have not changed", { concentration_a = c(0, 0.01, 0.1, 1, 7, 15), concentration_b = 5, survival = c(88.574578, 84.361552, 80.633762, 56.730550, 2.882718, 0), - stress_tox_sam = c(0.1886787, 0.2436883, 0.3185115, 0.5111081, 0.8904295, 1.0700716), + stress_tox_sa = c(0.1886787, 0.2436883, 0.3185115, 0.5111081, 0.8904295, 1.0700716), stress_tox_ca = c(0.18867873, 0.19199327, 0.21634282, 3.579444e-01, 7.126441e-01, 8.856914e-01), stress_tox = c(0.18867873, 0.22817978, 0.28786093, 4.651590e-01, 8.370939e-01, 1.014758), sys = c(0.07845536, 0.07312129, 0.04004696, 4.663355e-05, 0, 0), @@ -65,7 +65,7 @@ test_that("results have not changed", { concentration_a = c(0, 0.01, 0.1, 1, 7, 15), concentration_b = c(0, 0.02, 0.2, 2, 14, 30), survival = c(88.2698383, 79.96171270, 78.1574808, 6.579998e+01, 3.861678e-01, 0), - stress_tox_sam = c(0, 0.07567745, 0.1807501, 4.510696e-01, 9.961584e-01, 1.294227), + stress_tox_sa = c(0, 0.07567745, 0.1807501, 4.510696e-01, 9.961584e-01, 1.294227), stress_tox_ca = c(0, 0.05654834, 0.1343429, 3.367461e-01, 7.321990e-01, 9.063311e-01), stress_tox = c(0, 0.06993872, 0.1668279, 4.167725e-01, 9.169706e-01, 1.177858), sys = c(0.2698033, 0.26248944, 0.1774490, 1.829786e-04, 0, 0), @@ -86,7 +86,7 @@ test_that("results have not changed", { concentration_a = c(0, 0.01, 0.1, 1, 7, 15), concentration_b = c(0, 0.02, 0.2, 2, 14, 30), survival = c(37.0733321, 33.58391933, 32.8261419, 2.763599e+01, 1.621905e-01, 0), - stress_tox_sam = c(0, 0.07567745, 0.1807501, 4.510696e-01, 9.961584e-01, 1.294227), + stress_tox_sa = c(0, 0.07567745, 0.1807501, 4.510696e-01, 9.961584e-01, 1.294227), stress_tox_ca = c(0, 0.05654834, 0.1343429, 3.367461e-01, 7.321990e-01, 9.063311e-01), stress_tox = c(0, 0.06993872, 0.1668279, 4.167725e-01, 9.169706e-01, 1.177858), sys = c(0.2698033, 0.26248944, 0.1774490, 1.829786e-04, 0, 0),