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
Commits
e3dd90d7
Commit
e3dd90d7
authored
5 years ago
by
Sebastian Henz
Browse files
Options
Downloads
Patches
Plain Diff
Add curves_concentration_max argument to ecxsys(),
closes
#29
parent
34e495cd
No related branches found
No related tags found
1 merge request
!21
curves_concentration_max and ec error
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
NEWS.md
+1
-0
1 addition, 0 deletions
NEWS.md
R/ecxsys.R
+21
-8
21 additions, 8 deletions
R/ecxsys.R
man/ecxsys.Rd
+5
-0
5 additions, 0 deletions
man/ecxsys.Rd
tests/testthat/test-ecxsys.R
+1
-0
1 addition, 0 deletions
tests/testthat/test-ecxsys.R
with
28 additions
and
8 deletions
NEWS.md
+
1
−
0
View file @
e3dd90d7
# stressaddition (development version)
# stressaddition (development version)
*
`ec()`
raises an error if the curve does not cross the desired response level.
*
`ec()`
raises an error if the curve does not cross the desired response level.
*
`ecxsys()`
gains a new argument
`curves_concentration_max`
which allows setting the maximum concentration of the predicted curves.
# stressaddition 2.1.1
# stressaddition 2.1.1
...
...
This diff is collapsed.
Click to expand it.
R/ecxsys.R
+
21
−
8
View file @
e3dd90d7
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
#' environmental stress. Must be between 0 and \code{effect_max}.
#' environmental stress. Must be between 0 and \code{effect_max}.
#' @param effect_max The maximum value the effect could possibly reach. For
#' @param effect_max The maximum value the effect could possibly reach. For
#' survival data in percent this should be 100 (the default).
#' survival data in percent this should be 100 (the default).
#' @param curves_concentration_max The maximum concentration of the predicted
#' curves. This might be useful if for example your highest observed
#' concentration is 30 but you would like to know the predicted values at 100.
#' @param p,q The shape parameters of the beta distribution. Default is 3.2.
#' @param p,q The shape parameters of the beta distribution. Default is 3.2.
#'
#'
#' @return A list (of class ecxsys) containing many different objects of which
#' @return A list (of class ecxsys) containing many different objects of which
...
@@ -86,6 +89,7 @@ ecxsys <- function(concentration,
...
@@ -86,6 +89,7 @@ ecxsys <- function(concentration,
effect_tox_observed
,
effect_tox_observed
,
effect_tox_env_observed
=
NULL
,
effect_tox_env_observed
=
NULL
,
effect_max
=
100
,
effect_max
=
100
,
curves_concentration_max
=
NULL
,
p
=
3.2
,
p
=
3.2
,
q
=
3.2
)
{
q
=
3.2
)
{
output
<-
list
(
args
=
as.list
(
environment
()))
output
<-
list
(
args
=
as.list
(
environment
()))
...
@@ -268,23 +272,32 @@ ecxsys <- function(concentration,
...
@@ -268,23 +272,32 @@ ecxsys <- function(concentration,
}
}
#
smooth
curves -------------------------------------------------------
# curves -------------------------------------------------------
# In order to generate a broken x-axis the concentration vector must
# In order to generate a broken x-axis the concentration vector must
# 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.
n_smooth
<-
1000
# number of points to approximate the curves
len_curves
<-
1000
# number of points to approximate the curves
conc_adjust_factor
<-
10
^
-5
conc_adjust_factor
<-
10
^
-5
output
$
conc_adjust_factor
<-
conc_adjust_factor
output
$
conc_adjust_factor
<-
conc_adjust_factor
concentration_smooth
<-
10
^
seq
(
if
(
is.null
(
curves_concentration_max
))
{
curves_concentration_max
<-
max
(
concentration
)
}
else
if
(
curves_concentration_max
<
max
(
concentration
))
{
if
(
curves_concentration_max
<
min
(
concentration
[
concentration
>
0
]))
{
stop
(
"'curves_concentration_max' is too low."
)
}
warning
(
"Your chosen value for 'curves_concentration_max' is less "
,
"than the maximum observed concentration."
)
}
curves_concentration
<-
10
^
seq
(
log10
(
min_conc
*
conc_adjust_factor
),
log10
(
min_conc
*
conc_adjust_factor
),
log10
(
max
(
concentration
)
),
log10
(
curves_
concentration
_max
),
length.out
=
n_smooth
length.out
=
len_curves
)
)
output
$
curves
<-
predict_ecxsys
(
output
,
concentration
_smooth
)
output
$
curves
<-
predict_ecxsys
(
output
,
curves_
concentration
)
output
$
curves
$
use_for_plotting
<-
output
$
curves
$
use_for_plotting
<-
concentration
_smooth
<
min_conc
*
conc_adjust_factor
*
1.5
|
curves_
concentration
<
min_conc
*
conc_adjust_factor
*
1.5
|
concentration
_smooth
>
min_conc
*
1.5
curves_
concentration
>
min_conc
*
1.5
output
output
}
}
...
...
This diff is collapsed.
Click to expand it.
man/ecxsys.Rd
+
5
−
0
View file @
e3dd90d7
...
@@ -10,6 +10,7 @@ ecxsys(
...
@@ -10,6 +10,7 @@ ecxsys(
effect_tox_observed,
effect_tox_observed,
effect_tox_env_observed = NULL,
effect_tox_env_observed = NULL,
effect_max = 100,
effect_max = 100,
curves_concentration_max = NULL,
p = 3.2,
p = 3.2,
q = 3.2
q = 3.2
)
)
...
@@ -31,6 +32,10 @@ environmental stress. Must be between 0 and \code{effect_max}.}
...
@@ -31,6 +32,10 @@ environmental stress. Must be between 0 and \code{effect_max}.}
\item{effect_max}{The maximum value the effect could possibly reach. For
\item{effect_max}{The maximum value the effect could possibly reach. For
survival data in percent this should be 100 (the default).}
survival data in percent this should be 100 (the default).}
\item{curves_concentration_max}{The maximum concentration of the predicted
curves. This might be useful if for example your highest observed
concentration is 30 but you would like to know the predicted values at 100.}
\item{p, q}{The shape parameters of the beta distribution. Default is 3.2.}
\item{p, q}{The shape parameters of the beta distribution. Default is 3.2.}
}
}
\value{
\value{
...
...
This diff is collapsed.
Click to expand it.
tests/testthat/test-ecxsys.R
+
1
−
0
View file @
e3dd90d7
...
@@ -164,6 +164,7 @@ test_that("function arguments are returned unchanged", {
...
@@ -164,6 +164,7 @@ test_that("function arguments are returned unchanged", {
effect_tox_observed
=
c
(
90
,
81
,
92
,
28
,
0
),
effect_tox_observed
=
c
(
90
,
81
,
92
,
28
,
0
),
effect_tox_env_observed
=
c
(
29
,
27
,
33
,
5
,
0
),
effect_tox_env_observed
=
c
(
29
,
27
,
33
,
5
,
0
),
effect_max
=
100
,
effect_max
=
100
,
curves_concentration_max
=
NULL
,
p
=
3.2
,
p
=
3.2
,
q
=
3.2
q
=
3.2
)
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment