Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stressaddition
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
oekotox
stressaddition
Merge requests
!24
Better predict_mixture documentation
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Better predict_mixture documentation
develop
into
master
Overview
0
Commits
5
Pipelines
2
Changes
21
Merged
Sebastian Henz
requested to merge
develop
into
master
5 years ago
Overview
0
Commits
5
Pipelines
2
Changes
4
Expand
description
Add symmetry example to predict_mixture documentation.
Add license notice to every code file and to the readme.
system details
RStudio Version: 1.2.5033
R Version: 3.6.3
OS Version: Windows 10 x64 (build 18363)
checklist
This merge introduces new features.
new features are documented
new features have tests
update documentation including examples (if necessary)
update and polish NEWS.md
update version in DESCRIPTION
update date in DESCRIPTION
no remaining TODO, FIXME, or debug prints anywhere in the source files
devtools::document()
devtools::check()
without errors or warnings
Edited
5 years ago
by
Sebastian Henz
👍
0
👎
0
Merge request reports
Viewing commit
963aa053
Prev
Next
Show latest version
4 files
+
68
−
9
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
963aa053
Add symmetry example for predict_mixture
· 963aa053
Sebastian Henz
authored
5 years ago
R/predict_mixture.R
+
31
−
4
Options
#' Predict the effect of a mixture of two toxicants
#'
#' Given the ecxsys models of two toxicants this method predicts the effects of
#' different mixtures of both.
#'
#' The prediction happens at one or multiple concentrations of toxicant 1 and
#' one concentration of toxicant 2. This allows for easy plotting over the
#' concentrations of toxicant 1.
#'
#' The predictions are symmetric, i.e. it does not matter which of the toxicant
#' models is 1 or 2 as long as the concentration arguments are supplied
#' in the right order. See the example below.
#'
#' This method is only suitable for experiments without environmental stress.
#' Any environmental stress in \code{model_1} or \code{model_2} is ignored.
#'
@@ -13,23 +24,39 @@
#' @return A vector of the effects of the mixture, scaled to the effect_max
#' value of model_1.
#'
#' @examples toxicant_
model_
1 <- ecxsys(
#' @examples toxicant_1
<- ecxsys(
#' concentration = c(0, 0.05, 0.5, 5, 30),
#' hormesis_concentration = 0.5,
#' effect_tox_observed = c(90, 81, 92, 28, 0),
#' )
#' toxicant_
model_
2 <- ecxsys(
#' toxicant_2
<- ecxsys(
#' concentration = c(0, 0.1, 1, 10, 100, 1000),
#' hormesis_concentration = 10,
#' effect_tox_observed = c(26, 25, 24, 27, 5, 0),
#' effect_max = 30
#' )
#' predict_mixture(
#' toxicant_
model_
1,
#' toxicant_
model_
2,
#' toxicant_1
,
#' toxicant_2
,
#' c(0, 0.02, 0.2, 2, 20),
#' 3
#' )
#'
#' # Example of symmetric prediction:
#' conc_1 <- c(0, 0.03, 0.3, 3)
#' conc_2 <- 5.5
#' prop_ca <- 0.75
#' effect_a <- predict_mixture(toxicant_1 , toxicant_2 , conc_1, conc_2, prop_ca)
#' effect_b <- sapply(
#' conc_1,
#' function(x) predict_mixture(toxicant_2 , toxicant_1 , conc_2, x, prop_ca)
#' )
#' # The effect_max values of the models are different. effect_b is scaled to
#' # the one from toxicant 2 but to compare the results effect_b must be scaled
#' # to the effect_max of toxicant 1:
#' effect_b <- effect_b / toxicant_2 $args$effect_max * toxicant_1$args$effect_max
#' identical(effect_a, effect_b)
#'
#' @export
predict_mixture
<-
function
(
model_1
,
model_2
,
Loading