Create degradation functions for known analytical solutions

create_deg_func(spec, use_of_ff = c("min", "max"))

Arguments

spec

List of model specifications as contained in mkinmod objects

use_of_ff

Minimum or maximum use of formation fractions

Value

Degradation function to be attached to mkinmod objects

Examples


SFO_SFO <- mkinmod(
  parent = mkinsub("SFO", "m1"),
  m1 = mkinsub("SFO"))
#> Temporary DLL for differentials generated and loaded
FOCUS_D <- subset(FOCUS_2006_D, value != 0) # to avoid warnings
fit_1 <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE)
# \dontrun{
fit_2 <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE)
if (require(rbenchmark))
  benchmark(
    analytical = mkinfit(SFO_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE),
    deSolve = mkinfit(SFO_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE),
    replications = 2)
#> Loading required package: rbenchmark
#>         test replications elapsed relative user.self sys.self user.child
#> 1 analytical            2   0.421    1.000     0.412    0.000          0
#> 2    deSolve            2   0.601    1.428     0.566    0.024          0
#>   sys.child
#> 1         0
#> 2         0
  DFOP_SFO <- mkinmod(
    parent = mkinsub("DFOP", "m1"),
    m1 = mkinsub("SFO"))
#> Temporary DLL for differentials generated and loaded
  benchmark(
    analytical = mkinfit(DFOP_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE),
    deSolve = mkinfit(DFOP_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE),
    replications = 2)
#>         test replications elapsed relative user.self sys.self user.child
#> 1 analytical            2   0.762    1.000     0.758    0.004          0
#> 2    deSolve            2   1.194    1.567     1.140    0.052          0
#>   sys.child
#> 1         0
#> 2         0
# }