aboutsummaryrefslogtreecommitdiff
path: root/docs/reference/confint.mkinfit.html
blob: 4d4fa012908c5ac057e68addc1c74aee9a88405c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="description" content="The default method 'quadratic' is based on the quadratic approximation of
the curvature of the likelihood function at the maximum likelihood parameter
estimates.
The alternative method 'profile' is based on the profile likelihood for each
parameter. The 'profile' method uses two nested optimisations and can take a
very long time, even if parallelized by specifying 'cores' on unixoid
platforms. The speed of the method could likely be improved by using the
method of Venzon and Moolgavkar (1988)."><title>Confidence intervals for parameters of mkinfit objects — confint.mkinfit • mkin</title><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.2.2/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.2.2/bootstrap.bundle.min.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- bootstrap-toc --><script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@v1.0.1/dist/bootstrap-toc.min.js" integrity="sha256-4veVQbu7//Lk5TSmc7YV48MxtMy98e26cf5MrgZYnwo=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Confidence intervals for parameters of mkinfit objects — confint.mkinfit"><meta property="og:description" content="The default method 'quadratic' is based on the quadratic approximation of
the curvature of the likelihood function at the maximum likelihood parameter
estimates.
The alternative method 'profile' is based on the profile likelihood for each
parameter. The 'profile' method uses two nested optimisations and can take a
very long time, even if parallelized by specifying 'cores' on unixoid
platforms. The speed of the method could likely be improved by using the
method of Venzon and Moolgavkar (1988)."><!-- 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>
    <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
    

    <nav class="navbar fixed-top navbar-default navbar-expand-lg bg-light"><div class="container">
    
    <a class="navbar-brand me-2" href="../index.html">mkin</a>

    <small class="nav-text text-default me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Released version">1.2.6</small>

    
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div id="navbar" class="collapse navbar-collapse ms-3">
      <ul class="navbar-nav me-auto"><li class="active nav-item">
  <a class="nav-link" href="../reference/index.html">Reference</a>
</li>
<li class="nav-item dropdown">
  <a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" id="dropdown-articles">Articles</a>
  <div class="dropdown-menu" aria-labelledby="dropdown-articles">
    <a class="dropdown-item" href="../articles/mkin.html">Introduction to mkin</a>
    <div class="dropdown-divider"></div>
    <h6 class="dropdown-header" data-toc-skip>Example evaluations with (generalised) nonlinear least squares</h6>
    <a class="dropdown-item" href="../articles/FOCUS_D.html">Example evaluation of FOCUS Example Dataset D</a>
    <a class="dropdown-item" href="../articles/FOCUS_L.html">Example evaluation of FOCUS Laboratory Data L1 to L3</a>
    <a class="dropdown-item" href="../articles/web_only/FOCUS_Z.html">Example evaluation of FOCUS Example Dataset Z</a>
    <div class="dropdown-divider"></div>
    <h6 class="dropdown-header" data-toc-skip>Example evaluations with hierarchical models (nonlinear mixed-effects models)</h6>
    <a class="dropdown-item" href="../articles/prebuilt/2022_dmta_parent.html">Testing hierarchical parent degradation kinetics with residue data on dimethenamid and dimethenamid-P</a>
    <a class="dropdown-item" href="../articles/prebuilt/2022_dmta_pathway.html">Testing hierarchical pathway kinetics with residue data on dimethenamid and dimethenamid-P</a>
    <a class="dropdown-item" href="../articles/prebuilt/2023_mesotrione_parent.html">Testing covariate modelling in hierarchical parent degradation kinetics with residue data on mesotrione</a>
    <a class="dropdown-item" href="../articles/prebuilt/2022_cyan_pathway.html">Testing hierarchical pathway kinetics with residue data on cyantraniliprole</a>
    <a class="dropdown-item" href="../articles/web_only/dimethenamid_2018.html">Comparison of saemix and nlme evaluations of dimethenamid data from 2018</a>
    <a class="dropdown-item" href="../articles/web_only/multistart.html">Short demo of the multistart method</a>
    <div class="dropdown-divider"></div>
    <h6 class="dropdown-header" data-toc-skip>Performance</h6>
    <a class="dropdown-item" href="../articles/web_only/compiled_models.html">Performance benefit by using compiled model definitions in mkin</a>
    <a class="dropdown-item" href="../articles/web_only/benchmarks.html">Benchmark timings for mkin</a>
    <a class="dropdown-item" href="../articles/web_only/saem_benchmarks.html">Benchmark timings for saem.mmkin</a>
    <div class="dropdown-divider"></div>
    <h6 class="dropdown-header" data-toc-skip>Miscellaneous</h6>
    <a class="dropdown-item" href="../articles/twa.html">Calculation of time weighted average concentrations with mkin</a>
    <a class="dropdown-item" href="../articles/web_only/NAFTA_examples.html">Example evaluation of NAFTA SOP Attachment examples</a>
  </div>
</li>
<li class="nav-item">
  <a class="nav-link" href="../news/index.html">News</a>
</li>
      </ul><form class="form-inline my-2 my-lg-0" role="search">
        <input type="search" class="form-control me-sm-2" aria-label="Toggle navigation" name="search-input" data-search-index="../search.json" id="search-input" placeholder="Search for" autocomplete="off"></form>

      <ul class="navbar-nav"><li class="nav-item">
  <a class="external-link nav-link" href="https://github.com/jranke/mkin/" aria-label="github">
    <span class="fab fa fab fa-github fa-lg"></span>
     
  </a>
</li>
      </ul></div>

    
  </div>
</nav><div class="container template-reference-topic">
<div class="row">
  <main id="main" class="col-md-9"><div class="page-header">
      <img src="" class="logo" alt=""><h1>Confidence intervals for parameters of mkinfit objects</h1>
      <small class="dont-index">Source: <a href="https://github.com/jranke/mkin/blob/HEAD/R/confint.mkinfit.R" class="external-link"><code>R/confint.mkinfit.R</code></a></small>
      <div class="d-none name"><code>confint.mkinfit.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>The default method 'quadratic' is based on the quadratic approximation of
the curvature of the likelihood function at the maximum likelihood parameter
estimates.
The alternative method 'profile' is based on the profile likelihood for each
parameter. The 'profile' method uses two nested optimisations and can take a
very long time, even if parallelized by specifying 'cores' on unixoid
platforms. The speed of the method could likely be improved by using the
method of Venzon and Moolgavkar (1988).</p>
    </div>

    <div class="section level2">
    <h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span><span class="co"># S3 method for mkinfit</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span></span>
<span>  <span class="va">object</span>,</span>
<span>  <span class="va">parm</span>,</span>
<span>  level <span class="op">=</span> <span class="fl">0.95</span>,</span>
<span>  alpha <span class="op">=</span> <span class="fl">1</span> <span class="op">-</span> <span class="va">level</span>,</span>
<span>  <span class="va">cutoff</span>,</span>
<span>  method <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"quadratic"</span>, <span class="st">"profile"</span><span class="op">)</span>,</span>
<span>  transformed <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span>  backtransform <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span>  cores <span class="op">=</span> <span class="fu">parallel</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/r/parallel/detectCores.html" class="external-link">detectCores</a></span><span class="op">(</span><span class="op">)</span>,</span>
<span>  rel_tol <span class="op">=</span> <span class="fl">0.01</span>,</span>
<span>  quiet <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  <span class="va">...</span></span>
<span><span class="op">)</span></span></code></pre></div>
    </div>

    <div class="section level2">
    <h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>
    <dl><dt>object</dt>
<dd><p>An <code><a href="mkinfit.html">mkinfit</a></code> object</p></dd>


<dt>parm</dt>
<dd><p>A vector of names of the parameters which are to be given
confidence intervals. If missing, all parameters are considered.</p></dd>


<dt>level</dt>
<dd><p>The confidence level required</p></dd>


<dt>alpha</dt>
<dd><p>The allowed error probability, overrides 'level' if specified.</p></dd>


<dt>cutoff</dt>
<dd><p>Possibility to specify an alternative cutoff for the difference
in the log-likelihoods at the confidence boundary. Specifying an explicit
cutoff value overrides arguments 'level' and 'alpha'</p></dd>


<dt>method</dt>
<dd><p>The 'quadratic' method approximates the likelihood function at
the optimised parameters using the second term of the Taylor expansion,
using a second derivative (hessian) contained in the object.
The 'profile' method searches the parameter space for the
cutoff of the confidence intervals by means of a likelihood ratio test.</p></dd>


<dt>transformed</dt>
<dd><p>If the quadratic approximation is used, should it be
applied to the likelihood based on the transformed parameters?</p></dd>


<dt>backtransform</dt>
<dd><p>If we approximate the likelihood in terms of the
transformed parameters, should we backtransform the parameters with
their confidence intervals?</p></dd>


<dt>cores</dt>
<dd><p>The number of cores to be used for multicore processing.
On Windows machines, cores &gt; 1 is currently not supported.</p></dd>


<dt>rel_tol</dt>
<dd><p>If the method is 'profile', what should be the accuracy
of the lower and upper bounds, relative to the estimate obtained from
the quadratic method?</p></dd>


<dt>quiet</dt>
<dd><p>Should we suppress the message "Profiling the likelihood"</p></dd>


<dt>...</dt>
<dd><p>Not used</p></dd>

</dl></div>
    <div class="section level2">
    <h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
    

<p>A matrix with columns giving lower and upper confidence limits for
each parameter.</p>
    </div>
    <div class="section level2">
    <h2 id="references">References<a class="anchor" aria-label="anchor" href="#references"></a></h2>
    <p>Bates DM and Watts GW (1988) Nonlinear regression analysis &amp; its applications</p>
<p>Pawitan Y (2013) In all likelihood - Statistical modelling and
inference using likelihood. Clarendon Press, Oxford.</p>
<p>Venzon DJ and Moolgavkar SH (1988) A Method for Computing
Profile-Likelihood Based Confidence Intervals, Applied Statistics, 37,
87–94.</p>
    </div>

    <div class="section level2">
    <h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="va">f</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinfit.html">mkinfit</a></span><span class="op">(</span><span class="st">"SFO"</span>, <span class="va">FOCUS_2006_C</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f</span>, method <span class="op">=</span> <span class="st">"quadratic"</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                2.5%      97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0 71.8242430 93.1600766</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent  0.2109541  0.4440528</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma     1.9778868  7.3681380</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># \dontrun{</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f</span>, method <span class="op">=</span> <span class="st">"profile"</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Profiling the likelihood</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                2.5%      97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0 73.0641834 92.1392181</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent  0.2170293  0.4235348</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma     3.1307772  8.0628314</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># Set the number of cores for the profiling method for further examples</span></span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/identical.html" class="external-link">identical</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/Sys.getenv.html" class="external-link">Sys.getenv</a></span><span class="op">(</span><span class="st">"NOT_CRAN"</span><span class="op">)</span>, <span class="st">"true"</span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span>  <span class="va">n_cores</span> <span class="op">&lt;-</span> <span class="fu">parallel</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/r/parallel/detectCores.html" class="external-link">detectCores</a></span><span class="op">(</span><span class="op">)</span> <span class="op">-</span> <span class="fl">1</span></span></span>
<span class="r-in"><span><span class="op">}</span> <span class="kw">else</span> <span class="op">{</span></span></span>
<span class="r-in"><span>  <span class="va">n_cores</span> <span class="op">&lt;-</span> <span class="fl">1</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/Sys.getenv.html" class="external-link">Sys.getenv</a></span><span class="op">(</span><span class="st">"TRAVIS"</span><span class="op">)</span> <span class="op">!=</span> <span class="st">""</span><span class="op">)</span> <span class="va">n_cores</span> <span class="op">=</span> <span class="fl">1</span></span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/Sys.info.html" class="external-link">Sys.info</a></span><span class="op">(</span><span class="op">)</span><span class="op">[</span><span class="st">"sysname"</span><span class="op">]</span> <span class="op">==</span> <span class="st">"Windows"</span><span class="op">)</span> <span class="va">n_cores</span> <span class="op">=</span> <span class="fl">1</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">SFO_SFO</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinmod.html">mkinmod</a></span><span class="op">(</span>parent <span class="op">=</span> <span class="fu"><a href="mkinmod.html">mkinsub</a></span><span class="op">(</span><span class="st">"SFO"</span>, <span class="st">"m1"</span><span class="op">)</span>, m1 <span class="op">=</span> <span class="fu"><a href="mkinmod.html">mkinsub</a></span><span class="op">(</span><span class="st">"SFO"</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>  use_of_ff <span class="op">=</span> <span class="st">"min"</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">SFO_SFO.ff</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinmod.html">mkinmod</a></span><span class="op">(</span>parent <span class="op">=</span> <span class="fu"><a href="mkinmod.html">mkinsub</a></span><span class="op">(</span><span class="st">"SFO"</span>, <span class="st">"m1"</span><span class="op">)</span>, m1 <span class="op">=</span> <span class="fu"><a href="mkinmod.html">mkinsub</a></span><span class="op">(</span><span class="st">"SFO"</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>  use_of_ff <span class="op">=</span> <span class="st">"max"</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">f_d_1</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinfit.html">mkinfit</a></span><span class="op">(</span><span class="va">SFO_SFO</span>, <span class="fu"><a href="https://rdrr.io/r/base/subset.html" class="external-link">subset</a></span><span class="op">(</span><span class="va">FOCUS_2006_D</span>, <span class="va">value</span> <span class="op">!=</span> <span class="fl">0</span><span class="op">)</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/system.time.html" class="external-link">system.time</a></span><span class="op">(</span><span class="va">ci_profile</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_d_1</span>, method <span class="op">=</span> <span class="st">"profile"</span>, cores <span class="op">=</span> <span class="fl">1</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>    user  system elapsed </span>
<span class="r-out co"><span class="r-pr">#&gt;</span>   1.203   0.000   1.203 </span>
<span class="r-in"><span><span class="co"># Using more cores does not save much time here, as parent_0 takes up most of the time</span></span></span>
<span class="r-in"><span><span class="co"># If we additionally exclude parent_0 (the confidence of which is often of</span></span></span>
<span class="r-in"><span><span class="co"># minor interest), we get a nice performance improvement if we use at least 4 cores</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/system.time.html" class="external-link">system.time</a></span><span class="op">(</span><span class="va">ci_profile_no_parent_0</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_d_1</span>, method <span class="op">=</span> <span class="st">"profile"</span>,</span></span>
<span class="r-in"><span>  <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"k_parent_sink"</span>, <span class="st">"k_parent_m1"</span>, <span class="st">"k_m1_sink"</span>, <span class="st">"sigma"</span><span class="op">)</span>, cores <span class="op">=</span> <span class="va">n_cores</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Profiling the likelihood</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>    user  system elapsed </span>
<span class="r-out co"><span class="r-pr">#&gt;</span>   0.438   0.097   0.301 </span>
<span class="r-in"><span><span class="va">ci_profile</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                       2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0      96.456003640 1.027703e+02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_sink  0.040762501 5.549764e-02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_m1    0.046786482 5.500879e-02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1_sink      0.003892605 6.702778e-03</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma          2.535612399 3.985263e+00</span>
<span class="r-in"><span><span class="va">ci_quadratic_transformed</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_d_1</span>, method <span class="op">=</span> <span class="st">"quadratic"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">ci_quadratic_transformed</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                       2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0      96.403841640 1.027931e+02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_sink  0.041033378 5.596269e-02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_m1    0.046777902 5.511931e-02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1_sink      0.004012217 6.897547e-03</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma          2.396089689 3.854918e+00</span>
<span class="r-in"><span><span class="va">ci_quadratic_untransformed</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_d_1</span>, method <span class="op">=</span> <span class="st">"quadratic"</span>, transformed <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">ci_quadratic_untransformed</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                       2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0      96.403841645 102.79312449</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_sink  0.040485331   0.05535491</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_m1    0.046611582   0.05494364</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1_sink      0.003835483   0.00668582</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma          2.396089689   3.85491806</span>
<span class="r-in"><span><span class="co"># Against the expectation based on Bates and Watts (1988), the confidence</span></span></span>
<span class="r-in"><span><span class="co"># intervals based on the internal parameter transformation are less</span></span></span>
<span class="r-in"><span><span class="co"># congruent with the likelihood based intervals. Note the superiority of the</span></span></span>
<span class="r-in"><span><span class="co"># interval based on the untransformed fit for k_m1_sink</span></span></span>
<span class="r-in"><span><span class="va">rel_diffs_transformed</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/MathFun.html" class="external-link">abs</a></span><span class="op">(</span><span class="op">(</span><span class="va">ci_quadratic_transformed</span> <span class="op">-</span> <span class="va">ci_profile</span><span class="op">)</span><span class="op">/</span><span class="va">ci_profile</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">rel_diffs_untransformed</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/MathFun.html" class="external-link">abs</a></span><span class="op">(</span><span class="op">(</span><span class="va">ci_quadratic_untransformed</span> <span class="op">-</span> <span class="va">ci_profile</span><span class="op">)</span><span class="op">/</span><span class="va">ci_profile</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">rel_diffs_transformed</span> <span class="op">&lt;</span> <span class="va">rel_diffs_untransformed</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                2.5% 97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0      FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_sink  TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_m1    TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1_sink     FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma         FALSE FALSE</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/Round.html" class="external-link">signif</a></span><span class="op">(</span><span class="va">rel_diffs_transformed</span>, <span class="fl">3</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                   2.5%    97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0      0.000541 0.000222</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_sink 0.006650 0.008380</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_m1   0.000183 0.002010</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1_sink     0.030700 0.029100</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma         0.055000 0.032700</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/Round.html" class="external-link">signif</a></span><span class="op">(</span><span class="va">rel_diffs_untransformed</span>, <span class="fl">3</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                   2.5%    97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0      0.000541 0.000222</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_sink 0.006800 0.002570</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent_m1   0.003740 0.001180</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1_sink     0.014700 0.002530</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma         0.055000 0.032700</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># Investigate a case with formation fractions</span></span></span>
<span class="r-in"><span><span class="va">f_d_2</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinfit.html">mkinfit</a></span><span class="op">(</span><span class="va">SFO_SFO.ff</span>, <span class="fu"><a href="https://rdrr.io/r/base/subset.html" class="external-link">subset</a></span><span class="op">(</span><span class="va">FOCUS_2006_D</span>, <span class="va">value</span> <span class="op">!=</span> <span class="fl">0</span><span class="op">)</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">ci_profile_ff</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_d_2</span>, method <span class="op">=</span> <span class="st">"profile"</span>, cores <span class="op">=</span> <span class="va">n_cores</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Profiling the likelihood</span>
<span class="r-in"><span><span class="va">ci_profile_ff</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                        2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0       96.456003640 1.027703e+02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent        0.090911032 1.071578e-01</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1            0.003892606 6.702775e-03</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_m1  0.471328495 5.611550e-01</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma           2.535612399 3.985263e+00</span>
<span class="r-in"><span><span class="va">ci_quadratic_transformed_ff</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_d_2</span>, method <span class="op">=</span> <span class="st">"quadratic"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">ci_quadratic_transformed_ff</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                        2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0       96.403833581 102.79311649</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent        0.090823771   0.10725430</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1            0.004012219   0.00689755</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_m1  0.469118824   0.55959615</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma           2.396089689   3.85491806</span>
<span class="r-in"><span><span class="va">ci_quadratic_untransformed_ff</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_d_2</span>, method <span class="op">=</span> <span class="st">"quadratic"</span>, transformed <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">ci_quadratic_untransformed_ff</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                        2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0       96.403833586 1.027931e+02</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent        0.090491913 1.069035e-01</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1            0.003835485 6.685823e-03</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_m1  0.469113477 5.598387e-01</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma           2.396089689 3.854918e+00</span>
<span class="r-in"><span><span class="va">rel_diffs_transformed_ff</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/MathFun.html" class="external-link">abs</a></span><span class="op">(</span><span class="op">(</span><span class="va">ci_quadratic_transformed_ff</span> <span class="op">-</span> <span class="va">ci_profile_ff</span><span class="op">)</span><span class="op">/</span><span class="va">ci_profile_ff</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">rel_diffs_untransformed_ff</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/MathFun.html" class="external-link">abs</a></span><span class="op">(</span><span class="op">(</span><span class="va">ci_quadratic_untransformed_ff</span> <span class="op">-</span> <span class="va">ci_profile_ff</span><span class="op">)</span><span class="op">/</span><span class="va">ci_profile_ff</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="co"># While the confidence interval for the parent rate constant is closer to</span></span></span>
<span class="r-in"><span><span class="co"># the profile based interval when using the internal parameter</span></span></span>
<span class="r-in"><span><span class="co"># transformation, the interval for the metabolite rate constant is 'better</span></span></span>
<span class="r-in"><span><span class="co"># without internal parameter transformation.</span></span></span>
<span class="r-in"><span><span class="va">rel_diffs_transformed_ff</span> <span class="op">&lt;</span> <span class="va">rel_diffs_untransformed_ff</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                 2.5% 97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0       FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent        TRUE  TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1           FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_m1  TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma           TRUE FALSE</span>
<span class="r-in"><span><span class="va">rel_diffs_transformed_ff</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                        2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0       0.0005408690 0.0002217233</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent       0.0009598532 0.0009001864</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1           0.0307283045 0.0290588367</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_m1 0.0046881768 0.0027780062</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma          0.0550252516 0.0327066836</span>
<span class="r-in"><span><span class="va">rel_diffs_untransformed_ff</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                        2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0       0.0005408689 0.0002217233</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_parent       0.0046102155 0.0023732280</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_m1           0.0146740687 0.0025291815</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_m1 0.0046995210 0.0023457712</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma          0.0550252516 0.0327066836</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># The profiling for the following fit does not finish in a reasonable time,</span></span></span>
<span class="r-in"><span><span class="co"># therefore we use the quadratic approximation</span></span></span>
<span class="r-in"><span><span class="va">m_synth_DFOP_par</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinmod.html">mkinmod</a></span><span class="op">(</span>parent <span class="op">=</span> <span class="fu"><a href="mkinmod.html">mkinsub</a></span><span class="op">(</span><span class="st">"DFOP"</span>, <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"M1"</span>, <span class="st">"M2"</span><span class="op">)</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>  M1 <span class="op">=</span> <span class="fu"><a href="mkinmod.html">mkinsub</a></span><span class="op">(</span><span class="st">"SFO"</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>  M2 <span class="op">=</span> <span class="fu"><a href="mkinmod.html">mkinsub</a></span><span class="op">(</span><span class="st">"SFO"</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>  use_of_ff <span class="op">=</span> <span class="st">"max"</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">DFOP_par_c</span> <span class="op">&lt;-</span> <span class="va">synthetic_data_for_UBA_2014</span><span class="op">[[</span><span class="fl">12</span><span class="op">]</span><span class="op">]</span><span class="op">$</span><span class="va">data</span></span></span>
<span class="r-in"><span><span class="va">f_tc_2</span> <span class="op">&lt;-</span> <span class="fu"><a href="mkinfit.html">mkinfit</a></span><span class="op">(</span><span class="va">m_synth_DFOP_par</span>, <span class="va">DFOP_par_c</span>, error_model <span class="op">=</span> <span class="st">"tc"</span>,</span></span>
<span class="r-in"><span>  error_model_algorithm <span class="op">=</span> <span class="st">"direct"</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_tc_2</span>, method <span class="op">=</span> <span class="st">"quadratic"</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                        2.5%        97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0       94.596181875 106.19936592</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_M1            0.037605432   0.04490757</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k_M2            0.008568745   0.01087675</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_M1  0.021464676   0.62023880</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> f_parent_to_M2  0.015167158   0.37975350</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k1              0.273897535   0.33388072</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> k2              0.018614555   0.02250379</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> g               0.671943738   0.73583261</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> sigma_low       0.251283679   0.83992102</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> rsd_high        0.040411022   0.07662008</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">f_tc_2</span>, <span class="st">"parent_0"</span>, method <span class="op">=</span> <span class="st">"quadratic"</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>              2.5%    97.5%</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> parent_0 94.59618 106.1994</span>
<span class="r-in"><span><span class="co"># }</span></span></span>
</code></pre></div>
    </div>
  </main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>
    </nav></aside></div>


    <footer><div class="pkgdown-footer-left">
  <p></p><p>Developed by Johannes Ranke.</p>
</div>

<div class="pkgdown-footer-right">
  <p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>

    </footer></div>

  

  

  </body></html>

Contact - Imprint