-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* make hill_conc value visible * Added tests for set_* * Updated/added tests/params for obj_* * Updated documentation * Increment version number to 0.0.0.9003
- Loading branch information
1 parent
c863616
commit 705e2fb
Showing
12 changed files
with
158 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: GeoTox | ||
Title: Spatiotemporal mixture risk assessment | ||
Version: 0.0.0.9002 | ||
Version: 0.0.0.9003 | ||
Authors@R: c( | ||
person("Skylar", "Marvel", , "[email protected]", role = c("aut", "ctb")), | ||
person("David", "Reif", , "[email protected]", role = c("aut", "ctb")), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
#' Generalized concentration addition objective function | ||
#' | ||
#' @description | ||
#' Use to find the optimal efficacy value, E, based on a regular space AC50 and | ||
#' Use to find the optimal efficacy value based on a regular space AC50 and | ||
#' concentrations. | ||
#' | ||
#' @param effic natural log of individual chemical responses | ||
#' @param Ci individual chemical concentrations in regular space | ||
#' @param tp top asymptote | ||
#' @param AC50 AC50 | ||
#' @param ln_resp natural log of individual chemical responses | ||
#' @param conc individual chemical concentrations in regular space | ||
#' @param max maximal (asymtotic) responses | ||
#' @param AC50 concentrations of half-maximal response | ||
#' | ||
#' @return objective value | ||
obj_GCA <- function(effic, Ci, tp, AC50) { | ||
obj_GCA <- function(ln_resp, conc, max, AC50) { | ||
# Solving for the efficacy on the natural log-scale. This allows for | ||
# better precision in the low values, e.g. 1 x 10-5 | ||
E <- exp(effic) | ||
ECi <- hill_conc(E, tp, AC50, rep(1,length(tp))) | ||
gca.val <- sum(Ci / ECi, na.rm = FALSE) | ||
x <- hill_conc(exp(ln_resp), max, AC50, 1) | ||
gca.val <- sum(conc / x, na.rm = FALSE) | ||
(gca.val - 1)^2 | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
test_that("spot check", { | ||
|
||
conc_mix <- 2 | ||
resp <- 1 | ||
conc <- c(1, 3) | ||
max <- resp * 2 | ||
AC50 <- conc | ||
|
||
expect_equal(obj_ECx(conc_mix, resp, conc, max, AC50), 0) | ||
|
||
conc_mix <- 2 | ||
resp <- c(1, 2) | ||
conc <- c(1, 3) | ||
max <- c(3, 4) | ||
AC50 <- 1 | ||
|
||
expect_equal(obj_ECx(conc_mix, resp, conc, max, AC50), 2.25) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
test_that("spot check", { | ||
|
||
resp <- 1 | ||
ln_resp <- log(resp) | ||
conc <- c(1, 3) | ||
max <- resp * 2 | ||
AC50 <- conc | ||
|
||
expect_equal(obj_GCA(ln_resp, conc, max, AC50), 1) | ||
|
||
resp <- c(1, 2) | ||
ln_resp <- log(resp) | ||
conc <- c(1, 3) | ||
max <- c(3, 4) | ||
AC50 <- 1 | ||
|
||
expect_equal(obj_GCA(ln_resp, conc, max, AC50), 16) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
test_that("region", { | ||
|
||
x <- list(boundaries = NULL) | ||
region <- data.frame(geometry = "test") | ||
|
||
expect_error(set_boundaries(x, region = region)) | ||
|
||
class(region) <- c("sf") | ||
|
||
expect_no_error(x <- set_boundaries(x, region = region)) | ||
|
||
expect_equal(x$boundaries$region, region) | ||
expect_null(x$boundaries$group) | ||
|
||
}) | ||
|
||
test_that("group", { | ||
|
||
x <- list(boundaries = NULL) | ||
group <- data.frame(geometry = "test") | ||
|
||
expect_error(set_boundaries(x, group = group)) | ||
|
||
class(group) <- c("sf") | ||
|
||
expect_no_error(x <- set_boundaries(x, group = group)) | ||
|
||
expect_null(x$boundaries$region) | ||
expect_equal(x$boundaries$group, group) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
test_that("setting", { | ||
|
||
hill_params <- "test" | ||
|
||
x <- list() | ||
|
||
expect_no_warning(x <- set_hill_params(x, hill_params)) | ||
expect_equal(x, list(hill_params = hill_params)) | ||
|
||
}) | ||
|
||
test_that("clear downstream", { | ||
|
||
hill_params <- "test" | ||
|
||
x <- list(resp = "test") | ||
|
||
expect_warning(x <- set_hill_params(x, hill_params)) | ||
expect_equal(x, list(hill_params = hill_params)) | ||
|
||
x <- list(sensitivity = "test") | ||
|
||
expect_warning(x <- set_hill_params(x, hill_params)) | ||
expect_equal(x, list(hill_params = hill_params)) | ||
|
||
}) |