aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-05-28 12:24:32 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2020-05-28 12:24:32 +0200
commit609bfe2fd7ecbdcad5f5d641f0db51541dcd6a4e (patch)
tree82384c0441bdf268040ecc29913d820ae26611b6
parent156b82b88dbd73e9370c74b474432b410415046d (diff)
use_of_ff = "max" for shorthand models like "SFO"
-rw-r--r--NEWS.md2
-rw-r--r--R/mkinfit.R2
-rw-r--r--test.log14
-rw-r--r--tests/figs/plotting/mkinparplot-for-focus-c-sfo.svg2
-rw-r--r--tests/testthat/FOCUS_2006_D.csf2
-rw-r--r--tests/testthat/NAFTA_SOP_Appendix_B.txt18
-rw-r--r--tests/testthat/NAFTA_SOP_Appendix_D.txt18
-rw-r--r--tests/testthat/test_confidence.R4
-rw-r--r--tests/testthat/test_nlme.R6
9 files changed, 35 insertions, 33 deletions
diff --git a/NEWS.md b/NEWS.md
index 8f88b64d..0d5c93d3 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -8,6 +8,8 @@
- 'confint(method = 'profile'): Choose accuracy based on 'rel_tol' argument, relative to the bounds obtained by the quadratic approximation
+- 'mkinfit': Make 'use_of_ff' = "max" also the default for models specified using short names like "SFO" or "FOMC"
+
# mkin 0.9.50.2 (2020-05-12)
- Increase tolerance for a platform specific test results on the Solaris test machine on CRAN
diff --git a/R/mkinfit.R b/R/mkinfit.R
index 393473d1..f9cb3304 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -268,7 +268,7 @@ mkinfit <- function(mkinmod, observed,
if (mkinmod[[1]] %in% parent_models_available) {
speclist <- list(list(type = mkinmod, sink = TRUE))
names(speclist) <- presumed_parent_name
- mkinmod <- mkinmod(speclist = speclist, use_of_ff = "min")
+ mkinmod <- mkinmod(speclist = speclist, use_of_ff = "max")
} else {
stop("Argument mkinmod must be of class mkinmod or a string containing one of\n ",
paste(parent_models_available, collapse = ", "))
diff --git a/test.log b/test.log
index 3dcf271d..e026e559 100644
--- a/test.log
+++ b/test.log
@@ -7,28 +7,28 @@ Testing mkin
✔ | 7 | Fitting the SFORB model [3.3 s]
✔ | 5 | Analytical solutions for coupled models [3.1 s]
✔ | 5 | Calculation of Akaike weights
-✔ | 10 | Confidence intervals and p-values [1.0 s]
-✔ | 14 | Error model fitting [3.9 s]
+✔ | 10 | Confidence intervals and p-values [1.1 s]
+✔ | 14 | Error model fitting [4.0 s]
✔ | 4 | Test fitting the decline of metabolites from their maximum [0.3 s]
✔ | 1 | Fitting the logistic model [0.2 s]
✔ | 1 | Test dataset class mkinds used in gmkin
✔ | 12 | Special cases of mkinfit calls [0.6 s]
✔ | 8 | mkinmod model generation and printing [0.2 s]
✔ | 3 | Model predictions with mkinpredict [0.4 s]
-✔ | 16 | Evaluations according to 2015 NAFTA guidance [1.5 s]
+✔ | 16 | Evaluations according to 2015 NAFTA guidance [1.6 s]
✔ | 9 | Nonlinear mixed-effects models [7.7 s]
✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.4 s]
-✔ | 3 | Summary [0.1 s]
-✔ | 14 | Plotting [1.4 s]
+✔ | 3 | Summary
+✔ | 14 | Plotting [1.5 s]
✔ | 4 | AIC calculation
✔ | 4 | Residuals extracted from mkinfit models
✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [1.4 s]
✔ | 1 | Summaries of old mkinfit objects
✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [2.3 s]
-✔ | 9 | Hypothesis tests [6.5 s]
+✔ | 9 | Hypothesis tests [6.6 s]
══ Results ═════════════════════════════════════════════════════════════════════
-Duration: 38.2 s
+Duration: 38.5 s
OK: 159
Failed: 0
diff --git a/tests/figs/plotting/mkinparplot-for-focus-c-sfo.svg b/tests/figs/plotting/mkinparplot-for-focus-c-sfo.svg
index ab517c96..62590397 100644
--- a/tests/figs/plotting/mkinparplot-for-focus-c-sfo.svg
+++ b/tests/figs/plotting/mkinparplot-for-focus-c-sfo.svg
@@ -73,7 +73,7 @@
</defs>
<rect x='472.87' y='414.90' width='5.40' height='5.40' style='stroke-width: 0.75;' clip-path='url(#cpMzAuMjR8Njg5Ljc2fDU0NS43NnwyODkuNDQ=)' />
<line x1='54.67' y1='545.76' x2='54.67' y2='289.44' style='stroke-width: 0.75; stroke-dasharray: 4.00,4.00;' clip-path='url(#cpMzAuMjR8Njg5Ljc2fDU0NS43NnwyODkuNDQ=)' />
-<g clip-path='url(#cpMzAuMjR8Njg5Ljc2fDU0NS43NnwyODkuNDQ=)'><text x='61.87' y='420.35' style='font-size: 12.00px; font-family: Liberation Sans;' textLength='74.70px' lengthAdjust='spacingAndGlyphs'>k_parent_sink</text></g>
+<g clip-path='url(#cpMzAuMjR8Njg5Ljc2fDU0NS43NnwyODkuNDQ=)'><text x='61.87' y='420.35' style='font-size: 12.00px; font-family: Liberation Sans;' textLength='46.69px' lengthAdjust='spacingAndGlyphs'>k_parent</text></g>
<line x1='344.77' y1='417.60' x2='665.33' y2='417.60' style='stroke-width: 0.75;' clip-path='url(#cpMzAuMjR8Njg5Ljc2fDU0NS43NnwyODkuNDQ=)' />
<polyline points='344.77,414.00 344.77,417.60 344.77,421.20 ' style='stroke-width: 0.75;' clip-path='url(#cpMzAuMjR8Njg5Ljc2fDU0NS43NnwyODkuNDQ=)' />
<polyline points='665.33,421.20 665.33,417.60 665.33,414.00 ' style='stroke-width: 0.75;' clip-path='url(#cpMzAuMjR8Njg5Ljc2fDU0NS43NnwyODkuNDQ=)' />
diff --git a/tests/testthat/FOCUS_2006_D.csf b/tests/testthat/FOCUS_2006_D.csf
index 5d946ecd..f845cc1d 100644
--- a/tests/testthat/FOCUS_2006_D.csf
+++ b/tests/testthat/FOCUS_2006_D.csf
@@ -5,7 +5,7 @@ Description:
MeasurementUnits: % AR
TimeUnits: days
Comments: Created using mkin::CAKE_export
-Date: 2020-05-26
+Date: 2020-05-28
Optimiser: IRLS
[Data]
diff --git a/tests/testthat/NAFTA_SOP_Appendix_B.txt b/tests/testthat/NAFTA_SOP_Appendix_B.txt
index 294ea09f..2a23f5da 100644
--- a/tests/testthat/NAFTA_SOP_Appendix_B.txt
+++ b/tests/testthat/NAFTA_SOP_Appendix_B.txt
@@ -7,17 +7,17 @@ Critical sum of squares for checking the SFO model:
Parameters:
$SFO
- Estimate Pr(>t) Lower Upper
-parent_0 51.243 2.12e-10 45.724 56.762
-k_parent_sink 0.253 2.95e-06 0.193 0.332
-sigma 3.529 1.28e-04 2.061 4.997
+ Estimate Pr(>t) Lower Upper
+parent_0 51.243 2.12e-10 45.724 56.762
+k_parent 0.253 2.95e-06 0.193 0.332
+sigma 3.529 1.28e-04 2.061 4.997
$IORE
- Estimate Pr(>t) Lower Upper
-parent_0 51.71053 2.60e-14 4.97e+01 53.68122
-k__iore_parent_sink 0.00135 5.21e-02 3.88e-04 0.00469
-N_parent 2.66147 3.67e-08 2.23e+00 3.08855
-sigma 1.25124 1.76e-04 7.24e-01 1.77811
+ Estimate Pr(>t) Lower Upper
+parent_0 51.71053 2.60e-14 4.97e+01 53.68122
+k__iore_parent 0.00135 5.21e-02 3.88e-04 0.00469
+N_parent 2.66147 3.67e-08 2.23e+00 3.08855
+sigma 1.25124 1.76e-04 7.24e-01 1.77811
$DFOP
Estimate Pr(>t) Lower Upper
diff --git a/tests/testthat/NAFTA_SOP_Appendix_D.txt b/tests/testthat/NAFTA_SOP_Appendix_D.txt
index 375830b7..c0b7035c 100644
--- a/tests/testthat/NAFTA_SOP_Appendix_D.txt
+++ b/tests/testthat/NAFTA_SOP_Appendix_D.txt
@@ -7,17 +7,17 @@ Critical sum of squares for checking the SFO model:
Parameters:
$SFO
- Estimate Pr(>t) Lower Upper
-parent_0 83.7558 1.80e-14 77.18268 90.3288
-k_parent_sink 0.0017 7.43e-05 0.00112 0.0026
-sigma 8.7518 1.22e-05 5.64278 11.8608
+ Estimate Pr(>t) Lower Upper
+parent_0 83.7558 1.80e-14 77.18268 90.3288
+k_parent 0.0017 7.43e-05 0.00112 0.0026
+sigma 8.7518 1.22e-05 5.64278 11.8608
$IORE
- Estimate Pr(>t) Lower Upper
-parent_0 9.69e+01 NA 8.88e+01 1.05e+02
-k__iore_parent_sink 8.40e-14 NA 1.79e-18 3.94e-09
-N_parent 6.68e+00 NA 4.19e+00 9.17e+00
-sigma 5.85e+00 NA 3.76e+00 7.94e+00
+ Estimate Pr(>t) Lower Upper
+parent_0 9.69e+01 NA 8.88e+01 1.05e+02
+k__iore_parent 8.40e-14 NA 1.79e-18 3.94e-09
+N_parent 6.68e+00 NA 4.19e+00 9.17e+00
+sigma 5.85e+00 NA 3.76e+00 7.94e+00
$DFOP
Estimate Pr(>t) Lower Upper
diff --git a/tests/testthat/test_confidence.R b/tests/testthat/test_confidence.R
index e85fdb7a..3fdd3f2c 100644
--- a/tests/testthat/test_confidence.R
+++ b/tests/testthat/test_confidence.R
@@ -67,9 +67,9 @@ test_that("Likelihood profile based confidence intervals work", {
f <- fits[["SFO", "FOCUS_C"]]
# negative log-likelihood for use with mle
- f_nll <- function(parent_0, k_parent_sink, sigma) {
+ f_nll <- function(parent_0, k_parent, sigma) {
- f$ll(c(parent_0 = as.numeric(parent_0),
- k_parent_sink = as.numeric(k_parent_sink),
+ k_parent = as.numeric(k_parent),
sigma = as.numeric(sigma)))
}
f_mle <- stats4::mle(f_nll, start = as.list(parms(f)), nobs = nrow(FOCUS_2006_C))
diff --git a/tests/testthat/test_nlme.R b/tests/testthat/test_nlme.R
index 31fb19de..5a8db142 100644
--- a/tests/testthat/test_nlme.R
+++ b/tests/testthat/test_nlme.R
@@ -51,10 +51,10 @@ test_that("nlme_function works correctly", {
m_nlme_mmkin <- nlme(f)
- m_nlme_raw_2 <- nlme(value ~ SSasymp(time, 0, parent_0, log_k_parent_sink),
+ m_nlme_raw_2 <- nlme(value ~ SSasymp(time, 0, parent_0, log_k_parent),
data = grouped_data,
- fixed = parent_0 + log_k_parent_sink ~ 1,
- random = pdDiag(parent_0 + log_k_parent_sink ~ 1),
+ fixed = parent_0 + log_k_parent ~ 1,
+ random = pdDiag(parent_0 + log_k_parent ~ 1),
start = mean_degparms(f, random = TRUE))
expect_equal(m_nlme_raw_2$coefficients, m_nlme_mmkin$coefficients)

Contact - Imprint