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
26f41388
Commit
26f41388
authored
5 years ago
by
Sebastian Henz
Browse files
Options
Downloads
Patches
Plain Diff
Rename the mixture_effect column to effect
parent
c7d595c2
No related branches found
No related tags found
1 merge request
!27
Some bugfixes and more flexible concentration lengths
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
R/predict_mixture.R
+7
-7
7 additions, 7 deletions
R/predict_mixture.R
man/predict_mixture.Rd
+3
-3
3 additions, 3 deletions
man/predict_mixture.Rd
tests/testthat/test-predict_mixture.R
+5
-5
5 additions, 5 deletions
tests/testthat/test-predict_mixture.R
with
15 additions
and
15 deletions
R/predict_mixture.R
+
7
−
7
View file @
26f41388
...
...
@@ -63,9 +63,9 @@
#' conc_a <- c(0, 0.03, 0.3, 3)
#' conc_b <- rep(5.5, 4)
#' prop_ca <- 0.75
#'
effect
_a <- predict_mixture(toxicant_a , toxicant_b , conc_a, conc_b, prop_ca)
#'
effect
_b <- predict_mixture(toxicant_b , toxicant_a , conc_b, conc_a, prop_ca)
#' identical(
effect_a$mixture_effect, effect_b$mixture_
effect)
#'
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)
#' identical(
mix_a$effect, mix_b$
effect)
#'
#' @export
predict_mixture
<-
function
(
model_a
,
...
...
@@ -129,11 +129,11 @@ predict_mixture <- function(model_a,
proportion_sam
<-
1
-
proportion_ca
stress_tox_total
<-
stress_tox_ca
*
proportion_ca
+
stress_tox_sam
*
proportion_sam
stress_total
<-
stress_tox_total
+
sys_total
mixture_
effect
<-
stress_to_effect
(
stress_total
)
*
effect_max
effect
<-
stress_to_effect
(
stress_total
)
*
effect_max
#
un
name
()
to
remove the
name when
c
on
centration_a is a single number.
mixture_effect
<-
unname
(
mixture_effect
)
data.frame
(
concentration_a
,
concentration_b
,
mixture_effect
)
#
Setting row.
name
s
to
NULL to prevent row
name
s
when on
e of the
# concentrations is a single number.
data.frame
(
concentration_a
,
concentration_b
,
effect
,
row.names
=
NULL
)
}
...
...
This diff is collapsed.
Click to expand it.
man/predict_mixture.Rd
+
3
−
3
View file @
26f41388
...
...
@@ -65,8 +65,8 @@ predict_mixture(
conc_a <- c(0, 0.03, 0.3, 3)
conc_b <- rep(5.5, 4)
prop_ca <- 0.75
effect
_a <- predict_mixture(toxicant_a , toxicant_b , conc_a, conc_b, prop_ca)
effect
_b <- predict_mixture(toxicant_b , toxicant_a , conc_b, conc_a, prop_ca)
identical(
effect_a$mixture_effect, effect_b$mixture_
effect)
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)
identical(
mix_a$effect, mix_b$
effect)
}
This diff is collapsed.
Click to expand it.
tests/testthat/test-predict_mixture.R
+
5
−
5
View file @
26f41388
...
...
@@ -40,7 +40,7 @@ test_that("results have not changed", {
c
(
0
,
0.01
,
0.1
,
1
,
7
,
15
),
rep
(
5
,
6
),
0.3
)
$
mixture_
effect
)
$
effect
reference
<-
c
(
88.574578
,
84.361552
,
80.633762
,
56.730550
,
2.882718
,
0
)
expect_equal
(
new
,
reference
,
tolerance
=
1e-5
)
...
...
@@ -51,7 +51,7 @@ test_that("results have not changed", {
c
(
0
,
0.01
,
0.1
,
1
,
7
,
15
),
c
(
0
,
0.02
,
0.2
,
2
,
14
,
30
),
0.3
)
$
mixture_
effect
)
$
effect
reference
<-
c
(
88.2698383
,
79.9617127
,
78.1574808
,
65.7999834
,
0.3861678
,
0
)
expect_equal
(
new
,
reference
,
tolerance
=
1e-5
)
...
...
@@ -63,7 +63,7 @@ test_that("results have not changed", {
c
(
0
,
0.02
,
0.2
,
2
,
14
,
30
),
0.3
,
42
)
$
mixture_
effect
)
$
effect
reference
<-
c
(
88.2698383
,
79.9617127
,
78.1574808
,
65.7999834
,
0.3861678
,
0
)
*
0.42
expect_equal
(
new
,
reference
,
tolerance
=
1e-5
)
})
...
...
@@ -73,8 +73,8 @@ 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
))
prop_ca
<-
0.8
effect_12
<-
predict_mixture
(
model_a
,
model_b
,
conc_a
,
conc_b
,
prop_ca
)
$
mixture_
effect
effect_21
<-
predict_mixture
(
model_b
,
model_a
,
conc_b
,
conc_a
,
prop_ca
)
$
mixture_
effect
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
expect_equal
(
effect_12
,
effect_21
)
})
...
...
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