# \donttest{
library(dplyr)
# Example with Lemna model - physiological params
# Before applying the function, a model needs to be calibrated and its parameters profiled
# Inputs for likelihood profiling
# exposure - control run
exp <- Schmitt2013 %>%
filter(ID == "T0") %>%
select(time=t, conc)
# observations - control run
obs <- Schmitt2013 %>%
filter(ID == "T0") %>%
select(t, BM=obs)
# parameters after calibration
params <- c(
k_phot_max = 5.663571,
k_resp = 1.938689,
Topt = 26.7
)
# set parameter boundaries (if different from defaults)
bounds <- list(
k_resp = list(0, 10),
k_phot_max = list(0, 30),
Topt = list(20, 30)
)
# update metsulfuron
myscenario <- metsulfuron %>%
set_init(c(BM = 5, E = 1, M_int = 0)) %>%
set_param(list(
k_0 = 5E-5,
a_k = 0.25,
BM50 = 17600,
mass_per_frond = 0.1
)) %>%
set_exposure(exp) %>%
set_param(params) %>%
set_bounds(bounds)
# Likelihood profiling
res <- lik_profile(
x = myscenario,
data = obs,
output = "BM",
par = params,
refit = FALSE,
type = "fine",
method = "Brent"
)
# plot
plot_lik_profile(res)
# parameter space explorer
set.seed(1) # for reproducibility
res_space <- explore_space(
x = list(caliset(myscenario, obs)),
par = params,
res = res,
output = "BM",
sample_size = 1000,
max_runs = 20,
nr_accept = 100)
plot_param_space(res_space)
# }
Run the code above in your browser using DataLab