Skip to content
Snippets Groups Projects
Commit f9afcc9d authored by Sebastian Henz's avatar Sebastian Henz
Browse files

Some renamings and minor restructuring

parent 20b96c8b
No related branches found
No related tags found
1 merge request!30version 3.0.0
......@@ -204,11 +204,26 @@ ecxsys <- function(concentration,
# interpolation between subhormesis and hormesis ----------------------
n_new <- 3 # number of new points
concentration <- interpolate(concentration, hormesis_index, n_new, TRUE)
survival_tox_observed <- interpolate(survival_tox_observed, hormesis_index, n_new)
concentration <- interpolate_sub_horm(
concentration,
hormesis_index - 1,
hormesis_index,
n_new,
TRUE
)
survival_tox_observed <- interpolate_sub_horm(
survival_tox_observed,
hormesis_index - 1,
hormesis_index,
n_new
)
if (with_env) {
survival_tox_env_observed <- interpolate(survival_tox_env_observed,
hormesis_index, n_new)
survival_tox_env_observed <- interpolate_sub_horm(
survival_tox_env_observed,
hormesis_index - 1,
hormesis_index,
n_new
)
}
hormesis_index <- hormesis_index + n_new
# In the output return only the values at the original concentrations
......@@ -435,10 +450,16 @@ fit_LL5_model <- function(min_conc,
}
interpolate <- function(x, to_index, n_new, conc = FALSE) {
from_index <- to_index - 1 # subhormesis_index
interpolate_sub_horm <- function(x,
from_index,
to_index,
n_new,
logarithmic = FALSE) {
# Interpolate between subhormesis and hormesis. This makes the curves
# smoother, less extreme. Without it the slope between subhormesis and
# hormesis would be much steeper in many cases.
len <- n_new + 2 # Add 2 because seq() includes the left and right end.
if (conc) {
if (logarithmic) {
x_new <- 10^seq(log10(x[from_index]), log10(x[to_index]), length.out = len)
} else {
x_new <- seq(x[from_index], x[to_index], length.out = len)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment