aboutsummaryrefslogtreecommitdiff
path: root/docs/articles/FOCUS_D.html
blob: 726c8378edf392ae215b3571f8851276cb8f8741 (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
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html><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.0"><title>Example evaluation of FOCUS Example Dataset D &bull; mkin</title><!-- jquery --><script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script><!-- Font Awesome icons --><link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"><script src="../jquery.sticky-kit.min.js"></script><script src="../pkgdown.js"></script><!-- mathjax --><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></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-vignette">
      <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">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="../index.html">mkin</a>
    </div>
    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav"><li>
  <a href="../reference/index.html">Reference</a>
</li>
<li>
  <a href="../articles/index.html">Articles</a>
</li>
<li>
  <a href="../news/index.html">News</a>
</li>
      </ul><ul class="nav navbar-nav navbar-right"><li>
  <a href="http://github.com/jranke/mkin">
    <span class="fa fa-github fa-lg"></span>
     
  </a>
</li>
      </ul></div><!--/.nav-collapse -->
  </div><!--/.container -->
</div><!--/.navbar -->

      
      </header><div class="row">
  <div class="col-md-9">
    <div class="page-header toc-ignore">
      <h1>Example evaluation of FOCUS Example Dataset D</h1>
                        <h4 class="author">Johannes Ranke</h4>
            
            <h4 class="date">2016-11-03</h4>
          </div>

    
    
<div class="contents">
<p>This is just a very simple vignette showing how to fit a degradation model for a parent compound with one transformation product using <code>mkin</code>. After loading the library we look a the data. We have observed concentrations in the column named <code>value</code> at the times specified in column <code>time</code> for the two observed variables named <code>parent</code> and <code>m1</code>.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>(<span class="st">"mkin"</span>)
<span class="kw">print</span>(FOCUS_2006_D)</code></pre></div>
<pre><code>##      name time  value
## 1  parent    0  99.46
## 2  parent    0 102.04
## 3  parent    1  93.50
## 4  parent    1  92.50
## 5  parent    3  63.23
## 6  parent    3  68.99
## 7  parent    7  52.32
## 8  parent    7  55.13
## 9  parent   14  27.27
## 10 parent   14  26.64
## 11 parent   21  11.50
## 12 parent   21  11.64
## 13 parent   35   2.85
## 14 parent   35   2.91
## 15 parent   50   0.69
## 16 parent   50   0.63
## 17 parent   75   0.05
## 18 parent   75   0.06
## 19 parent  100     NA
## 20 parent  100     NA
## 21 parent  120     NA
## 22 parent  120     NA
## 23     m1    0   0.00
## 24     m1    0   0.00
## 25     m1    1   4.84
## 26     m1    1   5.64
## 27     m1    3  12.91
## 28     m1    3  12.96
## 29     m1    7  22.97
## 30     m1    7  24.47
## 31     m1   14  41.69
## 32     m1   14  33.21
## 33     m1   21  44.37
## 34     m1   21  46.44
## 35     m1   35  41.22
## 36     m1   35  37.95
## 37     m1   50  41.19
## 38     m1   50  40.01
## 39     m1   75  40.09
## 40     m1   75  33.85
## 41     m1  100  31.04
## 42     m1  100  33.13
## 43     m1  120  25.15
## 44     m1  120  33.31</code></pre>
<p>Next we specify the degradation model: The parent compound degrades with simple first-order kinetics (SFO) to one metabolite named m1, which also degrades with SFO kinetics.</p>
<p>The call to mkinmod returns a degradation model. The differential equations represented in R code can be found in the character vector <code>$diffs</code> of the <code>mkinmod</code> object. If a C compiler (gcc) is installed and functional, the differential equation model will be compiled from auto-generated C code.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">SFO_SFO &lt;-<span class="st"> </span><span class="kw"><a href="../reference/mkinmod.html">mkinmod</a></span>(<span class="dt">parent =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"m1"</span>), <span class="dt">m1 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))</code></pre></div>
<pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">print</span>(SFO_SFO$diffs)</code></pre></div>
<pre><code>##                                                       parent 
## "d_parent = - k_parent_sink * parent - k_parent_m1 * parent" 
##                                                           m1 
##             "d_m1 = + k_parent_m1 * parent - k_m1_sink * m1"</code></pre>
<p>We do the fitting without progress report (<code>quiet = TRUE</code>).</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">fit &lt;-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_2006_D, <span class="dt">quiet =</span> <span class="ot">TRUE</span>)</code></pre></div>
<p>A plot of the fit including a residual plot for both observed variables is obtained using the <code>plot</code> method for <code>mkinfit</code> objects.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">plot</span>(fit, <span class="dt">show_residuals =</span> <span class="ot">TRUE</span>)</code></pre></div>
<p><img src="FOCUS_D_files/figure-html/plot-1.png" width="672"></p>
<p>Confidence intervals for the parameter estimates are obtained using the <code>mkinparplot</code> function.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw"><a href="../reference/mkinparplot.html">mkinparplot</a></span>(fit)</code></pre></div>
<p><img src="FOCUS_D_files/figure-html/plot_2-1.png" width="672"></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"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(fit)</code></pre></div>
<pre><code>## mkin version:    0.9.44.9000 
## R version:       3.3.2 
## Date of fit:     Wed Nov  2 16:25:22 2016 
## Date of summary: Wed Nov  2 16:25:22 2016 
## 
## Equations:
## d_parent = - k_parent_sink * parent - k_parent_m1 * parent
## d_m1 = + k_parent_m1 * parent - k_m1_sink * m1
## 
## Model predictions using solution type deSolve 
## 
## Fitted with method Port using 153 model solutions performed in 0.665 s
## 
## Weighting: none
## 
## Starting values for parameters to be optimised:
##                  value   type
## parent_0      100.7500  state
## k_parent_sink   0.1000 deparm
## k_parent_m1     0.1001 deparm
## k_m1_sink       0.1002 deparm
## 
## Starting values for the transformed parameters actually optimised:
##                        value lower upper
## parent_0          100.750000  -Inf   Inf
## log_k_parent_sink  -2.302585  -Inf   Inf
## log_k_parent_m1    -2.301586  -Inf   Inf
## log_k_m1_sink      -2.300587  -Inf   Inf
## 
## Fixed parameter values:
##      value  type
## m1_0     0 state
## 
## Optimised, transformed parameters with symmetric confidence intervals:
##                   Estimate Std. Error  Lower   Upper
## parent_0            99.600    1.61400 96.330 102.900
## log_k_parent_sink   -3.038    0.07826 -3.197  -2.879
## log_k_parent_m1     -2.980    0.04124 -3.064  -2.897
## log_k_m1_sink       -5.248    0.13610 -5.523  -4.972
## 
## Parameter correlation:
##                   parent_0 log_k_parent_sink log_k_parent_m1 log_k_m1_sink
## parent_0           1.00000            0.6075        -0.06625       -0.1701
## log_k_parent_sink  0.60752            1.0000        -0.08740       -0.6253
## log_k_parent_m1   -0.06625           -0.0874         1.00000        0.4716
## log_k_m1_sink     -0.17006           -0.6253         0.47163        1.0000
## 
## Residual standard error: 3.211 on 36 degrees of freedom
## 
## Backtransformed parameters:
## Confidence intervals for internally transformed parameters are asymmetric.
## t-test (unrealistically) based on the assumption of normal distribution
## for estimators of untransformed parameters.
##                Estimate t value    Pr(&gt;t)     Lower     Upper
## parent_0      99.600000  61.720 2.024e-38 96.330000 1.029e+02
## k_parent_sink  0.047920  12.780 3.050e-15  0.040890 5.616e-02
## k_parent_m1    0.050780  24.250 3.407e-24  0.046700 5.521e-02
## k_m1_sink      0.005261   7.349 5.758e-09  0.003992 6.933e-03
## 
## Chi2 error levels in percent:
##          err.min n.optim df
## All data   6.398       4 15
## parent     6.827       3  6
## m1         4.490       1  9
## 
## Resulting formation fractions:
##                 ff
## parent_sink 0.4855
## parent_m1   0.5145
## m1_sink     1.0000
## 
## Estimated disappearance times:
##           DT50   DT90
## parent   7.023  23.33
## m1     131.761 437.70
## 
## Data:
##  time variable observed predicted   residual
##     0   parent    99.46 9.960e+01 -1.385e-01
##     0   parent   102.04 9.960e+01  2.442e+00
##     1   parent    93.50 9.024e+01  3.262e+00
##     1   parent    92.50 9.024e+01  2.262e+00
##     3   parent    63.23 7.407e+01 -1.084e+01
##     3   parent    68.99 7.407e+01 -5.083e+00
##     7   parent    52.32 4.991e+01  2.408e+00
##     7   parent    55.13 4.991e+01  5.218e+00
##    14   parent    27.27 2.501e+01  2.257e+00
##    14   parent    26.64 2.501e+01  1.627e+00
##    21   parent    11.50 1.253e+01 -1.035e+00
##    21   parent    11.64 1.253e+01 -8.946e-01
##    35   parent     2.85 3.148e+00 -2.979e-01
##    35   parent     2.91 3.148e+00 -2.379e-01
##    50   parent     0.69 7.162e-01 -2.624e-02
##    50   parent     0.63 7.162e-01 -8.624e-02
##    75   parent     0.05 6.074e-02 -1.074e-02
##    75   parent     0.06 6.074e-02 -7.382e-04
##   100   parent       NA 5.151e-03         NA
##   100   parent       NA 5.151e-03         NA
##   120   parent       NA 7.155e-04         NA
##   120   parent       NA 7.155e-04         NA
##     0       m1     0.00 0.000e+00  0.000e+00
##     0       m1     0.00 0.000e+00  0.000e+00
##     1       m1     4.84 4.803e+00  3.704e-02
##     1       m1     5.64 4.803e+00  8.370e-01
##     3       m1    12.91 1.302e+01 -1.140e-01
##     3       m1    12.96 1.302e+01 -6.400e-02
##     7       m1    22.97 2.504e+01 -2.075e+00
##     7       m1    24.47 2.504e+01 -5.748e-01
##    14       m1    41.69 3.669e+01  5.000e+00
##    14       m1    33.21 3.669e+01 -3.480e+00
##    21       m1    44.37 4.165e+01  2.717e+00
##    21       m1    46.44 4.165e+01  4.787e+00
##    35       m1    41.22 4.331e+01 -2.093e+00
##    35       m1    37.95 4.331e+01 -5.363e+00
##    50       m1    41.19 4.122e+01 -2.831e-02
##    50       m1    40.01 4.122e+01 -1.208e+00
##    75       m1    40.09 3.645e+01  3.643e+00
##    75       m1    33.85 3.645e+01 -2.597e+00
##   100       m1    31.04 3.198e+01 -9.416e-01
##   100       m1    33.13 3.198e+01  1.148e+00
##   120       m1    25.15 2.879e+01 -3.640e+00
##   120       m1    33.31 2.879e+01  4.520e+00</code></pre>
</div>
  </div>

  <div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
      </div>

</div>


      <footer><div class="copyright">
  <p>Developed by Johannes Ranke.</p>
</div>

<div class="pkgdown">
  <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p>
</div>

      </footer></div>

  </body></html>

Contact - Imprint