aboutsummaryrefslogtreecommitdiff
path: root/docs/reference/confint.mkinfit.html
blob: 06e78459514c8cacd1f519ef23aaa3346ed534fc (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
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
<!-- 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>Confidence intervals for parameters of mkinfit objects — confint.mkinfit • mkin</title>


<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<!-- Bootstrap -->

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous" />

<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script>

<!-- bootstrap-toc -->
<link rel="stylesheet" href="../bootstrap-toc.css">
<script src="../bootstrap-toc.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" />

<!-- 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>

<!-- 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>

<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
<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 data-spy="scroll" data-target="#toc">
    <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">1.0.3</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>
    <li>
      <a href="../articles/web_only/NAFTA_examples.html">Example evaluation of NAFTA SOP Attachment examples</a>
    </li>
    <li>
      <a href="../articles/web_only/benchmarks.html">Some benchmark timings</a>
    </li>
  </ul>
</li>
<li>
  <a href="../news/index.html">News</a>
</li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li>
  <a href="https://github.com/jranke/mkin/">
    <span class="fab fa-github fa-lg"></span>
     
  </a>
</li>
      </ul>
      
    </div><!--/.nav-collapse -->
  </div><!--/.container -->
</div><!--/.navbar -->

      

      </header>

<div class="row">
  <div class="col-md-9 contents">
    <div class="page-header">
    <h1>Confidence intervals for parameters of mkinfit objects</h1>
    <small class="dont-index">Source: <a href='https://github.com/jranke/mkin/blob/master/R/confint.mkinfit.R'><code>R/confint.mkinfit.R</code></a></small>
    <div class="hidden name"><code>confint.mkinfit.Rd</code></div>
    </div>

    <div class="ref-description">
    <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>

    <pre class="usage"><span class='co'># S3 method for mkinfit</span>
<span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>confint</a></span><span class='op'>(</span>
  <span class='va'>object</span>,
  <span class='va'>parm</span>,
  level <span class='op'>=</span> <span class='fl'>0.95</span>,
  alpha <span class='op'>=</span> <span class='fl'>1</span> <span class='op'>-</span> <span class='va'>level</span>,
  <span class='va'>cutoff</span>,
  method <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"quadratic"</span>, <span class='st'>"profile"</span><span class='op'>)</span>,
  transformed <span class='op'>=</span> <span class='cn'>TRUE</span>,
  backtransform <span class='op'>=</span> <span class='cn'>TRUE</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'>detectCores</a></span><span class='op'>(</span><span class='op'>)</span>,
  rel_tol <span class='op'>=</span> <span class='fl'>0.01</span>,
  quiet <span class='op'>=</span> <span class='cn'>FALSE</span>,
  <span class='va'>...</span>
<span class='op'>)</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>object</th>
      <td><p>An <code><a href='mkinfit.html'>mkinfit</a></code> object</p></td>
    </tr>
    <tr>
      <th>parm</th>
      <td><p>A vector of names of the parameters which are to be given
confidence intervals. If missing, all parameters are considered.</p></td>
    </tr>
    <tr>
      <th>level</th>
      <td><p>The confidence level required</p></td>
    </tr>
    <tr>
      <th>alpha</th>
      <td><p>The allowed error probability, overrides 'level' if specified.</p></td>
    </tr>
    <tr>
      <th>cutoff</th>
      <td><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></td>
    </tr>
    <tr>
      <th>method</th>
      <td><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></td>
    </tr>
    <tr>
      <th>transformed</th>
      <td><p>If the quadratic approximation is used, should it be
applied to the likelihood based on the transformed parameters?</p></td>
    </tr>
    <tr>
      <th>backtransform</th>
      <td><p>If we approximate the likelihood in terms of the
transformed parameters, should we backtransform the parameters with
their confidence intervals?</p></td>
    </tr>
    <tr>
      <th>cores</th>
      <td><p>The number of cores to be used for multicore processing.
On Windows machines, cores &gt; 1 is currently not supported.</p></td>
    </tr>
    <tr>
      <th>rel_tol</th>
      <td><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></td>
    </tr>
    <tr>
      <th>quiet</th>
      <td><p>Should we suppress the message "Profiling the likelihood"</p></td>
    </tr>
    <tr>
      <th>...</th>
      <td><p>Not used</p></td>
    </tr>
    </table>

    <h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>

    <p>A matrix with columns giving lower and upper confidence limits for
each parameter.</p>
    <h2 class="hasAnchor" id="references"><a class="anchor" href="#references"></a>References</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>

    <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
    <pre class="examples"><div class='input'><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 class='fu'><a href='https://rdrr.io/r/stats/confint.html'>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>
</div><div class='output co'>#&gt;                2.5%      97.5%
#&gt; parent_0 71.8242430 93.1600766
#&gt; k_parent  0.2109541  0.4440528
#&gt; sigma     1.9778868  7.3681380</div><div class='input'>
<span class='co'># \dontrun{</span>
<span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>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>
</div><div class='output co'>#&gt; <span class='message'>Profiling the likelihood</span></div><div class='output co'>#&gt;                2.5%      97.5%
#&gt; parent_0 73.0641834 92.1392181
#&gt; k_parent  0.2170293  0.4235348
#&gt; sigma     3.1307772  8.0628314</div><div class='input'>
<span class='co'># Set the number of cores for the profiling method for further examples</span>
<span class='kw'>if</span> <span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/identical.html'>identical</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/Sys.getenv.html'>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 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'>detectCores</a></span><span class='op'>(</span><span class='op'>)</span> <span class='op'>-</span> <span class='fl'>1</span>
<span class='op'>}</span> <span class='kw'>else</span> <span class='op'>{</span>
  <span class='va'>n_cores</span> <span class='op'>&lt;-</span> <span class='fl'>1</span>
<span class='op'>}</span>
<span class='kw'>if</span> <span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/Sys.getenv.html'>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 class='kw'>if</span> <span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/Sys.info.html'>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 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>,
  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 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>,
  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 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'>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 class='fu'><a href='https://rdrr.io/r/base/system.time.html'>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'>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>
</div><div class='output co'>#&gt;    user  system elapsed 
#&gt;   4.255   1.029   3.937 </div><div class='input'><span class='co'># Using more cores does not save much time here, as parent_0 takes up most of the time</span>
<span class='co'># If we additionally exclude parent_0 (the confidence of which is often of</span>
<span class='co'># minor interest), we get a nice performance improvement if we use at least 4 cores</span>
<span class='fu'><a href='https://rdrr.io/r/base/system.time.html'>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'>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 class='fu'><a href='https://rdrr.io/r/base/c.html'>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>
</div><div class='output co'>#&gt; <span class='message'>Profiling the likelihood</span></div><div class='output co'>#&gt;    user  system elapsed 
#&gt;   1.469   0.092   0.911 </div><div class='input'><span class='va'>ci_profile</span>
</div><div class='output co'>#&gt;                       2.5%        97.5%
#&gt; parent_0      96.456003640 1.027703e+02
#&gt; k_parent_sink  0.040762501 5.549764e-02
#&gt; k_parent_m1    0.046786482 5.500879e-02
#&gt; k_m1_sink      0.003892605 6.702778e-03
#&gt; sigma          2.535612399 3.985263e+00</div><div class='input'><span class='va'>ci_quadratic_transformed</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>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 class='va'>ci_quadratic_transformed</span>
</div><div class='output co'>#&gt;                       2.5%        97.5%
#&gt; parent_0      96.403841640 1.027931e+02
#&gt; k_parent_sink  0.041033378 5.596269e-02
#&gt; k_parent_m1    0.046777902 5.511931e-02
#&gt; k_m1_sink      0.004012217 6.897547e-03
#&gt; sigma          2.396089689 3.854918e+00</div><div class='input'><span class='va'>ci_quadratic_untransformed</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>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 class='va'>ci_quadratic_untransformed</span>
</div><div class='output co'>#&gt;                       2.5%        97.5%
#&gt; parent_0      96.403841645 102.79312449
#&gt; k_parent_sink  0.040485331   0.05535491
#&gt; k_parent_m1    0.046611582   0.05494364
#&gt; k_m1_sink      0.003835483   0.00668582
#&gt; sigma          2.396089689   3.85491806</div><div class='input'><span class='co'># Against the expectation based on Bates and Watts (1988), the confidence</span>
<span class='co'># intervals based on the internal parameter transformation are less</span>
<span class='co'># congruent with the likelihood based intervals. Note the superiority of the</span>
<span class='co'># interval based on the untransformed fit for k_m1_sink</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'>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 class='va'>rel_diffs_untransformed</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/MathFun.html'>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 class='va'>rel_diffs_transformed</span> <span class='op'>&lt;</span> <span class='va'>rel_diffs_untransformed</span>
</div><div class='output co'>#&gt;                2.5% 97.5%
#&gt; parent_0      FALSE FALSE
#&gt; k_parent_sink  TRUE FALSE
#&gt; k_parent_m1    TRUE FALSE
#&gt; k_m1_sink     FALSE FALSE
#&gt; sigma         FALSE FALSE</div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/Round.html'>signif</a></span><span class='op'>(</span><span class='va'>rel_diffs_transformed</span>, <span class='fl'>3</span><span class='op'>)</span>
</div><div class='output co'>#&gt;                   2.5%    97.5%
#&gt; parent_0      0.000541 0.000222
#&gt; k_parent_sink 0.006650 0.008380
#&gt; k_parent_m1   0.000183 0.002010
#&gt; k_m1_sink     0.030700 0.029100
#&gt; sigma         0.055000 0.032700</div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/Round.html'>signif</a></span><span class='op'>(</span><span class='va'>rel_diffs_untransformed</span>, <span class='fl'>3</span><span class='op'>)</span>
</div><div class='output co'>#&gt;                   2.5%    97.5%
#&gt; parent_0      0.000541 0.000222
#&gt; k_parent_sink 0.006800 0.002570
#&gt; k_parent_m1   0.003740 0.001180
#&gt; k_m1_sink     0.014700 0.002530
#&gt; sigma         0.055000 0.032700</div><div class='input'>

<span class='co'># Investigate a case with formation fractions</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'>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 class='va'>ci_profile_ff</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>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>
</div><div class='output co'>#&gt; <span class='message'>Profiling the likelihood</span></div><div class='input'><span class='va'>ci_profile_ff</span>
</div><div class='output co'>#&gt;                        2.5%        97.5%
#&gt; parent_0       96.456003640 1.027703e+02
#&gt; k_parent        0.090911032 1.071578e-01
#&gt; k_m1            0.003892606 6.702775e-03
#&gt; f_parent_to_m1  0.471328495 5.611550e-01
#&gt; sigma           2.535612399 3.985263e+00</div><div class='input'><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'>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 class='va'>ci_quadratic_transformed_ff</span>
</div><div class='output co'>#&gt;                        2.5%        97.5%
#&gt; parent_0       96.403833578 102.79311649
#&gt; k_parent        0.090823771   0.10725430
#&gt; k_m1            0.004012219   0.00689755
#&gt; f_parent_to_m1  0.469118824   0.55959615
#&gt; sigma           2.396089689   3.85491806</div><div class='input'><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'>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 class='va'>ci_quadratic_untransformed_ff</span>
</div><div class='output co'>#&gt;                        2.5%        97.5%
#&gt; parent_0       96.403833583 1.027931e+02
#&gt; k_parent        0.090491913 1.069035e-01
#&gt; k_m1            0.003835485 6.685823e-03
#&gt; f_parent_to_m1  0.469113477 5.598387e-01
#&gt; sigma           2.396089689 3.854918e+00</div><div class='input'><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'>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 class='va'>rel_diffs_untransformed_ff</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/MathFun.html'>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 class='co'># While the confidence interval for the parent rate constant is closer to</span>
<span class='co'># the profile based interval when using the internal parameter</span>
<span class='co'># transformation, the interval for the metabolite rate constant is 'better</span>
<span class='co'># without internal parameter transformation.</span>
<span class='va'>rel_diffs_transformed_ff</span> <span class='op'>&lt;</span> <span class='va'>rel_diffs_untransformed_ff</span>
</div><div class='output co'>#&gt;                 2.5% 97.5%
#&gt; parent_0       FALSE FALSE
#&gt; k_parent        TRUE  TRUE
#&gt; k_m1           FALSE FALSE
#&gt; f_parent_to_m1  TRUE FALSE
#&gt; sigma           TRUE FALSE</div><div class='input'><span class='va'>rel_diffs_transformed_ff</span>
</div><div class='output co'>#&gt;                        2.5%        97.5%
#&gt; parent_0       0.0005408690 0.0002217233
#&gt; k_parent       0.0009598532 0.0009001864
#&gt; k_m1           0.0307283041 0.0290588361
#&gt; f_parent_to_m1 0.0046881769 0.0027780063
#&gt; sigma          0.0550252516 0.0327066836</div><div class='input'><span class='va'>rel_diffs_untransformed_ff</span>
</div><div class='output co'>#&gt;                        2.5%        97.5%
#&gt; parent_0       0.0005408689 0.0002217232
#&gt; k_parent       0.0046102156 0.0023732281
#&gt; k_m1           0.0146740690 0.0025291820
#&gt; f_parent_to_m1 0.0046995211 0.0023457712
#&gt; sigma          0.0550252516 0.0327066836</div><div class='input'>
<span class='co'># The profiling for the following fit does not finish in a reasonable time,</span>
<span class='co'># therefore we use the quadratic approximation</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'>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>,
  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>,
  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>,
  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 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 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>,
  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 class='fu'><a href='https://rdrr.io/r/stats/confint.html'>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>
</div><div class='output co'>#&gt;                        2.5%        97.5%
#&gt; parent_0       94.596039609 106.19954892
#&gt; k_M1            0.037605368   0.04490762
#&gt; k_M2            0.008568731   0.01087676
#&gt; f_parent_to_M1  0.021462489   0.62023882
#&gt; f_parent_to_M2  0.015165617   0.37975348
#&gt; k1              0.273897348   0.33388101
#&gt; k2              0.018614554   0.02250378
#&gt; g               0.671943411   0.73583305
#&gt; sigma_low       0.251283495   0.83992077
#&gt; rsd_high        0.040411024   0.07662008</div><div class='input'><span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>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>
</div><div class='output co'>#&gt;              2.5%    97.5%
#&gt; parent_0 94.59604 106.1995</div><div class='input'><span class='co'># }</span>
</div></pre>
  </div>
  <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
    <nav id="toc" data-toggle="toc" class="sticky-top">
      <h2 data-toc-skip>Contents</h2>
    </nav>
  </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.6.1.</p>
</div>

      </footer>
   </div>

  


  </body>
</html>


Contact - Imprint