From 6e5630a0df7e857697ff2ce4730a5f7f45b67377 Mon Sep 17 00:00:00 2001
From: Johannes Ranke
Date: Sat, 26 Oct 2019 22:52:53 +0200
Subject: Fix checks and tests
Static documentation rebuilt by pkgdown
---
DESCRIPTION | 3 +-
NAMESPACE | 1 +
R/confint.mkinfit.R | 4 +-
R/parms.mkinfit.R | 1 +
_pkgdown.yml | 12 +-
docs/news/index.html | 1 +
docs/reference/confint.mkinfit.html | 252 +++++++++++++++++++++
docs/reference/index.html | 24 +-
docs/reference/parms.html | 200 ++++++++++++++++
docs/sitemap.xml | 6 +
man/confint.mkinfit.Rd | 6 +-
man/parms.Rd | 4 +-
test.log | 18 +-
.../plotting/plot-errmod-with-sfo-lin-a-obs.svg | 12 +-
tests/testthat/FOCUS_2006_D.csf | 2 +-
15 files changed, 513 insertions(+), 33 deletions(-)
create mode 100644 docs/reference/confint.mkinfit.html
create mode 100644 docs/reference/parms.html
diff --git a/DESCRIPTION b/DESCRIPTION
index 9efa2b89..88412fa8 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -17,8 +17,7 @@ Description: Calculation routines based on the FOCUS Kinetics Report (2006,
equation models are solved using compiled C functions. Please note that no
warranty is implied for correctness of results or fitness for a particular
purpose.
-Imports: stats, graphics, methods, deSolve, R6, inline, parallel, plyr,
- numDeriv
+Imports: stats, graphics, methods, deSolve, R6, inline, parallel, numDeriv
Suggests: knitr, rbenchmark, tikzDevice, testthat, rmarkdown, covr, vdiffr,
benchmarkme, tibble
License: GPL
diff --git a/NAMESPACE b/NAMESPACE
index b4b781ac..3718f45f 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -71,6 +71,7 @@ importFrom(stats,optimize)
importFrom(stats,pt)
importFrom(stats,qchisq)
importFrom(stats,qf)
+importFrom(stats,qnorm)
importFrom(stats,qt)
importFrom(stats,rnorm)
importFrom(utils,write.table)
diff --git a/R/confint.mkinfit.R b/R/confint.mkinfit.R
index 58918321..58a3c8db 100644
--- a/R/confint.mkinfit.R
+++ b/R/confint.mkinfit.R
@@ -28,7 +28,9 @@
#' @examples
#' f <- mkinfit("SFO", FOCUS_2006_C, quiet = TRUE)
#' confint(f, method = "quadratic")
-#' confint(f, method = "profile")
+#' \dontrun{
+#' confint(f, method = "profile")
+#' }
#' @export
confint.mkinfit <- function(object, parm,
level = 0.95, alpha = 1 - level,
diff --git a/R/parms.mkinfit.R b/R/parms.mkinfit.R
index 8f9b4136..0628cb92 100644
--- a/R/parms.mkinfit.R
+++ b/R/parms.mkinfit.R
@@ -5,6 +5,7 @@
#' considering the error structure that was assumed for the fit.
#'
#' @param object A fitted model object
+#' @param \dots Not used
#' @return A numeric vector of fitted model parameters
#' @export
parms <- function(object, ...)
diff --git a/_pkgdown.yml b/_pkgdown.yml
index d51a7f27..bbf63301 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -17,13 +17,15 @@ reference:
desc: Functions working with mkinfit objects
contents:
- plot.mkinfit
+ - parms.mkinfit
+ - confint.mkinfit
- summary.mkinfit
- - mkinresplot
- - mkinparplot
- - mkinerrplot
- - endpoints
- - mkinerrmin
- logLik.mkinfit
+ - mkinresplot
+ - mkinparplot
+ - mkinerrplot
+ - endpoints
+ - mkinerrmin
- title: Work with mmkin objects
desc: Functions working with aggregated results
contents:
diff --git a/docs/news/index.html b/docs/news/index.html
index 67f64150..1322f75d 100644
--- a/docs/news/index.html
+++ b/docs/news/index.html
@@ -134,6 +134,7 @@
mkin 0.9.49.6 (unreleased) Unreleased
+
Add ‘parms’ and ‘confint’ methods for mkinfit objects. Confidence intervals based on the quadratic approximation as in the summary, and based on the profile likelihood
Move long-running tests to tests/testthat/slow with a separate test log. They currently take around 7 minutes on my system
‘mkinfit’: Clean the code and return functions to calculate the log-likelihood and the sum of squared residuals
Vignette ‘twa.html’: Add the maximum time weighted average formulas for the hockey stick model
A vector of names of the parameters which are to be given
+confidence intervals. If missing, all parameters are considered.
+
+
+
level
+
The confidence level required
+
+
+
alpha
+
The allowed error probability, overrides 'level' if specified.
+
+
+
method
+
The 'profile' method searches the parameter space for the
+cutoff of the confidence intervals by means of a likelihood ratio test.
+The 'quadratic' method approximates the likelihood function at the
+optimised parameters using the second term of the Taylor expansion, using
+a second derivative (hessian) contained in the object.
+
+
+
transformed
+
If the quadratic approximation is used, should it be
+applied to the likelihood based on the transformed parameters?
+
+
+
backtransform
+
If we approximate the likelihood in terms of the
+transformed parameters, should we backtransform the parameters with
+their confidence intervals?
+
+
+
distribution
+
For the quadratic approximation, should we use
+the student t distribution or assume normal distribution for
+the parameter estimate
+
+
+
quiet
+
Should we suppress messages?
+
+
+
...
+
Not used
+
+
+
+
Value
+
+
A matrix with columns giving lower and upper confidence limits for
+ each parameter.
+
References
+
+
Pawitan Y (2013) In all likelihood - Statistical modelling and
+ inference using likelihood. Clarendon Press, Oxford.
This function always returns degradation model parameters as well as error
+model parameters, in order to avoid working with a fitted model without
+considering the error structure that was assumed for the fit.