diff options
31 files changed, 653 insertions, 215 deletions
@@ -1,4 +1,4 @@ -# mkin 0.9.47.6 (2019-01-31) +# mkin 0.9.48.1 (2019-02-21) - Add the function 'logLik.mkinfit' which makes it possible to calculate an AIC for mkinfit objects @@ -16,6 +16,8 @@ - Add the function 'CAKE_export' to facilitate cross-checking of results +- Implement the logistic model (only tested for parent fits) + # mkin 0.9.47.5 (2018-09-14) - Make the two-component error model stop in cases where it is inadequate to avoid nls crashes on windows diff --git a/R/endpoints.R b/R/endpoints.R index ac1e3e7c..80450185 100644 --- a/R/endpoints.R +++ b/R/endpoints.R @@ -159,6 +159,14 @@ endpoints <- function(fit) { ep$distimes[obs_var, c(paste("DT50", obs_var, "b1", sep = "_"))] = DT50_b1
ep$distimes[obs_var, c(paste("DT50", obs_var, "b2", sep = "_"))] = DT50_b2
}
+ if (type == "logistic") {
+ # FOCUS kinetics (2014) p. 67
+ kmax = parms.all["kmax"]
+ k0 = parms.all["k0"]
+ r = parms.all["r"]
+ DT50 = (1/r) * log(1 - ((kmax/k0) * (1 - 2^(r/kmax))))
+ DT90 = (1/r) * log(1 - ((kmax/k0) * (1 - 10^(r/kmax))))
+ }
ep$distimes[obs_var, c("DT50", "DT90")] = c(DT50, DT90)
}
return(ep)
diff --git a/R/logistic.solution.R b/R/logistic.solution.R new file mode 100644 index 00000000..a3bddab3 --- /dev/null +++ b/R/logistic.solution.R @@ -0,0 +1,4 @@ +logistic.solution <- function(t, parent.0, kmax, k0, r) +{ + parent = parent.0 * (kmax / (kmax - k0 + k0 * exp (r * t))) ^(kmax/r) +} diff --git a/R/mkinfit.R b/R/mkinfit.R index b27f67b4..40413125 100644 --- a/R/mkinfit.R +++ b/R/mkinfit.R @@ -1,4 +1,4 @@ -# Copyright (C) 2010-2018 Johannes Ranke
+# Copyright (C) 2010-2019 Johannes Ranke
# Portions of this code are copyright (C) 2013 Eurofins Regulatory AG
# Contact: jranke@uni-bremen.de
# The summary function is an adapted and extended version of summary.modFit
@@ -48,7 +48,7 @@ mkinfit <- function(mkinmod, observed, {
# Check mkinmod and generate a model for the variable whith the highest value
# if a suitable string is given
- parent_models_available = c("SFO", "FOMC", "DFOP", "HS", "SFORB", "IORE")
+ parent_models_available = c("SFO", "FOMC", "DFOP", "HS", "SFORB", "IORE", "logistic")
if (class(mkinmod) != "mkinmod") {
presumed_parent_name = observed[which.max(observed$value), "name"]
if (mkinmod[[1]] %in% parent_models_available) {
@@ -153,6 +153,9 @@ mkinfit <- function(mkinmod, observed, if (parmname == "k2") parms.ini[parmname] = 0.01
if (parmname == "tb") parms.ini[parmname] = 5
if (parmname == "g") parms.ini[parmname] = 0.5
+ if (parmname == "kmax") parms.ini[parmname] = 0.1
+ if (parmname == "k0") parms.ini[parmname] = 0.0001
+ if (parmname == "r") parms.ini[parmname] = 0.2
}
# Default values for formation fractions in case they are present
for (box in mod_vars) {
@@ -376,7 +379,7 @@ mkinfit <- function(mkinmod, observed, lower[index_k] <- 0
index_k__iore <- grep("^k__iore_", names(lower))
lower[index_k__iore] <- 0
- other_rate_parms <- intersect(c("alpha", "beta", "k1", "k2", "tb"), names(lower))
+ other_rate_parms <- intersect(c("alpha", "beta", "k1", "k2", "tb", "r"), names(lower))
lower[other_rate_parms] <- 0
}
diff --git a/R/mkinmod.R b/R/mkinmod.R index 491b3d0a..2805ef54 100644 --- a/R/mkinmod.R +++ b/R/mkinmod.R @@ -1,4 +1,4 @@ -# Copyright (C) 2010-2015 Johannes Ranke {{{
+# Copyright (C) 2010-2015,2019 Johannes Ranke {{{
# Contact: jranke@uni-bremen.de
# This file is part of the R package mkin
@@ -42,8 +42,8 @@ mkinmod <- function(..., use_of_ff = "min", speclist = NULL, quiet = FALSE, verb parms <- vector()
# }}}
- # Do not return a coefficient matrix mat when FOMC, IORE, DFOP or HS is used for the parent {{{
- if(spec[[1]]$type %in% c("FOMC", "IORE", "DFOP", "HS")) {
+ # Do not return a coefficient matrix mat when FOMC, IORE, DFOP, HS or logistic is used for the parent {{{
+ if(spec[[1]]$type %in% c("FOMC", "IORE", "DFOP", "HS", "logistic")) {
mat = FALSE
} else mat = TRUE
#}}}
@@ -57,10 +57,10 @@ mkinmod <- function(..., use_of_ff = "min", speclist = NULL, quiet = FALSE, verb # Check the type component of the compartment specification {{{
if(is.null(spec[[varname]]$type)) stop(
"Every part of the model specification must be a list containing a type component")
- if(!spec[[varname]]$type %in% c("SFO", "FOMC", "IORE", "DFOP", "HS", "SFORB")) stop(
- "Available types are SFO, FOMC, IORE, DFOP, HS and SFORB only")
- if(spec[[varname]]$type %in% c("FOMC", "DFOP", "HS") & match(varname, obs_vars) != 1) {
- stop(paste("Types FOMC, DFOP and HS are only implemented for the first compartment,",
+ if(!spec[[varname]]$type %in% c("SFO", "FOMC", "IORE", "DFOP", "HS", "SFORB", "logistic")) stop(
+ "Available types are SFO, FOMC, IORE, DFOP, HS, SFORB and logistic only")
+ if(spec[[varname]]$type %in% c("FOMC", "DFOP", "HS", "logistic") & match(varname, obs_vars) != 1) {
+ stop(paste("Types FOMC, DFOP, HS and logistic are only implemented for the first compartment,",
"which is assumed to be the source compartment"))
}
#}}}
@@ -71,6 +71,7 @@ mkinmod <- function(..., use_of_ff = "min", speclist = NULL, quiet = FALSE, verb IORE = varname,
DFOP = varname,
HS = varname,
+ logistic = varname,
SFORB = paste(varname, c("free", "bound"), sep = "_")
)
map[[varname]] <- new_boxes
@@ -141,6 +142,11 @@ mkinmod <- function(..., use_of_ff = "min", speclist = NULL, quiet = FALSE, verb decline_term <- paste(HS_decline, "*", box_1)
parms <- c(parms, "k1", "k2", "tb")
} #}}}
+ if(spec[[varname]]$type == "logistic") { # {{{ Add logistic decline term
+ # From p. 67 of the FOCUS kinetics report (2014)
+ decline_term <- paste("(k0 * kmax)/(k0 + (kmax - k0) * exp(-r * time)) *", box_1)
+ parms <- c(parms, "kmax", "k0", "r")
+ } #}}}
# Add origin decline term to box 1 (usually the only box, unless type is SFORB)#{{{
diffs[[box_1]] <- paste(diffs[[box_1]], "-", decline_term)#}}}
if(spec[[varname]]$type == "SFORB") { # {{{ Add SFORB reversible binding terms
diff --git a/R/mkinpredict.R b/R/mkinpredict.R index 8e0823a8..c36d724a 100644 --- a/R/mkinpredict.R +++ b/R/mkinpredict.R @@ -1,4 +1,4 @@ -# Copyright (C) 2010-2016,2018 Johannes Ranke +# Copyright (C) 2010-2016,2018,2019 Johannes Ranke # Some lines in this code are copyright (C) 2013 Eurofins Regulatory AG # Contact: jranke@uni-bremen.de @@ -83,7 +83,11 @@ mkinpredict.mkinmod <- function(x, evalparse(parent.name), evalparse(paste("k", parent.name, "bound", sep="_")), evalparse(paste("k", sub("free", "bound", parent.name), "free", sep="_")), - evalparse(paste("k", parent.name, "sink", sep="_"))) + evalparse(paste("k", parent.name, "sink", sep="_"))), + logistic = logistic.solution(outtimes, + evalparse(parent.name), + evalparse("kmax"), evalparse("k0"), + evalparse("r")) ) out <- data.frame(outtimes, o) names(out) <- c("time", sub("_free", "", parent.name)) diff --git a/R/transform_odeparms.R b/R/transform_odeparms.R index c871c52a..f69f4ebd 100644 --- a/R/transform_odeparms.R +++ b/R/transform_odeparms.R @@ -1,4 +1,4 @@ -# Copyright (C) 2010-2014 Johannes Ranke
+# Copyright (C) 2010-2014,2019 Johannes Ranke
# Contact: jranke@uni-bremen.de
# This file is part of the R package mkin
@@ -71,8 +71,9 @@ transform_odeparms <- function(parms, mkinmod, }
# Transform also FOMC parameters alpha and beta, DFOP and HS rates k1 and k2
- # and HS parameter tb if transformation of rates is requested
- for (pname in c("alpha", "beta", "k1", "k2", "tb")) {
+ # and HS parameter tb as well as logistic model parameters kmax, k0 and r if
+ # transformation of rates is requested
+ for (pname in c("alpha", "beta", "k1", "k2", "tb", "kmax", "k0", "r")) {
if (!is.na(parms[pname])) {
if (transform_rates) {
transparms[paste0("log_", pname)] <- log(parms[pname])
@@ -151,8 +152,8 @@ backtransform_odeparms <- function(transparms, mkinmod, }
}
- # Transform parameters also for FOMC, DFOP and HS models
- for (pname in c("alpha", "beta", "k1", "k2", "tb")) {
+ # Transform parameters also for FOMC, DFOP, HS and logistic models
+ for (pname in c("alpha", "beta", "k1", "k2", "tb", "kmax", "k0", "r")) {
if (transform_rates) {
pname_trans = paste0("log_", pname)
if (!is.na(transparms[pname_trans])) {
diff --git a/README.html b/README.html index 411eea10..800ed3cb 100644 --- a/README.html +++ b/README.html @@ -11,7 +11,7 @@ -<title>README.utf8</title> +<title>README.utf8.md</title> <script>/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function qa(){}qa.prototype=d.filters=d.pseudos,d.setFilters=new qa,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function ra(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1; @@ -275,9 +275,15 @@ img { .tabbed-pane { padding-top: 12px; } +.html-widget { + margin-bottom: 20px; +} button.code-folding-btn:focus { outline: none; } +summary { + display: list-item; +} </style> @@ -285,10 +291,71 @@ button.code-folding-btn:focus { <div class="container-fluid main-container"> <!-- tabsets --> + +<style type="text/css"> +.tabset-dropdown > .nav-tabs { + display: inline-table; + max-height: 500px; + min-height: 44px; + overflow-y: auto; + background: white; + border: 1px solid #ddd; + border-radius: 4px; +} + +.tabset-dropdown > .nav-tabs > li.active:before { + content: ""; + font-family: 'Glyphicons Halflings'; + display: inline-block; + padding: 10px; + border-right: 1px solid #ddd; +} + +.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before { + content: ""; + border: none; +} + +.tabset-dropdown > .nav-tabs.nav-tabs-open:before { + content: ""; + font-family: 'Glyphicons Halflings'; + display: inline-block; + padding: 10px; + border-right: 1px solid #ddd; +} + +.tabset-dropdown > .nav-tabs > li.active { + display: block; +} + +.tabset-dropdown > .nav-tabs > li > a, +.tabset-dropdown > .nav-tabs > li > a:focus, +.tabset-dropdown > .nav-tabs > li > a:hover { + border: none; + display: inline-block; + border-radius: 4px; +} + +.tabset-dropdown > .nav-tabs.nav-tabs-open > li { + display: block; + float: none; +} + +.tabset-dropdown > .nav-tabs > li { + display: none; +} +</style> + <script> $(document).ready(function () { window.buildTabsets("TOC"); }); + +$(document).ready(function () { + $('.tabset-dropdown > .nav-tabs > li').click(function () { + $(this).parent().toggleClass('nav-tabs-open') + }); +}); </script> <!-- code folding --> @@ -297,7 +364,6 @@ $(document).ready(function () { - <div class="fluid-row" id="header"> @@ -308,7 +374,7 @@ $(document).ready(function () { <div id="mkin" class="section level1"> <h1>mkin</h1> -<p><a href="https://cran.r-project.org/package=mkin"><img src="data:image/svg+xml; charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMjAiPgogIDxsaW5lYXJHcmFkaWVudCBpZD0iYiIgeDI9IjAiIHkyPSIxMDAlIj4KICAgIDxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2JiYiIgc3RvcC1vcGFjaXR5PSIuMSIvPgogICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLW9wYWNpdHk9Ii4xIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8bWFzayBpZD0iYSI+CiAgICA8cmVjdCB3aWR0aD0iMTAwIiBoZWlnaHQ9IjIwIiByeD0iMyIgZmlsbD0iI2ZmZiIvPgogIDwvbWFzaz4KICA8ZyBtYXNrPSJ1cmwoI2EpIj4KICAgIDxwYXRoIGZpbGw9IiM1NTUiIGQ9Ik0wIDBoNDN2MjBIMHoiLz4KICAgIDxwYXRoIGZpbGw9IiM0YzEiIGQ9Ik00MyAwaDc5LjV2MjBINDN6Ii8+CiAgICA8cGF0aCBmaWxsPSJ1cmwoI2IpIiBkPSJNMCAwaDEwMHYyMEgweiIvPgogIDwvZz4KICA8ZyBmaWxsPSIjZmZmIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIgogICAgIGZvbnQtZmFtaWx5PSJEZWphVnUgU2FucyxWZXJkYW5hLEdlbmV2YSxzYW5zLXNlcmlmIiBmb250LXNpemU9IjExIj4KICAgIDx0ZXh0IHg9IjIxLjUiIHk9IjE1IiBmaWxsPSIjMDEwMTAxIiBmaWxsLW9wYWNpdHk9Ii4zIj4KICAgICAgQ1JBTgogICAgPC90ZXh0PgogICAgPHRleHQgeD0iMjEuNSIgeT0iMTQiPgogICAgICBDUkFOCiAgICA8L3RleHQ+CiAgICA8dGV4dCB4PSI3MC41IiB5PSIxNSIgZmlsbD0iIzAxMDEwMSIgZmlsbC1vcGFjaXR5PSIuMyI+CiAgICAgIDAuOS40Ny4yCiAgICA8L3RleHQ+CiAgICA8dGV4dCB4PSI3MC41IiB5PSIxNCI+CiAgICAgIDAuOS40Ny4yCiAgICA8L3RleHQ+CiAgPC9nPgo8L3N2Zz4=" /></a></p> +<p><a href="https://cran.r-project.org/package=mkin"><img src="data:image/svg+xml; charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMjAiPgogIDxsaW5lYXJHcmFkaWVudCBpZD0iYiIgeDI9IjAiIHkyPSIxMDAlIj4KICAgIDxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2JiYiIgc3RvcC1vcGFjaXR5PSIuMSIvPgogICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLW9wYWNpdHk9Ii4xIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8bWFzayBpZD0iYSI+CiAgICA8cmVjdCB3aWR0aD0iMTAwIiBoZWlnaHQ9IjIwIiByeD0iMyIgZmlsbD0iI2ZmZiIvPgogIDwvbWFzaz4KICA8ZyBtYXNrPSJ1cmwoI2EpIj4KICAgIDxwYXRoIGZpbGw9IiM1NTUiIGQ9Ik0wIDBoNDN2MjBIMHoiLz4KICAgIDxwYXRoIGZpbGw9IiM0YzEiIGQ9Ik00MyAwaDc5LjV2MjBINDN6Ii8+CiAgICA8cGF0aCBmaWxsPSJ1cmwoI2IpIiBkPSJNMCAwaDEwMHYyMEgweiIvPgogIDwvZz4KICA8ZyBmaWxsPSIjZmZmIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIgogICAgIGZvbnQtZmFtaWx5PSJEZWphVnUgU2FucyxWZXJkYW5hLEdlbmV2YSxzYW5zLXNlcmlmIiBmb250LXNpemU9IjExIj4KICAgIDx0ZXh0IHg9IjIxLjUiIHk9IjE1IiBmaWxsPSIjMDEwMTAxIiBmaWxsLW9wYWNpdHk9Ii4zIj4KICAgICAgQ1JBTgogICAgPC90ZXh0PgogICAgPHRleHQgeD0iMjEuNSIgeT0iMTQiPgogICAgICBDUkFOCiAgICA8L3RleHQ+CiAgICA8dGV4dCB4PSI3MC41IiB5PSIxNSIgZmlsbD0iIzAxMDEwMSIgZmlsbC1vcGFjaXR5PSIuMyI+CiAgICAgIDAuOS40Ny41CiAgICA8L3RleHQ+CiAgICA8dGV4dCB4PSI3MC41IiB5PSIxNCI+CiAgICAgIDAuOS40Ny41CiAgICA8L3RleHQ+CiAgPC9nPgo8L3N2Zz4=" /></a> <a href="https://travis-ci.com/jranke/mkin"><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI5MCIgaGVpZ2h0PSIyMCI+PGxpbmVhckdyYWRpZW50IGlkPSJhIiB4Mj0iMCIgeTI9IjEwMCUiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2JiYiIgc3RvcC1vcGFjaXR5PSIuMSIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1vcGFjaXR5PSIuMSIvPjwvbGluZWFyR3JhZGllbnQ+PHJlY3Qgcng9IjMiIHdpZHRoPSI5MCIgaGVpZ2h0PSIyMCIgZmlsbD0iIzU1NSIvPjxyZWN0IHJ4PSIzIiB4PSIzNyIgd2lkdGg9IjUzIiBoZWlnaHQ9IjIwIiBmaWxsPSIjNGMxIi8+PHBhdGggZmlsbD0iIzRjMSIgZD0iTTM3IDBoNHYyMGgtNHoiLz48cmVjdCByeD0iMyIgd2lkdGg9IjkwIiBoZWlnaHQ9IjIwIiBmaWxsPSJ1cmwoI2EpIi8+PGcgZmlsbD0iI2ZmZiIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1mYW1pbHk9IkRlamFWdSBTYW5zLFZlcmRhbmEsR2VuZXZhLHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMTEiPjx0ZXh0IHg9IjE5LjUiIHk9IjE1IiBmaWxsPSIjMDEwMTAxIiBmaWxsLW9wYWNpdHk9Ii4zIj5idWlsZDwvdGV4dD48dGV4dCB4PSIxOS41IiB5PSIxNCI+YnVpbGQ8L3RleHQ+PHRleHQgeD0iNjIuNSIgeT0iMTUiIGZpbGw9IiMwMTAxMDEiIGZpbGwtb3BhY2l0eT0iLjMiPnBhc3Npbmc8L3RleHQ+PHRleHQgeD0iNjIuNSIgeT0iMTQiPnBhc3Npbmc8L3RleHQ+PC9nPjwvc3ZnPg==" alt="Build Status" /></a></p> <p>The R package <strong>mkin</strong> provides calculation routines for the analysis of chemical degradation data, including <b>m</b>ulticompartment <b>kin</b>etics as needed for modelling the formation and decline of transformation products, or if several compartments are involved.</p> <div id="installation" class="section level2"> <h2>Installation</h2> diff --git a/_pkgdown.yml b/_pkgdown.yml index 4cc81fad..20854d5b 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -61,6 +61,7 @@ reference: - SFORB.solution - HS.solution - IORE.solution + - logistic.solution - title: Generate synthetic datasets contents: - add_err diff --git a/docs/articles/FOCUS_D.html b/docs/articles/FOCUS_D.html index 9acab53a..6a8500a0 100644 --- a/docs/articles/FOCUS_D.html +++ b/docs/articles/FOCUS_D.html @@ -85,7 +85,7 @@ <h1>Example evaluation of FOCUS Example Dataset D</h1> <h4 class="author">Johannes Ranke</h4> - <h4 class="date">2019-01-31</h4> + <h4 class="date">2019-02-21</h4> <div class="hidden name"><code>FOCUS_D.Rmd</code></div> @@ -161,10 +161,10 @@ <p><img src="FOCUS_D_files/figure-html/plot_2-1.png" width="768"></p> <p>A comprehensive report of the results is obtained using the <code>summary</code> method for <code>mkinfit</code> objects.</p> <div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb10-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(fit)</a></code></pre></div> -<pre><code>## mkin version used for fitting: 0.9.47.5 +<pre><code>## mkin version used for fitting: 0.9.47.6 ## R version used for fitting: 3.5.2 -## Date of fit: Thu Jan 31 16:52:37 2019 -## Date of summary: Thu Jan 31 16:52:38 2019 +## Date of fit: Thu Feb 21 14:32:03 2019 +## Date of summary: Thu Feb 21 14:32:04 2019 ## ## Equations: ## d_parent/dt = - k_parent_sink * parent - k_parent_m1 * parent @@ -172,7 +172,7 @@ ## ## Model predictions using solution type deSolve ## -## Fitted with method Port using 153 model solutions performed in 0.695 s +## Fitted with method Port using 153 model solutions performed in 0.735 s ## ## Weighting: none ## diff --git a/docs/articles/FOCUS_L.html b/docs/articles/FOCUS_L.html index e3ca9aff..265dd96c 100644 --- a/docs/articles/FOCUS_L.html +++ b/docs/articles/FOCUS_L.html @@ -85,7 +85,7 @@ <h1>Example evaluation of FOCUS Laboratory Data L1 to L3</h1> <h4 class="author">Johannes Ranke</h4> - <h4 class="date">2019-01-31</h4> + <h4 class="date">2019-02-21</h4> <div class="hidden name"><code>FOCUS_L.Rmd</code></div> @@ -109,17 +109,17 @@ <p>Since mkin version 0.9-32 (July 2014), we can use shorthand notation like <code>"SFO"</code> for parent only degradation models. The following two lines fit the model and produce the summary report of the model fit. This covers the numerical analysis given in the FOCUS report.</p> <div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1">m.L1.SFO <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(<span class="st">"SFO"</span>, FOCUS_<span class="dv">2006</span>_L1_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>)</a> <a class="sourceLine" id="cb2-2" data-line-number="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(m.L1.SFO)</a></code></pre></div> -<pre><code>## mkin version used for fitting: 0.9.47.5 +<pre><code>## mkin version used for fitting: 0.9.47.6 ## R version used for fitting: 3.5.2 -## Date of fit: Thu Jan 31 16:52:39 2019 -## Date of summary: Thu Jan 31 16:52:39 2019 +## Date of fit: Thu Feb 21 14:32:06 2019 +## Date of summary: Thu Feb 21 14:32:06 2019 ## ## Equations: ## d_parent/dt = - k_parent_sink * parent ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 37 model solutions performed in 0.094 s +## Fitted with method Port using 37 model solutions performed in 0.097 s ## ## Weighting: none ## @@ -200,17 +200,17 @@ <a class="sourceLine" id="cb6-2" data-line-number="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/plot">plot</a></span>(m.L1.FOMC, <span class="dt">show_errmin =</span> <span class="ot">TRUE</span>, <span class="dt">main =</span> <span class="st">"FOCUS L1 - FOMC"</span>)</a></code></pre></div> <p><img src="FOCUS_L_files/figure-html/unnamed-chunk-6-1.png" width="576"></p> <div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(m.L1.FOMC, <span class="dt">data =</span> <span class="ot">FALSE</span>)</a></code></pre></div> -<pre><code>## mkin version used for fitting: 0.9.47.5 +<pre><code>## mkin version used for fitting: 0.9.47.6 ## R version used for fitting: 3.5.2 -## Date of fit: Thu Jan 31 16:52:41 2019 -## Date of summary: Thu Jan 31 16:52:41 2019 +## Date of fit: Thu Feb 21 14:32:08 2019 +## Date of summary: Thu Feb 21 14:32:08 2019 ## ## Equations: ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 611 model solutions performed in 1.49 s +## Fitted with method Port using 611 model solutions performed in 1.547 s ## ## Weighting: none ## @@ -295,17 +295,17 @@ <a class="sourceLine" id="cb11-3" data-line-number="3"> <span class="dt">main =</span> <span class="st">"FOCUS L2 - FOMC"</span>)</a></code></pre></div> <p><img src="FOCUS_L_files/figure-html/unnamed-chunk-9-1.png" width="672"></p> <div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(m.L2.FOMC, <span class="dt">data =</span> <span class="ot">FALSE</span>)</a></code></pre></div> -<pre><code>## mkin version used for fitting: 0.9.47.5 +<pre><code>## mkin version used for fitting: 0.9.47.6 ## R version used for fitting: 3.5.2 -## Date of fit: Thu Jan 31 16:52:42 2019 -## Date of summary: Thu Jan 31 16:52:42 2019 +## Date of fit: Thu Feb 21 14:32:08 2019 +## Date of summary: Thu Feb 21 14:32:08 2019 ## ## Equations: ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 81 model solutions performed in 0.198 s +## Fitted with method Port using 81 model solutions performed in 0.201 s ## ## Weighting: none ## @@ -366,10 +366,10 @@ <a class="sourceLine" id="cb14-3" data-line-number="3"> <span class="dt">main =</span> <span class="st">"FOCUS L2 - DFOP"</span>)</a></code></pre></div> <p><img src="FOCUS_L_files/figure-html/unnamed-chunk-10-1.png" width="672"></p> <div class="sourceCode" id="cb15"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb15-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(m.L2.DFOP, <span class="dt">data =</span> <span class="ot">FALSE</span>)</a></code></pre></div> -<pre><code>## mkin version used for fitting: 0.9.47.5 +<pre><code>## mkin version used for fitting: 0.9.47.6 ## R version used for fitting: 3.5.2 -## Date of fit: Thu Jan 31 16:52:43 2019 -## Date of summary: Thu Jan 31 16:52:43 2019 +## Date of fit: Thu Feb 21 14:32:09 2019 +## Date of summary: Thu Feb 21 14:32:09 2019 ## ## Equations: ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * @@ -378,7 +378,7 @@ ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 336 model solutions performed in 0.839 s +## Fitted with method Port using 336 model solutions performed in 0.86 s ## ## Weighting: none ## @@ -458,10 +458,10 @@ <p>The objects returned by mmkin are arranged like a matrix, with models as a row index and datasets as a column index.</p> <p>We can extract the summary and plot for <em>e.g.</em> the DFOP fit, using square brackets for indexing which will result in the use of the summary and plot functions working on mkinfit objects.</p> <div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(mm.L3[[<span class="st">"DFOP"</span>, <span class="dv">1</span>]])</a></code></pre></div> -<pre><code>## mkin version used for fitting: 0.9.47.5 +<pre><code>## mkin version used for fitting: 0.9.47.6 ## R version used for fitting: 3.5.2 -## Date of fit: Thu Jan 31 16:52:44 2019 -## Date of summary: Thu Jan 31 16:52:44 2019 +## Date of fit: Thu Feb 21 14:32:10 2019 +## Date of summary: Thu Feb 21 14:32:11 2019 ## ## Equations: ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * @@ -470,7 +470,7 @@ ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 137 model solutions performed in 0.341 s +## Fitted with method Port using 137 model solutions performed in 0.351 s ## ## Weighting: none ## @@ -559,17 +559,17 @@ <p><img src="FOCUS_L_files/figure-html/unnamed-chunk-15-1.png" width="700"></p> <p>The <span class="math inline">\(\chi^2\)</span> error level of 3.3% as well as the plot suggest that the SFO model fits very well. The error level at which the <span class="math inline">\(\chi^2\)</span> test passes is slightly lower for the FOMC model. However, the difference appears negligible.</p> <div class="sourceCode" id="cb26"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb26-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(mm.L4[[<span class="st">"SFO"</span>, <span class="dv">1</span>]], <span class="dt">data =</span> <span class="ot">FALSE</span>)</a></code></pre></div> -<pre><code>## mkin version used for fitting: 0.9.47.5 +<pre><code>## mkin version used for fitting: 0.9.47.6 ## R version used for fitting: 3.5.2 -## Date of fit: Thu Jan 31 16:52:44 2019 -## Date of summary: Thu Jan 31 16:52:45 2019 +## Date of fit: Thu Feb 21 14:32:11 2019 +## Date of summary: Thu Feb 21 14:32:11 2019 ## ## Equations: ## d_parent/dt = - k_parent_sink * parent ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 46 model solutions performed in 0.11 s +## Fitted with method Port using 46 model solutions performed in 0.113 s ## ## Weighting: none ## @@ -619,17 +619,17 @@ ## DT50 DT90 ## parent 106 352</code></pre> <div class="sourceCode" id="cb28"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb28-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(mm.L4[[<span class="st">"FOMC"</span>, <span class="dv">1</span>]], <span class="dt">data =</span> <span class="ot">FALSE</span>)</a></code></pre></div> -<pre><code>## mkin version used for fitting: 0.9.47.5 +<pre><code>## mkin version used for fitting: 0.9.47.6 ## R version used for fitting: 3.5.2 -## Date of fit: Thu Jan 31 16:52:45 2019 -## Date of summary: Thu Jan 31 16:52:45 2019 +## Date of fit: Thu Feb 21 14:32:11 2019 +## Date of summary: Thu Feb 21 14:32:11 2019 ## ## Equations: ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 66 model solutions performed in 0.162 s +## Fitted with method Port using 66 model solutions performed in 0.168 s ## ## Weighting: none ## diff --git a/docs/articles/mkin.html b/docs/articles/mkin.html index 488ca302..c5b0d9c1 100644 --- a/docs/articles/mkin.html +++ b/docs/articles/mkin.html @@ -85,7 +85,7 @@ <h1>Introduction to mkin</h1> <h4 class="author">Johannes Ranke</h4> - <h4 class="date">2019-01-31</h4> + <h4 class="date">2019-02-21</h4> <div class="hidden name"><code>mkin.Rmd</code></div> diff --git a/docs/articles/twa.html b/docs/articles/twa.html index d50b23ba..8a1f82a8 100644 --- a/docs/articles/twa.html +++ b/docs/articles/twa.html @@ -85,7 +85,7 @@ <h1>Calculation of time weighted average concentrations with mkin</h1> <h4 class="author">Johannes Ranke</h4> - <h4 class="date">2019-01-31</h4> + <h4 class="date">2019-02-21</h4> <div class="hidden name"><code>twa.Rmd</code></div> diff --git a/docs/articles/web_only/FOCUS_Z.html b/docs/articles/web_only/FOCUS_Z.html index 84bd971f..c55abdbc 100644 --- a/docs/articles/web_only/FOCUS_Z.html +++ b/docs/articles/web_only/FOCUS_Z.html @@ -85,7 +85,7 @@ <h1>Example evaluation of FOCUS dataset Z</h1> <h4 class="author">Johannes Ranke</h4> - <h4 class="date">2019-01-31</h4> + <h4 class="date">2019-02-21</h4> <div class="hidden name"><code>FOCUS_Z.Rmd</code></div> diff --git a/docs/articles/web_only/compiled_models.html b/docs/articles/web_only/compiled_models.html index 08bb9b44..3a37d114 100644 --- a/docs/articles/web_only/compiled_models.html +++ b/docs/articles/web_only/compiled_models.html @@ -85,7 +85,7 @@ <h1>Performance benefit by using compiled model definitions in mkin</h1> <h4 class="author">Johannes Ranke</h4> - <h4 class="date">2019-01-31</h4> + <h4 class="date">2019-02-21</h4> <div class="hidden name"><code>compiled_models.Rmd</code></div> @@ -126,9 +126,9 @@ <a class="sourceLine" id="cb5-16" data-line-number="16">}</a></code></pre></div> <pre><code>## Lade nötiges Paket: rbenchmark</code></pre> <pre><code>## test replications elapsed relative user.self sys.self -## 3 deSolve, compiled 3 2.353 1.000 2.352 0 -## 1 deSolve, not compiled 3 17.619 7.488 17.609 0 -## 2 Eigenvalue based 3 2.899 1.232 2.898 0 +## 3 deSolve, compiled 3 2.429 1.000 2.427 0 +## 1 deSolve, not compiled 3 17.826 7.339 17.815 0 +## 2 Eigenvalue based 3 2.968 1.222 2.967 0 ## user.child sys.child ## 3 0 0 ## 1 0 0 @@ -157,13 +157,13 @@ <a class="sourceLine" id="cb8-16" data-line-number="16">}</a></code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> <pre><code>## test replications elapsed relative user.self sys.self -## 2 deSolve, compiled 3 4.180 1.000 4.177 0 -## 1 deSolve, not compiled 3 37.331 8.931 37.312 0 +## 2 deSolve, compiled 3 4.234 1.000 4.232 0 +## 1 deSolve, not compiled 3 37.807 8.929 37.785 0 ## user.child sys.child ## 2 0 0 ## 1 0 0</code></pre> <p>Here we get a performance benefit of a factor of 9 using the version of the differential equation model compiled from C code!</p> -<p>This vignette was built with mkin 0.9.47.5 on</p> +<p>This vignette was built with mkin 0.9.47.6 on</p> <pre><code>## R version 3.5.2 (2018-12-20) ## Platform: x86_64-pc-linux-gnu (64-bit) ## Running under: Debian GNU/Linux 9 (stretch)</code></pre> diff --git a/docs/news/index.html b/docs/news/index.html index 7736a28d..4a4d71fe 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -119,9 +119,9 @@ </div> - <div id="mkin-0-9-47-6-2019-01-31" class="section level1"> + <div id="mkin-0-9-48-1-2019-02-21" class="section level1"> <h1 class="page-header"> -<a href="#mkin-0-9-47-6-2019-01-31" class="anchor"></a>mkin 0.9.47.6 (2019-01-31)<small> Unreleased </small> +<a href="#mkin-0-9-48-1-2019-02-21" class="anchor"></a>mkin 0.9.48.1 (2019-02-21)<small> Unreleased </small> </h1> <ul> <li><p>Add the function ‘logLik.mkinfit’ which makes it possible to calculate an AIC for mkinfit objects</p></li> @@ -132,6 +132,7 @@ <li><p>‘mkinfit’: Improve the correctness of the fitted two component error model by fitting the mean absolute deviance at each observation against the observed values, weighting with the current two-component error model</p></li> <li><p>‘tests/testthat/test_irls.R’: Test if the components of the error model used to generate the data can be reproduced with moderate accuracy</p></li> <li><p>Add the function ‘CAKE_export’ to facilitate cross-checking of results</p></li> +<li><p>Implement the logistic model (only tested for parent fits)</p></li> </ul> </div> <div id="mkin-0-9-47-5-2018-09-14" class="section level1"> @@ -675,7 +676,7 @@ <div id="tocnav"> <h2>Contents</h2> <ul class="nav nav-pills nav-stacked"> - <li><a href="#mkin-0-9-47-6-2019-01-31">0.9.47.6</a></li> + <li><a href="#mkin-0-9-48-1-2019-02-21">0.9.48.1</a></li> <li><a href="#mkin-0-9-47-5-2018-09-14">0.9.47.5</a></li> <li><a href="#mkin-0-9-47-3">0.9.47.3</a></li> <li><a href="#mkin-0-9-47-2-2018-07-19">0.9.47.2</a></li> diff --git a/docs/reference/Extract.mmkin.html b/docs/reference/Extract.mmkin.html index 2a1d63b5..dd088a0f 100644 --- a/docs/reference/Extract.mmkin.html +++ b/docs/reference/Extract.mmkin.html @@ -280,7 +280,7 @@ #> #> $time #> User System verstrichen -#> 0.197 0.000 0.198 +#> 0.196 0.000 0.196 #> #> $mkinmod #> <mkinmod> model generated with @@ -469,8 +469,8 @@ #> } #> return(mC) #> } -#> <bytecode: 0x55555916c520> -#> <environment: 0x55555b68a808> +#> <bytecode: 0x555559201470> +#> <environment: 0x555555ce4640> #> #> $cost_notrans #> function (P) @@ -492,8 +492,8 @@ #> scaleVar = scaleVar) #> return(mC) #> } -#> <bytecode: 0x55555a1242b0> -#> <environment: 0x55555b68a808> +#> <bytecode: 0x55555a3214d8> +#> <environment: 0x555555ce4640> #> #> $hessian_notrans #> parent_0 k_parent_sink @@ -560,7 +560,7 @@ #> 99.17407 #> #> $date -#> [1] "Thu Jan 31 16:50:45 2019" +#> [1] "Thu Feb 21 14:30:10 2019" #> #> $version #> [1] "0.9.47.6" diff --git a/docs/reference/index.html b/docs/reference/index.html index 7dd32430..78eb0337 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -419,6 +419,12 @@ <p><code><a href="IORE.solution.html">IORE.solution()</a></code> </p> </td> <td><p>Indeterminate order rate equation kinetics</p></td> + </tr><tr> + + <td> + <p><code><a href="logistic.solution.html">logistic.solution()</a></code> </p> + </td> + <td><p>Logistic kinetics</p></td> </tr> </tbody><tbody> <tr> diff --git a/docs/reference/logistic.solution-1.png b/docs/reference/logistic.solution-1.png Binary files differnew file mode 100644 index 00000000..0aaa520b --- /dev/null +++ b/docs/reference/logistic.solution-1.png diff --git a/docs/reference/logistic.solution-2.png b/docs/reference/logistic.solution-2.png Binary files differnew file mode 100644 index 00000000..d1831a46 --- /dev/null +++ b/docs/reference/logistic.solution-2.png diff --git a/docs/reference/logistic.solution.html b/docs/reference/logistic.solution.html new file mode 100644 index 00000000..b0ab72d7 --- /dev/null +++ b/docs/reference/logistic.solution.html @@ -0,0 +1,295 @@ +<!-- Generated by pkgdown: do not edit by hand --> +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +<title>Logistic kinetics — logistic.solution • mkin</title> + +<!-- jquery --> +<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> +<!-- Bootstrap --> + +<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" /> +<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script> + +<!-- Font Awesome icons --> +<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" /> + +<!-- clipboard.js --> +<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script> + +<!-- sticky kit --> +<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script> + +<!-- pkgdown --> +<link href="../pkgdown.css" rel="stylesheet"> +<script src="../pkgdown.js"></script> + + + +<meta property="og:title" content="Logistic kinetics — logistic.solution" /> + +<meta property="og:description" content="Function describing exponential decline from a defined starting value, with + an increasing rate constant, supposedly caused by microbial growth" /> +<meta name="twitter:card" content="summary" /> + + + +<!-- mathjax --> +<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script> +<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script> + +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> +<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> +<![endif]--> + + + </head> + + <body> + <div class="container template-reference-topic"> + <header> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <span class="navbar-brand"> + <a class="navbar-link" href="../index.html">mkin</a> + <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.47.6</span> + </span> + </div> + + <div id="navbar" class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li> + <a href="../reference/index.html">Functions and data</a> +</li> +<li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> + Articles + + <span class="caret"></span> + </a> + <ul class="dropdown-menu" role="menu"> + <li> + <a href="../articles/mkin.html">Introduction to mkin</a> + </li> + <li> + <a href="../articles/FOCUS_D.html">Example evaluation of FOCUS Example Dataset D</a> + </li> + <li> + <a href="../articles/FOCUS_L.html">Example evaluation of FOCUS Laboratory Data L1 to L3</a> + </li> + <li> + <a href="../articles/web_only/FOCUS_Z.html">Example evaluation of FOCUS Example Dataset Z</a> + </li> + <li> + <a href="../articles/web_only/compiled_models.html">Performance benefit by using compiled model definitions in mkin</a> + </li> + <li> + <a href="../articles/twa.html">Calculation of time weighted average concentrations with mkin</a> + </li> + </ul> +</li> +<li> + <a href="../news/index.html">News</a> +</li> + </ul> + + <ul class="nav navbar-nav navbar-right"> + + </ul> + + </div><!--/.nav-collapse --> + </div><!--/.container --> +</div><!--/.navbar --> + + + </header> + +<div class="row"> + <div class="col-md-9 contents"> + <div class="page-header"> + <h1>Logistic kinetics</h1> + + <div class="hidden name"><code>logistic.solution.Rd</code></div> + </div> + + <div class="ref-description"> + + <p>Function describing exponential decline from a defined starting value, with + an increasing rate constant, supposedly caused by microbial growth</p> + + </div> + + <pre class="usage"><span class='fu'>logistic.solution</span>(<span class='no'>t</span>, <span class='no'>parent.0</span>, <span class='no'>kmax</span>, <span class='no'>k0</span>, <span class='no'>r</span>)</pre> + + <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2> + <table class="ref-arguments"> + <colgroup><col class="name" /><col class="desc" /></colgroup> + <tr> + <th>t</th> + <td><p>Time.</p></td> + </tr> + <tr> + <th>parent.0</th> + <td><p>Starting value for the response variable at time zero.</p></td> + </tr> + <tr> + <th>kmax</th> + <td><p>Maximum rate constant.</p></td> + </tr> + <tr> + <th>k0</th> + <td><p>Minumum rate constant effective at time zero.</p></td> + </tr> + <tr> + <th>r</th> + <td><p>Growth rate of the increase in the rate constant.</p></td> + </tr> + </table> + + <h2 class="hasAnchor" id="note"><a class="anchor" href="#note"></a>Note</h2> + + <p>The solution of the logistic model reduces to the + <code><a href='SFO.solution.html'>SFO.solution</a></code> if <code>k0</code> is equal to + <code>kmax</code>.</p> + + <h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2> + + <p>The value of the response variable at time <code>t</code>.</p> + + <h2 class="hasAnchor" id="references"><a class="anchor" href="#references"></a>References</h2> + + <p>FOCUS (2014) “Generic guidance for Estimating Persistence and + Degradation Kinetics from Environmental Fate Studies on Pesticides in EU + Registration” Report of the FOCUS Work Group on Degradation Kinetics, + Version 1.1, 18 December 2014 + <a href='http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics'>http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics</a></p> + + + <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> + <pre class="examples"><div class='input'> <span class='co'># Reproduce the plot on page 57 of FOCUS (2014)</span> + <span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='kw'>function</span>(<span class='no'>x</span>) <span class='fu'>logistic.solution</span>(<span class='no'>x</span>, <span class='fl'>100</span>, <span class='fl'>0.08</span>, <span class='fl'>0.0001</span>, <span class='fl'>0.2</span>), + <span class='kw'>from</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='kw'>to</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='kw'>ylim</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>100</span>), + <span class='kw'>xlab</span> <span class='kw'>=</span> <span class='st'>"Time"</span>, <span class='kw'>ylab</span> <span class='kw'>=</span> <span class='st'>"Residue"</span>)</div><div class='input'> <span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='kw'>function</span>(<span class='no'>x</span>) <span class='fu'>logistic.solution</span>(<span class='no'>x</span>, <span class='fl'>100</span>, <span class='fl'>0.08</span>, <span class='fl'>0.0001</span>, <span class='fl'>0.4</span>), + <span class='kw'>from</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='kw'>to</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='kw'>add</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>lty</span> <span class='kw'>=</span> <span class='fl'>2</span>, <span class='kw'>col</span> <span class='kw'>=</span> <span class='fl'>2</span>)</div><div class='input'> <span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='kw'>function</span>(<span class='no'>x</span>) <span class='fu'>logistic.solution</span>(<span class='no'>x</span>, <span class='fl'>100</span>, <span class='fl'>0.08</span>, <span class='fl'>0.0001</span>, <span class='fl'>0.8</span>), + <span class='kw'>from</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='kw'>to</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='kw'>add</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>lty</span> <span class='kw'>=</span> <span class='fl'>3</span>, <span class='kw'>col</span> <span class='kw'>=</span> <span class='fl'>3</span>)</div><div class='input'> <span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='kw'>function</span>(<span class='no'>x</span>) <span class='fu'>logistic.solution</span>(<span class='no'>x</span>, <span class='fl'>100</span>, <span class='fl'>0.08</span>, <span class='fl'>0.001</span>, <span class='fl'>0.2</span>), + <span class='kw'>from</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='kw'>to</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='kw'>add</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>lty</span> <span class='kw'>=</span> <span class='fl'>4</span>, <span class='kw'>col</span> <span class='kw'>=</span> <span class='fl'>4</span>)</div><div class='input'> <span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='kw'>function</span>(<span class='no'>x</span>) <span class='fu'>logistic.solution</span>(<span class='no'>x</span>, <span class='fl'>100</span>, <span class='fl'>0.08</span>, <span class='fl'>0.08</span>, <span class='fl'>0.2</span>), + <span class='kw'>from</span> <span class='kw'>=</span> <span class='fl'>0</span>, <span class='kw'>to</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='kw'>add</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>lty</span> <span class='kw'>=</span> <span class='fl'>5</span>, <span class='kw'>col</span> <span class='kw'>=</span> <span class='fl'>5</span>)</div><div class='input'> <span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/legend'>legend</a></span>(<span class='st'>"topright"</span>, <span class='kw'>inset</span> <span class='kw'>=</span> <span class='fl'>0.05</span>, + <span class='kw'>legend</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste0</a></span>(<span class='st'>"k0 = "</span>, <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>0.0001</span>, <span class='fl'>0.0001</span>, <span class='fl'>0.0001</span>, <span class='fl'>0.001</span>, <span class='fl'>0.08</span>), + <span class='st'>", r = "</span>, <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>0.2</span>, <span class='fl'>0.4</span>, <span class='fl'>0.8</span>, <span class='fl'>0.2</span>, <span class='fl'>0.2</span>)), + <span class='kw'>lty</span> <span class='kw'>=</span> <span class='fl'>1</span>:<span class='fl'>5</span>, <span class='kw'>col</span> <span class='kw'>=</span> <span class='fl'>1</span>:<span class='fl'>5</span>)</div><div class='img'><img src='logistic.solution-1.png' alt='' width='700' height='433' /></div><div class='input'> + <span class='co'># Fit with synthetic data</span> + <span class='no'>logistic</span> <span class='kw'><-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"logistic"</span>)) + + <span class='no'>sampling_times</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>, <span class='fl'>3</span>, <span class='fl'>7</span>, <span class='fl'>14</span>, <span class='fl'>28</span>, <span class='fl'>60</span>, <span class='fl'>90</span>, <span class='fl'>120</span>) + <span class='no'>parms_logistic</span> <span class='kw'><-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='kw'>kmax</span> <span class='kw'>=</span> <span class='fl'>0.08</span>, <span class='kw'>k0</span> <span class='kw'>=</span> <span class='fl'>0.0001</span>, <span class='kw'>r</span> <span class='kw'>=</span> <span class='fl'>0.2</span>) + <span class='no'>parms_logistic_optim</span> <span class='kw'><-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='kw'>parent_0</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='no'>parms_logistic</span>) + <span class='no'>d_logistic</span> <span class='kw'><-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span>(<span class='no'>logistic</span>, + <span class='no'>parms_logistic</span>, <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>100</span>), + <span class='no'>sampling_times</span>) + <span class='no'>d_2_1</span> <span class='kw'><-</span> <span class='fu'><a href='add_err.html'>add_err</a></span>(<span class='no'>d_logistic</span>, + <span class='kw'>sdfunc</span> <span class='kw'>=</span> <span class='kw'>function</span>(<span class='no'>x</span>) <span class='fu'><a href='sigma_twocomp.html'>sigma_twocomp</a></span>(<span class='no'>x</span>, <span class='fl'>0.5</span>, <span class='fl'>0.07</span>), + <span class='kw'>n</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>reps</span> <span class='kw'>=</span> <span class='fl'>2</span>, <span class='kw'>digits</span> <span class='kw'>=</span> <span class='fl'>5</span>, <span class='kw'>LOD</span> <span class='kw'>=</span> <span class='fl'>0.1</span>, <span class='kw'>seed</span> <span class='kw'>=</span> <span class='fl'>123456</span>)<span class='kw'>[[</span><span class='fl'>1</span>]] + + <span class='no'>m</span> <span class='kw'><-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='st'>"logistic"</span>, <span class='no'>d_2_1</span>)</div><div class='output co'>#> Model cost at call 1 : 789.6044 +#> Model cost at call 2 : 789.6043 +#> Model cost at call 7 : 716.9934 +#> Model cost at call 12 : 697.1186 +#> Model cost at call 15 : 697.1185 +#> Model cost at call 16 : 697.1184 +#> Model cost at call 17 : 661.1574 +#> Model cost at call 20 : 661.1573 +#> Model cost at call 22 : 620.0542 +#> Model cost at call 25 : 620.0541 +#> Model cost at call 29 : 616.6874 +#> Model cost at call 32 : 616.6874 +#> Model cost at call 33 : 616.6874 +#> Model cost at call 34 : 615.1671 +#> Model cost at call 37 : 615.1671 +#> Model cost at call 39 : 612.0795 +#> Model cost at call 42 : 612.0795 +#> Model cost at call 43 : 612.0795 +#> Model cost at call 44 : 605.9119 +#> Model cost at call 45 : 593.0433 +#> Model cost at call 46 : 548.0815 +#> Model cost at call 47 : 504.9062 +#> Model cost at call 50 : 504.9061 +#> Model cost at call 51 : 504.9061 +#> Model cost at call 53 : 485.929 +#> Model cost at call 55 : 485.929 +#> Model cost at call 56 : 485.929 +#> Model cost at call 58 : 485.241 +#> Model cost at call 60 : 485.241 +#> Model cost at call 61 : 485.2409 +#> Model cost at call 62 : 485.2409 +#> Model cost at call 63 : 484.0717 +#> Model cost at call 69 : 483.9062 +#> Model cost at call 74 : 483.5646 +#> Model cost at call 79 : 483.4908 +#> Model cost at call 84 : 483.4859 +#> Model cost at call 85 : 483.4859 +#> Model cost at call 89 : 483.4848 +#> Model cost at call 90 : 483.4836 +#> Model cost at call 92 : 483.4836 +#> Model cost at call 94 : 483.4836 +#> Model cost at call 97 : 483.4833 +#> Model cost at call 100 : 483.4833 +#> Model cost at call 105 : 483.4832 +#> Model cost at call 108 : 483.4832 +#> Model cost at call 114 : 483.4832 +#> Model cost at call 128 : 483.4832 +#> Optimisation by method Port successfully terminated.</div><div class='input'> <span class='fu'><a href='plot.mkinfit.html'>plot_sep</a></span>(<span class='no'>m</span>)</div><div class='img'><img src='logistic.solution-2.png' alt='' width='700' height='433' /></div><div class='input'> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>m</span>)$<span class='no'>bpar</span></div><div class='output co'>#> Estimate se_notrans t value Pr(>t) Lower +#> parent_0 1.057896e+02 2.3743105248 44.5559374 6.656664e-16 1.006602e+02 +#> kmax 6.398190e-02 0.0193490291 3.3067243 2.836921e-03 3.329058e-02 +#> k0 1.612775e-04 0.0009640761 0.1672871 4.348592e-01 3.972250e-10 +#> r 2.263946e-01 0.2822811886 0.8020181 2.184792e-01 1.531165e-02 +#> Upper +#> parent_0 110.9190170 +#> kmax 0.1229682 +#> k0 65.4803698 +#> r 3.3474197</div></pre> + </div> + <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> + <h2>Contents</h2> + <ul class="nav nav-pills nav-stacked"> + <li><a href="#arguments">Arguments</a></li> + + <li><a href="#note">Note</a></li> + + <li><a href="#value">Value</a></li> + + <li><a href="#references">References</a></li> + + <li><a href="#examples">Examples</a></li> + </ul> + + </div> +</div> + + <footer> + <div class="copyright"> + <p>Developed by Johannes Ranke.</p> +</div> + +<div class="pkgdown"> + <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p> +</div> + </footer> + </div> + + + + </body> +</html> + diff --git a/docs/reference/mccall81_245T.html b/docs/reference/mccall81_245T.html index 93d7f197..dcfc499f 100644 --- a/docs/reference/mccall81_245T.html +++ b/docs/reference/mccall81_245T.html @@ -160,8 +160,8 @@ <span class='kw'>anisole</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/list'>list</a></span>(<span class='kw'>type</span> <span class='kw'>=</span> <span class='st'>"SFO"</span>))</div><div class='output co'>#> <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'> </div><div class='input'> <span class='no'>fit.1</span> <span class='kw'><-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='no'>SFO_SFO_SFO</span>, <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/subset'>subset</a></span>(<span class='no'>mccall81_245T</span>, <span class='no'>soil</span> <span class='kw'>==</span> <span class='st'>"Commerce"</span>), <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>fit.1</span>, <span class='kw'>data</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)</div><div class='output co'>#> mkin version used for fitting: 0.9.47.6 #> R version used for fitting: 3.5.2 -#> Date of fit: Thu Jan 31 16:51:05 2019 -#> Date of summary: Thu Jan 31 16:51:05 2019 +#> Date of fit: Thu Feb 21 14:30:31 2019 +#> Date of summary: Thu Feb 21 14:30:31 2019 #> #> Equations: #> d_T245/dt = - k_T245_sink * T245 - k_T245_phenol * T245 @@ -171,7 +171,7 @@ #> #> Model predictions using solution type deSolve #> -#> Fitted with method Port using 574 model solutions performed in 3.87 s +#> Fitted with method Port using 574 model solutions performed in 3.822 s #> #> Weighting: none #> @@ -249,8 +249,8 @@ <span class='kw'>fixed_parms</span> <span class='kw'>=</span> <span class='st'>"k_phenol_sink"</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>fit.2</span>, <span class='kw'>data</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)</div><div class='output co'>#> mkin version used for fitting: 0.9.47.6 #> R version used for fitting: 3.5.2 -#> Date of fit: Thu Jan 31 16:51:07 2019 -#> Date of summary: Thu Jan 31 16:51:07 2019 +#> Date of fit: Thu Feb 21 14:30:32 2019 +#> Date of summary: Thu Feb 21 14:30:32 2019 #> #> Equations: #> d_T245/dt = - k_T245_sink * T245 - k_T245_phenol * T245 @@ -260,7 +260,7 @@ #> #> Model predictions using solution type deSolve #> -#> Fitted with method Port using 246 model solutions performed in 1.618 s +#> Fitted with method Port using 246 model solutions performed in 1.601 s #> #> Weighting: none #> diff --git a/docs/reference/mkinfit.html b/docs/reference/mkinfit.html index 42845d68..d09b9232 100644 --- a/docs/reference/mkinfit.html +++ b/docs/reference/mkinfit.html @@ -438,15 +438,15 @@ <span class='no'>fit</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='st'>"FOMC"</span>, <span class='no'>FOCUS_2006_C</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>fit</span>)</div><div class='output co'>#> mkin version used for fitting: 0.9.47.6 #> R version used for fitting: 3.5.2 -#> Date of fit: Thu Jan 31 16:51:10 2019 -#> Date of summary: Thu Jan 31 16:51:10 2019 +#> Date of fit: Thu Feb 21 14:30:35 2019 +#> Date of summary: Thu Feb 21 14:30:35 2019 #> #> Equations: #> d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent #> #> Model predictions using solution type analytical #> -#> Fitted with method Port using 64 model solutions performed in 0.162 s +#> Fitted with method Port using 64 model solutions performed in 0.16 s #> #> Weighting: none #> @@ -515,7 +515,7 @@ <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>))</div><div class='output co'>#> <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'><span class='co'># Fit the model to the FOCUS example dataset D using defaults</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/print'>print</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/system.time'>system.time</a></span>(<span class='no'>fit</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"eigen"</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)))</div><div class='output co'>#> User System verstrichen -#> 1.022 0.000 1.025 </div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/stats/topics/coef'>coef</a></span>(<span class='no'>fit</span>)</div><div class='output co'>#> parent_0 log_k_parent_sink log_k_parent_m1 log_k_m1_sink +#> 1.017 0.004 1.022 </div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/stats/topics/coef'>coef</a></span>(<span class='no'>fit</span>)</div><div class='output co'>#> parent_0 log_k_parent_sink log_k_parent_m1 log_k_m1_sink #> 99.59848 -3.03822 -2.98030 -5.24750 </div><div class='input'><span class='fu'><a href='endpoints.html'>endpoints</a></span>(<span class='no'>fit</span>)</div><div class='output co'>#> $ff #> parent_sink parent_m1 m1_sink #> 0.485524 0.514476 1.000000 @@ -590,7 +590,7 @@ #> Model cost at call 146 : 371.2134 #> Optimisation by method Port successfully terminated. #> User System verstrichen -#> 0.823 0.000 0.823 </div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/stats/topics/coef'>coef</a></span>(<span class='no'>fit.deSolve</span>)</div><div class='output co'>#> parent_0 log_k_parent_sink log_k_parent_m1 log_k_m1_sink +#> 0.845 0.000 0.846 </div><div class='input'><span class='fu'><a href='https://www.rdocumentation.org/packages/stats/topics/coef'>coef</a></span>(<span class='no'>fit.deSolve</span>)</div><div class='output co'>#> parent_0 log_k_parent_sink log_k_parent_m1 log_k_m1_sink #> 99.59848 -3.03822 -2.98030 -5.24750 </div><div class='input'><span class='fu'><a href='endpoints.html'>endpoints</a></span>(<span class='no'>fit.deSolve</span>)</div><div class='output co'>#> $ff #> parent_sink parent_m1 m1_sink #> 0.485524 0.514476 1.000000 @@ -628,8 +628,8 @@ <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>), <span class='kw'>use_of_ff</span> <span class='kw'>=</span> <span class='st'>"max"</span>)</div><div class='output co'>#> <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'><span class='no'>f.noweight</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO.ff</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>f.noweight</span>)</div><div class='output co'>#> mkin version used for fitting: 0.9.47.6 #> R version used for fitting: 3.5.2 -#> Date of fit: Thu Jan 31 16:51:22 2019 -#> Date of summary: Thu Jan 31 16:51:22 2019 +#> Date of fit: Thu Feb 21 14:30:47 2019 +#> Date of summary: Thu Feb 21 14:30:47 2019 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -637,7 +637,7 @@ #> #> Model predictions using solution type deSolve #> -#> Fitted with method Port using 186 model solutions performed in 0.872 s +#> Fitted with method Port using 186 model solutions performed in 0.86 s #> #> Weighting: none #> @@ -745,8 +745,8 @@ #> 120 m1 33.31 28.78984 4.520e+00</div><div class='input'><span class='no'>f.irls</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO.ff</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>reweight.method</span> <span class='kw'>=</span> <span class='st'>"obs"</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>f.irls</span>)</div><div class='output co'>#> mkin version used for fitting: 0.9.47.6 #> R version used for fitting: 3.5.2 -#> Date of fit: Thu Jan 31 16:51:24 2019 -#> Date of summary: Thu Jan 31 16:51:24 2019 +#> Date of fit: Thu Feb 21 14:30:50 2019 +#> Date of summary: Thu Feb 21 14:30:50 2019 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -754,7 +754,7 @@ #> #> Model predictions using solution type deSolve #> -#> Fitted with method Port using 551 model solutions performed in 2.558 s +#> Fitted with method Port using 551 model solutions performed in 2.529 s #> #> Weighting: none #> @@ -867,8 +867,8 @@ #> 120 m1 33.31 28.80898 4.501e+00 2.722</div><div class='input'><span class='no'>f.w.mean</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO.ff</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>weight</span> <span class='kw'>=</span> <span class='st'>"mean"</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>f.w.mean</span>)</div><div class='output co'>#> mkin version used for fitting: 0.9.47.6 #> R version used for fitting: 3.5.2 -#> Date of fit: Thu Jan 31 16:51:25 2019 -#> Date of summary: Thu Jan 31 16:51:25 2019 +#> Date of fit: Thu Feb 21 14:30:51 2019 +#> Date of summary: Thu Feb 21 14:30:51 2019 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -876,7 +876,7 @@ #> #> Model predictions using solution type deSolve #> -#> Fitted with method Port using 155 model solutions performed in 0.711 s +#> Fitted with method Port using 155 model solutions performed in 0.707 s #> #> Weighting: mean #> @@ -985,8 +985,8 @@ <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>f.w.value</span>)</div><div class='output co'>#> mkin version used for fitting: 0.9.47.6 #> R version used for fitting: 3.5.2 -#> Date of fit: Thu Jan 31 16:51:26 2019 -#> Date of summary: Thu Jan 31 16:51:26 2019 +#> Date of fit: Thu Feb 21 14:30:52 2019 +#> Date of summary: Thu Feb 21 14:30:52 2019 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -994,7 +994,7 @@ #> #> Model predictions using solution type deSolve #> -#> Fitted with method Port using 174 model solutions performed in 0.807 s +#> Fitted with method Port using 174 model solutions performed in 0.792 s #> #> Weighting: manual #> @@ -1105,8 +1105,8 @@ <span class='no'>f.w.man</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO.ff</span>, <span class='no'>dw</span>, <span class='kw'>err</span> <span class='kw'>=</span> <span class='st'>"err.man"</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>f.w.man</span>)</div><div class='output co'>#> mkin version used for fitting: 0.9.47.6 #> R version used for fitting: 3.5.2 -#> Date of fit: Thu Jan 31 16:51:28 2019 -#> Date of summary: Thu Jan 31 16:51:28 2019 +#> Date of fit: Thu Feb 21 14:30:53 2019 +#> Date of summary: Thu Feb 21 14:30:53 2019 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -1114,7 +1114,7 @@ #> #> Model predictions using solution type deSolve #> -#> Fitted with method Port using 270 model solutions performed in 1.257 s +#> Fitted with method Port using 270 model solutions performed in 1.243 s #> #> Weighting: manual #> @@ -1223,8 +1223,8 @@ <span class='kw'>reweight.method</span> <span class='kw'>=</span> <span class='st'>"obs"</span>) <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>f.w.man.irls</span>)</div><div class='output co'>#> mkin version used for fitting: 0.9.47.6 #> R version used for fitting: 3.5.2 -#> Date of fit: Thu Jan 31 16:51:31 2019 -#> Date of summary: Thu Jan 31 16:51:31 2019 +#> Date of fit: Thu Feb 21 14:30:57 2019 +#> Date of summary: Thu Feb 21 14:30:57 2019 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -1232,7 +1232,7 @@ #> #> Model predictions using solution type deSolve #> -#> Fitted with method Port using 692 model solutions performed in 3.3 s +#> Fitted with method Port using 692 model solutions performed in 3.27 s #> #> Weighting: manual #> diff --git a/docs/reference/mkinmod.html b/docs/reference/mkinmod.html index 84b335f7..0710e6de 100644 --- a/docs/reference/mkinmod.html +++ b/docs/reference/mkinmod.html @@ -231,7 +231,7 @@ For the definition of model types and their parameters, the equations given <span class='no'>SFO_SFO</span> <span class='kw'><-</span> <span class='fu'>mkinmod</span>( <span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>, <span class='st'>"m1"</span>), <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>), <span class='kw'>verbose</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='output co'>#> Compilation argument: -#> /usr/lib/R/bin/R CMD SHLIB file165a4bc987b7.c 2> file165a4bc987b7.c.err.txt +#> /usr/lib/R/bin/R CMD SHLIB file33652d0fd552.c 2> file33652d0fd552.c.err.txt #> Program source: #> 1: #include <R.h> #> 2: diff --git a/docs/reference/mkinpredict.html b/docs/reference/mkinpredict.html index c34da511..8c5bf22b 100644 --- a/docs/reference/mkinpredict.html +++ b/docs/reference/mkinpredict.html @@ -325,7 +325,7 @@ <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fl'>0</span>), <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='fl'>0</span>, <span class='fl'>20</span>, <span class='kw'>by</span> <span class='kw'>=</span> <span class='fl'>0.1</span>), <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"eigen"</span>)[<span class='fl'>201</span>,]))</div><div class='output co'>#> time parent m1 #> 201 20 4.978707 27.46227</div><div class='output co'>#> User System verstrichen -#> 0.003 0.000 0.003 </div><div class='input'> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/system.time'>system.time</a></span>( +#> 0.004 0.000 0.004 </div><div class='input'> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/system.time'>system.time</a></span>( <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/print'>print</a></span>(<span class='fu'>mkinpredict</span>(<span class='no'>SFO_SFO</span>, <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='kw'>k_parent_m1</span> <span class='kw'>=</span> <span class='fl'>0.05</span>, <span class='kw'>k_parent_sink</span> <span class='kw'>=</span> <span class='fl'>0.1</span>, <span class='kw'>k_m1_sink</span> <span class='kw'>=</span> <span class='fl'>0.01</span>), <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fl'>0</span>), <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='fl'>0</span>, <span class='fl'>20</span>, <span class='kw'>by</span> <span class='kw'>=</span> <span class='fl'>0.1</span>), <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"deSolve"</span>)[<span class='fl'>201</span>,]))</div><div class='output co'>#> time parent m1 @@ -335,7 +335,7 @@ <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fl'>0</span>), <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='fl'>0</span>, <span class='fl'>20</span>, <span class='kw'>by</span> <span class='kw'>=</span> <span class='fl'>0.1</span>), <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"deSolve"</span>, <span class='kw'>use_compiled</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)[<span class='fl'>201</span>,]))</div><div class='output co'>#> time parent m1 #> 201 20 4.978707 27.46227</div><div class='output co'>#> User System verstrichen -#> 0.042 0.000 0.042 </div><div class='input'> +#> 0.047 0.000 0.047 </div><div class='input'> </div><div class='input'> <span class='co'># Predict from a fitted model</span> <span class='no'>f</span> <span class='kw'><-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_2006_C</span>)</div><div class='output co'>#> Model cost at call 1 : 552.5739 #> Model cost at call 3 : 552.5739 diff --git a/docs/reference/mmkin.html b/docs/reference/mmkin.html index 3fa5c9a5..75da28c7 100644 --- a/docs/reference/mmkin.html +++ b/docs/reference/mmkin.html @@ -191,8 +191,8 @@ <span class='no'>time_1</span> <span class='kw'><-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/system.time'>system.time</a></span>(<span class='no'>fits.4</span> <span class='kw'><-</span> <span class='fu'>mmkin</span>(<span class='no'>models</span>, <span class='no'>datasets</span>, <span class='kw'>cores</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)) <span class='no'>time_default</span></div><div class='output co'>#> User System verstrichen -#> 0.045 0.036 7.264 </div><div class='input'><span class='no'>time_1</span></div><div class='output co'>#> User System verstrichen -#> 22.905 0.000 22.919 </div><div class='input'> +#> 0.039 0.040 7.082 </div><div class='input'><span class='no'>time_1</span></div><div class='output co'>#> User System verstrichen +#> 22.650 0.004 22.666 </div><div class='input'> <span class='fu'><a href='endpoints.html'>endpoints</a></span>(<span class='no'>fits.0</span><span class='kw'>[[</span><span class='st'>"SFO_lin"</span>, <span class='fl'>2</span>]])</div><div class='output co'>#> $ff #> parent_M1 parent_sink M1_M2 M1_sink #> 0.7340480 0.2659520 0.7505686 0.2494314 diff --git a/docs/reference/summary.mkinfit.html b/docs/reference/summary.mkinfit.html index 2815eccb..242d9f63 100644 --- a/docs/reference/summary.mkinfit.html +++ b/docs/reference/summary.mkinfit.html @@ -208,8 +208,8 @@ <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> <pre class="examples"><div class='input'> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='fu'><a href='mkinmod.html'>mkinmod</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>)), <span class='no'>FOCUS_2006_A</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>))</div><div class='output co'>#> mkin version used for fitting: 0.9.47.6 #> R version used for fitting: 3.5.2 -#> Date of fit: Thu Jan 31 16:52:23 2019 -#> Date of summary: Thu Jan 31 16:52:23 2019 +#> Date of fit: Thu Feb 21 14:31:48 2019 +#> Date of summary: Thu Feb 21 14:31:48 2019 #> #> Equations: #> d_parent/dt = - k_parent_sink * parent diff --git a/docs/reference/transform_odeparms.html b/docs/reference/transform_odeparms.html index d3c20ed8..939fa7b4 100644 --- a/docs/reference/transform_odeparms.html +++ b/docs/reference/transform_odeparms.html @@ -202,8 +202,8 @@ The transformation of sets of formation fractions is fragile, as it supposes <span class='no'>fit</span> <span class='kw'><-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>fit</span>, <span class='kw'>data</span><span class='kw'>=</span><span class='fl'>FALSE</span>) <span class='co'># See transformed and backtransformed parameters</span></div><div class='output co'>#> mkin version used for fitting: 0.9.47.6 #> R version used for fitting: 3.5.2 -#> Date of fit: Thu Jan 31 16:52:31 2019 -#> Date of summary: Thu Jan 31 16:52:31 2019 +#> Date of fit: Thu Feb 21 14:31:57 2019 +#> Date of summary: Thu Feb 21 14:31:57 2019 #> #> Equations: #> d_parent/dt = - k_parent_sink * parent - k_parent_m1 * parent @@ -211,7 +211,7 @@ The transformation of sets of formation fractions is fragile, as it supposes #> #> Model predictions using solution type deSolve #> -#> Fitted with method Port using 153 model solutions performed in 0.703 s +#> Fitted with method Port using 153 model solutions performed in 0.849 s #> #> Weighting: none #> @@ -278,8 +278,8 @@ The transformation of sets of formation fractions is fragile, as it supposes </div><div class='input'><span class='no'>fit.2</span> <span class='kw'><-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>transform_rates</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>fit.2</span>, <span class='kw'>data</span><span class='kw'>=</span><span class='fl'>FALSE</span>)</div><div class='output co'>#> mkin version used for fitting: 0.9.47.6 #> R version used for fitting: 3.5.2 -#> Date of fit: Thu Jan 31 16:52:33 2019 -#> Date of summary: Thu Jan 31 16:52:33 2019 +#> Date of fit: Thu Feb 21 14:31:59 2019 +#> Date of summary: Thu Feb 21 14:31:59 2019 #> #> Equations: #> d_parent/dt = - k_parent_sink * parent - k_parent_m1 * parent @@ -287,7 +287,7 @@ The transformation of sets of formation fractions is fragile, as it supposes #> #> Model predictions using solution type deSolve #> -#> Fitted with method Port using 350 model solutions performed in 1.597 s +#> Fitted with method Port using 350 model solutions performed in 1.649 s #> #> Weighting: none #> @@ -366,8 +366,8 @@ The transformation of sets of formation fractions is fragile, as it supposes <span class='no'>fit.ff</span> <span class='kw'><-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='no'>SFO_SFO.ff</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>fit.ff</span>, <span class='kw'>data</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)</div><div class='output co'>#> mkin version used for fitting: 0.9.47.6 #> R version used for fitting: 3.5.2 -#> Date of fit: Thu Jan 31 16:52:34 2019 -#> Date of summary: Thu Jan 31 16:52:34 2019 +#> Date of fit: Thu Feb 21 14:32:00 2019 +#> Date of summary: Thu Feb 21 14:32:00 2019 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -375,7 +375,7 @@ The transformation of sets of formation fractions is fragile, as it supposes #> #> Model predictions using solution type deSolve #> -#> Fitted with method Port using 186 model solutions performed in 0.898 s +#> Fitted with method Port using 186 model solutions performed in 0.976 s #> #> Weighting: none #> @@ -450,8 +450,8 @@ The transformation of sets of formation fractions is fragile, as it supposes <span class='no'>fit.ff.2</span> <span class='kw'><-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='no'>SFO_SFO.ff.2</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>fit.ff.2</span>, <span class='kw'>data</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)</div><div class='output co'>#> mkin version used for fitting: 0.9.47.6 #> R version used for fitting: 3.5.2 -#> Date of fit: Thu Jan 31 16:52:35 2019 -#> Date of summary: Thu Jan 31 16:52:35 2019 +#> Date of fit: Thu Feb 21 14:32:01 2019 +#> Date of summary: Thu Feb 21 14:32:01 2019 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -459,7 +459,7 @@ The transformation of sets of formation fractions is fragile, as it supposes #> #> Model predictions using solution type deSolve #> -#> Fitted with method Port using 104 model solutions performed in 0.482 s +#> Fitted with method Port using 104 model solutions performed in 0.512 s #> #> Weighting: none #> diff --git a/man/logistic.solution.Rd b/man/logistic.solution.Rd new file mode 100644 index 00000000..798e78d1 --- /dev/null +++ b/man/logistic.solution.Rd @@ -0,0 +1,68 @@ +\name{logistic.solution} +\alias{logistic.solution} +\title{ Logistic kinetics } +\description{ + Function describing exponential decline from a defined starting value, with + an increasing rate constant, supposedly caused by microbial growth +} +\usage{ +logistic.solution(t, parent.0, kmax, k0, r) +} +\arguments{ + \item{t}{ Time. } + \item{parent.0}{ Starting value for the response variable at time zero. } + \item{kmax}{ Maximum rate constant. } + \item{k0}{ Minumum rate constant effective at time zero. } + \item{r}{ Growth rate of the increase in the rate constant. } +} +\note{ + The solution of the logistic model reduces to the + \code{\link{SFO.solution}} if \code{k0} is equal to + \code{kmax}. +} +\value{ + The value of the response variable at time \code{t}. +} +\references{ + FOCUS (2014) \dQuote{Generic guidance for Estimating Persistence and + Degradation Kinetics from Environmental Fate Studies on Pesticides in EU + Registration} Report of the FOCUS Work Group on Degradation Kinetics, + Version 1.1, 18 December 2014 + \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics} +} +\examples{ + # Reproduce the plot on page 57 of FOCUS (2014) + plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.2), + from = 0, to = 100, ylim = c(0, 100), + xlab = "Time", ylab = "Residue") + plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.4), + from = 0, to = 100, add = TRUE, lty = 2, col = 2) + plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.8), + from = 0, to = 100, add = TRUE, lty = 3, col = 3) + plot(function(x) logistic.solution(x, 100, 0.08, 0.001, 0.2), + from = 0, to = 100, add = TRUE, lty = 4, col = 4) + plot(function(x) logistic.solution(x, 100, 0.08, 0.08, 0.2), + from = 0, to = 100, add = TRUE, lty = 5, col = 5) + legend("topright", inset = 0.05, + legend = paste0("k0 = ", c(0.0001, 0.0001, 0.0001, 0.001, 0.08), + ", r = ", c(0.2, 0.4, 0.8, 0.2, 0.2)), + lty = 1:5, col = 1:5) + + # Fit with synthetic data + logistic <- mkinmod(parent = mkinsub("logistic")) + + sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) + parms_logistic <- c(kmax = 0.08, k0 = 0.0001, r = 0.2) + parms_logistic_optim <- c(parent_0 = 100, parms_logistic) + d_logistic <- mkinpredict(logistic, + parms_logistic, c(parent = 100), + sampling_times) + d_2_1 <- add_err(d_logistic, + sdfunc = function(x) sigma_twocomp(x, 0.5, 0.07), + n = 1, reps = 2, digits = 5, LOD = 0.1, seed = 123456)[[1]] + + m <- mkinfit("logistic", d_2_1) + plot_sep(m) + summary(m)$bpar +} +\keyword{ manip } @@ -1,102 +1,28 @@ Loading mkin -Loading required package: testthat Testing mkin ✔ | OK F W S | Context -
⠏ | 0 | Calculation of FOCUS chi2 error levels
⠋ | 1 | Calculation of FOCUS chi2 error levels
⠙ | 2 | Calculation of FOCUS chi2 error levels
✔ | 2 | Calculation of FOCUS chi2 error levels [2.2 s] -
⠏ | 0 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠋ | 1 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠙ | 2 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠹ | 3 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠸ | 4 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠼ | 5 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠴ | 6 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠦ | 7 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠧ | 8 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
✔ | 8 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [6.5 s] -
⠏ | 0 | Iteratively reweighted least squares (IRLS) fitting
⠋ | 0 1 | Iteratively reweighted least squares (IRLS) fitting
⠙ | 1 1 | Iteratively reweighted least squares (IRLS) fitting
⠹ | 1 1 1 | Iteratively reweighted least squares (IRLS) fitting
⠹ | 1 1 1 | Iteratively reweighted least squares (IRLS) fitting
⠹ | 1 1 1 | Iteratively reweighted least squares (IRLS) fitting
⠸ | 1 1 2 | Iteratively reweighted least squares (IRLS) fitting
⠹ | 1 1 1 | Iteratively reweighted least squares (IRLS) fitting
⠹ | 1 1 1 | Iteratively reweighted least squares (IRLS) fitting
⠸ | 1 1 2 | Iteratively reweighted least squares (IRLS) fitting
⠹ | 1 1 1 | Iteratively reweighted least squares (IRLS) fitting
⠼ | 1 1 3 | Iteratively reweighted least squares (IRLS) fitting
⠴ | 1 1 4 | Iteratively reweighted least squares (IRLS) fitting
⠹ | 1 1 1 | Iteratively reweighted least squares (IRLS) fitting
⠹ | 2 1 | Iteratively reweighted least squares (IRLS) fitting
⠸ | 3 1 | Iteratively reweighted least squares (IRLS) fitting
⠼ | 4 1 | Iteratively reweighted least squares (IRLS) fitting
⠴ | 5 1 | Iteratively reweighted least squares (IRLS) fitting
⠦ | 6 1 | Iteratively reweighted least squares (IRLS) fitting
⠧ | 7 1 | Iteratively reweighted least squares (IRLS) fitting
✖ | 7 1 | Iteratively reweighted least squares (IRLS) fitting [172.0 s] +
⠏ | 0 | Calculation of FOCUS chi2 error levels
⠋ | 1 | Calculation of FOCUS chi2 error levels
⠙ | 2 | Calculation of FOCUS chi2 error levels
✔ | 2 | Calculation of FOCUS chi2 error levels [2.5 s] +
⠏ | 0 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠋ | 1 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠙ | 2 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠹ | 3 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠸ | 4 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠼ | 5 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠴ | 6 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠦ | 7 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠧ | 8 | Results for FOCUS D established in expertise for UBA (Ranke 2014)
✔ | 8 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [7.2 s] +
⠏ | 0 | Iteratively reweighted least squares (IRLS) fitting
⠋ | 1 | Iteratively reweighted least squares (IRLS) fitting
⠙ | 1 1 | Iteratively reweighted least squares (IRLS) fitting
✔ | 1 1 | Iteratively reweighted least squares (IRLS) fitting [9.0 s] ──────────────────────────────────────────────────────────────────────────────── -test_irls.R:38: error: Reweighting method 'obs' works -Objekt 'tc_fit' nicht gefunden -1: mkinfit(m_synth_SFO_lin, SFO_lin_a, reweight.method = "obs", quiet = TRUE) at /home/jranke/git/mkin/tests/testthat/test_irls.R:38 -2: system.time({ - fit <- modFit(cost, c(state.ini.optim, transparms.optim), method = method.modFit, - control = control.modFit, lower = lower, upper = upper, ...) - if (!is.null(reweight.method)) { - if (!reweight.method %in% c("obs", "tc")) - stop("Only reweighting methods 'obs' and 'tc' are implemented") - if (reweight.method == "obs") { - if (!quiet) { - cat("IRLS based on variance estimates for each observed variable\n") - cat("Initial variance estimates are:\n") - print(signif(fit$var_ms_unweighted, 8)) - } - } - if (reweight.method == "tc") { - tc_fit <- fit_error_model_mad_obs(cost(fit$par)$residuals, tc, 0) - if (is.character(tc_fit)) { - if (!quiet) { - cat(tc_fit, ".\n", "No reweighting will be performed.") - } - tc_fitted <- c(sigma_low = NA, rsd_high = NA) - } - else { - tc_fitted <- coef(tc_fit) - if (!quiet) { - cat("IRLS based on variance estimates according to the two component error model\n") - cat("Initial variance components are:\n") - print(signif(tc_fitted)) - } - } - } - reweight.diff = 1 - n.iter <- 0 - if (!is.null(err)) - observed$err.ini <- observed[[err]] - err = "err.irls" - while (reweight.diff > reweight.tol & n.iter < reweight.max.iter & !is.character(tc_fit)) { - n.iter <- n.iter + 1 - if (reweight.method == "obs") { - sr_old <- fit$var_ms_unweighted - observed[err] <- sqrt(fit$var_ms_unweighted[as.character(observed$name)]) - } - if (reweight.method == "tc") { - sr_old <- tc_fitted - tmp_predicted <- mkin_wide_to_long(out_predicted, time = "time") - tmp_data <- suppressMessages(join(observed, tmp_predicted, by = c("time", - "name"))) - observed[err] <- predict(tc_fit, newdata = data.frame(obs = observed$value)) - } - fit <- modFit(cost, fit$par, method = method.modFit, control = control.modFit, - lower = lower, upper = upper, ...) - if (reweight.method == "obs") { - sr_new <- fit$var_ms_unweighted - } - if (reweight.method == "tc") { - tc_fit <- fit_error_model_mad_obs(cost(fit$par)$residuals, tc_fitted, - n.iter) - if (is.character(tc_fit)) { - if (!quiet) { - cat(tc_fit, ".\n") - } - break - } - else { - tc_fitted <- coef(tc_fit) - sr_new <- tc_fitted - } - } - reweight.diff = sum((sr_new - sr_old)^2) - if (!quiet) { - cat("Iteration", n.iter, "yields variance estimates:\n") - print(signif(sr_new, 8)) - cat("Sum of squared differences to last variance (component) estimates:", - signif(reweight.diff, 2), "\n") - } - } - } - }) at /home/jranke/git/mkin/R/mkinfit.R:396 +test_irls.R:44: skip: Reweighting method 'tc' works +Too much trouble with datasets that are randomly generated ──────────────────────────────────────────────────────────────────────────────── -
⠏ | 0 | Model predictions with mkinpredict
⠋ | 1 | Model predictions with mkinpredict
⠙ | 2 | Model predictions with mkinpredict
⠹ | 3 | Model predictions with mkinpredict
✔ | 3 | Model predictions with mkinpredict [0.4 s] -
⠏ | 0 | Fitting of parent only models
⠋ | 1 | Fitting of parent only models
⠙ | 2 | Fitting of parent only models
⠹ | 3 | Fitting of parent only models
⠸ | 4 | Fitting of parent only models
⠼ | 5 | Fitting of parent only models
⠴ | 6 | Fitting of parent only models
⠦ | 7 | Fitting of parent only models
⠧ | 8 | Fitting of parent only models
⠇ | 9 | Fitting of parent only models
⠏ | 10 | Fitting of parent only models
⠋ | 11 | Fitting of parent only models
⠙ | 12 | Fitting of parent only models
⠹ | 13 | Fitting of parent only models
⠸ | 14 | Fitting of parent only models
⠼ | 15 | Fitting of parent only models
⠴ | 16 | Fitting of parent only models
⠦ | 17 | Fitting of parent only models
⠧ | 18 | Fitting of parent only models
⠇ | 19 | Fitting of parent only models
⠏ | 20 | Fitting of parent only models
⠋ | 21 | Fitting of parent only models
✔ | 21 | Fitting of parent only models [22.1 s] -
⠏ | 0 | Complex test case from Schaefer et al. (2007) Piacenza paper
⠋ | 1 | Complex test case from Schaefer et al. (2007) Piacenza paper
⠙ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper
✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [5.2 s] -
⠏ | 0 | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠋ | 1 | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠙ | 2 | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠹ | 3 | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠸ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014)
✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [6.5 s] -
⠏ | 0 | Calculation of maximum time weighted average concentrations (TWAs)
⠋ | 1 | Calculation of maximum time weighted average concentrations (TWAs)
⠙ | 2 | Calculation of maximum time weighted average concentrations (TWAs)
⠹ | 3 | Calculation of maximum time weighted average concentrations (TWAs)
⠸ | 4 | Calculation of maximum time weighted average concentrations (TWAs)
⠼ | 5 | Calculation of maximum time weighted average concentrations (TWAs)
⠴ | 6 | Calculation of maximum time weighted average concentrations (TWAs)
⠦ | 7 | Calculation of maximum time weighted average concentrations (TWAs)
⠧ | 8 | Calculation of maximum time weighted average concentrations (TWAs)
✔ | 8 | Calculation of maximum time weighted average concentrations (TWAs) [7.6 s] +
⠏ | 0 | Fitting the logistic model
⠋ | 1 | Fitting the logistic model
⠙ | 1 1 | Fitting the logistic model
✔ | 1 1 | Fitting the logistic model [0.5 s] +──────────────────────────────────────────────────────────────────────────────── +test_logistic.R:42: skip: The logistic fit can be done via differential equation +Skip slow fit of logistic model using deSolve without compilation +──────────────────────────────────────────────────────────────────────────────── +
⠏ | 0 | Model predictions with mkinpredict
⠋ | 1 | Model predictions with mkinpredict
⠙ | 2 | Model predictions with mkinpredict
⠹ | 3 | Model predictions with mkinpredict
✔ | 3 | Model predictions with mkinpredict [0.3 s] +
⠏ | 0 | Fitting of parent only models
⠋ | 1 | Fitting of parent only models
⠙ | 2 | Fitting of parent only models
⠹ | 3 | Fitting of parent only models
⠸ | 4 | Fitting of parent only models
⠼ | 5 | Fitting of parent only models
⠴ | 6 | Fitting of parent only models
⠦ | 7 | Fitting of parent only models
⠧ | 8 | Fitting of parent only models
⠇ | 9 | Fitting of parent only models
⠏ | 10 | Fitting of parent only models
⠋ | 11 | Fitting of parent only models
⠙ | 12 | Fitting of parent only models
⠹ | 13 | Fitting of parent only models
⠸ | 14 | Fitting of parent only models
⠼ | 15 | Fitting of parent only models
⠴ | 16 | Fitting of parent only models
⠦ | 17 | Fitting of parent only models
⠧ | 18 | Fitting of parent only models
⠇ | 19 | Fitting of parent only models
⠏ | 20 | Fitting of parent only models
⠋ | 21 | Fitting of parent only models
✔ | 21 | Fitting of parent only models [23.9 s] +
⠏ | 0 | Complex test case from Schaefer et al. (2007) Piacenza paper
⠋ | 1 | Complex test case from Schaefer et al. (2007) Piacenza paper
⠙ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper
✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [6.0 s] +
⠏ | 0 | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠋ | 1 | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠙ | 2 | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠹ | 3 | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠸ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014)
✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [7.5 s] +
⠏ | 0 | Calculation of maximum time weighted average concentrations (TWAs)
⠋ | 1 | Calculation of maximum time weighted average concentrations (TWAs)
⠙ | 2 | Calculation of maximum time weighted average concentrations (TWAs)
⠹ | 3 | Calculation of maximum time weighted average concentrations (TWAs)
⠸ | 4 | Calculation of maximum time weighted average concentrations (TWAs)
⠼ | 5 | Calculation of maximum time weighted average concentrations (TWAs)
⠴ | 6 | Calculation of maximum time weighted average concentrations (TWAs)
⠦ | 7 | Calculation of maximum time weighted average concentrations (TWAs)
⠧ | 8 | Calculation of maximum time weighted average concentrations (TWAs)
✔ | 8 | Calculation of maximum time weighted average concentrations (TWAs) [8.4 s] ══ Results ═════════════════════════════════════════════════════════════════════ -Duration: 222.6 s +Duration: 65.5 s -OK: 55 -Failed: 1 +OK: 50 +Failed: 0 Warnings: 0 -Skipped: 0 +Skipped: 2 diff --git a/tests/testthat/test_logistic.R b/tests/testthat/test_logistic.R new file mode 100644 index 00000000..1ea1013b --- /dev/null +++ b/tests/testthat/test_logistic.R @@ -0,0 +1,47 @@ +# Copyright (C) 2019 Johannes Ranke +# Contact: jranke@uni-bremen.de + +# This file is part of the R package mkin + +# mkin is free software: you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. + +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. + +# You should have received a copy of the GNU General Public License along with +# this program. If not, see <http://www.gnu.org/licenses/> + +context("Fitting the logistic model") + +logistic <- mkinmod(parent = mkinsub("logistic")) + +sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) +parms_logistic <- c(kmax = 0.08, k0 = 0.0001, r = 0.2) +parms_logistic_optim <- c(parent_0 = 100, parms_logistic) +d_logistic <- mkinpredict(logistic, + parms_logistic, c(parent = 100), + sampling_times) +d_2_1 <- add_err(d_logistic, + sdfunc = function(x) sigma_twocomp(x, 0.5, 0.07), + n = 1, reps = 2, digits = 5, LOD = 0.1, seed = 123456) + +test_that("The logistic model fit is reproducible", { + m <- mkinfit("logistic", d_2_1[[1]], quiet = TRUE) + dtx <- endpoints(m)$distimes["parent", ] + expect_equivalent(dtx, c(36.86533, 62.41511), tolerance = 0.00001) +}) + +test_that("The logistic fit can be done via differential equation", { + # This is slow as we did not implement conversion to C + # because it is unlikely we will use the logistic model with metabolites + skip("Skip slow fit of logistic model using deSolve without compilation") + m_2 <- mkinfit("logistic", d_2_1[[1]], solution_type = "deSolve", + quiet = TRUE) + dtx_2 <- endpoints(m_2)$distimes["parent", ] + expect_equivalent(dtx_2, c(36.86533, 62.41511), tolerance = 0.00001) +}) |