
Finite-difference sensitivity for dynamic predictions
Source:R/dynamic_sensitivity.R
dynamic_sensitivity.Rddynamic_sensitivity() perturbs parameters in a dynamic prediction and
returns unscaled and scaled sensitivity coefficients. It is designed as a
lightweight diagnostic for sampling design and parameter identifiability.
Usage
dynamic_sensitivity(
type = c("growth", "inactivation"),
profile,
start,
parameters = NULL,
relative_delta = 1e-06,
times = NULL,
...
)Arguments
- type
Character string. One of
"growth"or"inactivation".- profile
A
dynamic_profile()object or compatible data frame.- start
Named list of parameter values passed to the dynamic prediction function.
- parameters
Character vector of parameter names to perturb. Defaults to all numeric scalar entries in
start.- relative_delta
Relative perturbation size.
- times
Optional output times.
- ...
Additional arguments passed to
predict_dynamic_growth()orpredict_dynamic_inactivation().
Examples
profile <- dynamic_profile(time = c(0, 5, 10), temperature = c(10, 15, 20))
sens <- dynamic_sensitivity(
"growth",
profile = profile,
start = list(logN0 = 2, logNmax = 8, a = 0.08, Tmin = 7, lag = 1),
times = seq(0, 10, by = 2),
dt = 0.25
)
head(sens)
#> time parameter prediction sensitivity scaled_sensitivity
#> 1 0 logN0 2.000000 1.0000000 2.000000
#> 2 2 logN0 2.025812 0.9999999 2.000000
#> 3 4 logN0 2.107644 0.9999997 1.999999
#> 4 6 logN0 2.233674 0.9999993 1.999999
#> 5 8 logN0 2.409684 0.9999984 1.999997
#> 6 10 logN0 2.640966 0.9999966 1.999993