aboutsummaryrefslogtreecommitdiff
path: root/vignettes/FOCUS_Z.Rnw
blob: 694c5eead4dc7975000998d82ca09dedea04f440 (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
%\VignetteIndexEntry{Examples evaluation of FOCUS dataset Z}
%\VignetteEngine{knitr::knitr}
\documentclass[12pt,a4paper]{article}
\usepackage{a4wide}
\input{header}
\hypersetup{  
  pdftitle = {Example evaluation of FOCUS dataset Z},
  pdfsubject = {Manuscript},
  pdfauthor = {Johannes Ranke},
  colorlinks = {true},
  linkcolor = {blue},
  citecolor = {blue},
  urlcolor = {red},
  hyperindex = {true},
  linktocpage = {true},
}

\begin{document}

<<include=FALSE>>=
require(knitr)
opts_chunk$set(engine='R', tidy=FALSE)
@

\title{Example evaluation of FOCUS dataset Z}
\author{\textbf{Johannes Ranke} \\[0.5cm]
%EndAName
Eurofins Regulatory AG\\
Weidenweg 15, CH--4310 Rheinfelden, Switzerland\\[0.5cm]
and\\[0.5cm]
University of Bremen\\
}
\maketitle

\thispagestyle{empty} \setcounter{page}{0}

\clearpage

\tableofcontents

\textbf{Key words}: Kinetics, FOCUS, nonlinear optimisation

\section{The data}

The following code defines the example dataset from Appendix 7 to the FOCUS kinetics
report \citep{FOCUSkinetics2011}, p.350.

<<FOCUS_2006_Z_data, echo=TRUE, eval=TRUE>>=
require(mkin)
LOD = 0.5
FOCUS_2006_Z = data.frame(
  t = c(0, 0.04, 0.125, 0.29, 0.54, 1, 2, 3, 4, 7, 10, 14, 21, 
        42, 61, 96, 124),
  Z0 = c(100, 81.7, 70.4, 51.1, 41.2, 6.6, 4.6, 3.9, 4.6, 4.3, 6.8, 
         2.9, 3.5, 5.3, 4.4, 1.2, 0.7),
  Z1 = c(0, 18.3, 29.6, 46.3, 55.1, 65.7, 39.1, 36, 15.3, 5.6, 1.1, 
         1.6, 0.6, 0.5 * LOD, NA, NA, NA),
  Z2 = c(0, NA, 0.5 * LOD, 2.6, 3.8, 15.3, 37.2, 31.7, 35.6, 14.5, 
         0.8, 2.1, 1.9, 0.5 * LOD, NA, NA, NA),
  Z3 = c(0, NA, NA, NA, NA, 0.5 * LOD, 9.2, 13.1, 22.3, 28.4, 32.5, 
         25.2, 17.2, 4.8, 4.5, 2.8, 4.4))

FOCUS_2006_Z_mkin <- mkin_wide_to_long(FOCUS_2006_Z)
@

\section{Parent compound and one metabolite}

The next step is to set up the models used for the kinetic analysis. As the 
simultaneous fit of parent and the first metabolite is usually straightforward,
Step 1 (SFO for parent only) is skipped here. We start with the model 2a, 
with formation and decline of metabolite Z1 and the pathway from parent
directly to sink included (default in mkin).

<<FOCUS_2006_Z_fits_1, echo=TRUE, fig.height=4>>=
Z.2a <- mkinmod(Z0 = list(type = "SFO", to = "Z1"),
                Z1 = list(type = "SFO"))
m.Z.2a <- mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE)
plot(m.Z.2a)
summary(m.Z.2a, data = FALSE)
@

As obvious from the summary, the kinetic rate constant from parent compound Z to sink
is negligible. Accordingly, the exact magnitude of the fitted parameter 
\texttt{log k\_Z\_sink} is ill-defined and the covariance matrix is not returned.
This suggests, in agreement with the analysis in the FOCUS kinetics report, to simplify 
the model by removing the pathway to sink.

A similar result can be obtained when formation fractions are used in the model 
formulation:

<<FOCUS_2006_Z_fits_2, echo=TRUE, fig.height=4>>=
Z.2a.ff <- mkinmod(Z0 = list(type = "SFO", to = "Z1"),
                   Z1 = list(type = "SFO"),
                   use_of_ff = "max")

m.Z.2a.ff <- mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE)
plot(m.Z.2a.ff)
summary(m.Z.2a.ff, data = FALSE)
@

Here, the ilr transformed formation fraction fitted in the model takes a very
large value, and the backtransformed formation fraction from parent Z to Z1 is
practically unity. Again, the covariance matrix is not returned as the model is
overparameterised. 

The simplified model is obtained by setting the list component \texttt{sink} to
\texttt{FALSE}. 

<<FOCUS_2006_Z_fits_3, echo=TRUE, fig.height=4>>=
Z.3 <- mkinmod(Z0 = list(type = "SFO", to = "Z1", sink = FALSE),
               Z1 = list(type = "SFO"))
m.Z.3 <- mkinfit(Z.3, FOCUS_2006_Z_mkin, quiet = TRUE)
plot(m.Z.3)
summary(m.Z.3, data = FALSE)
@

This model definition is not supported when formation fractions 
are used, but the formation fraction can be fixed to unity.

<<FOCUS_2006_Z_fits_3.ff, echo=TRUE, fig.height=4>>=
Z.3.ff <- mkinmod(Z0 = list(type = "SFO", to = "Z1"),
               Z1 = list(type = "SFO"), use_of_ff = "max")
m.Z.3.ff <- mkinfit(Z.3.ff, FOCUS_2006_Z_mkin, 
                    parms.ini = c(f_Z0_to_Z1 = 1),
                    fixed_parms = "f_Z0_to_Z1",
                    quiet = TRUE)
summary(m.Z.3.ff, data = FALSE)
@

\section{Including metabolites Z2 and Z3}

As suggested in the FOCUS report, the pathway to sink was removed for metabolite Z1 as
well in the next step. While this step appears questionable on the basis of the above results, it 
is followed here for the purpose of comparison. Also, in the FOCUS report, it is 
assumed that there is additional empirical evidence that Z1 quickly and exclusively
hydrolyses to Z2. 

<<FOCUS_2006_Z_fits_5, echo=TRUE, fig.height=4>>=
Z.5 <- mkinmod(Z0 = list(type = "SFO", to = "Z1", sink = FALSE),
               Z1 = list(type = "SFO", to = "Z2", sink = FALSE),
               Z2 = list(type = "SFO"))
m.Z.5 <- mkinfit(Z.5, FOCUS_2006_Z_mkin, quiet = TRUE)
plot(m.Z.5)
summary(m.Z.5, data = FALSE)
@

Finally, metabolite Z3 is added to the model. The fit is accellerated
by using the starting parameters from the previous fit.

<<FOCUS_2006_Z_fits_6, echo=TRUE, fig.height=4>>=
Z.FOCUS <- mkinmod(Z0 = list(type = "SFO", to = "Z1", sink = FALSE),
                   Z1 = list(type = "SFO", to = "Z2", sink = FALSE),
                   Z2 = list(type = "SFO", to = "Z3"),
                   Z3 = list(type = "SFO"))
m.Z.FOCUS <- mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin, 
                     parms.ini = m.Z.5$bparms.ode,
                     quiet = TRUE)
plot(m.Z.FOCUS)
summary(m.Z.FOCUS, data = FALSE)
@

This is the fit corresponding to the final result chosen in Appendix 7 of the 
FOCUS report. The residual plots can be obtained by

<<FOCUS_2006_Z_residuals_6, echo=TRUE>>=
par(mfrow = c(2, 2))
mkinresplot(m.Z.FOCUS, "Z0", lpos = "bottomright")
mkinresplot(m.Z.FOCUS, "Z1", lpos = "bottomright")
mkinresplot(m.Z.FOCUS, "Z2", lpos = "bottomright")
mkinresplot(m.Z.FOCUS, "Z3", lpos = "bottomright")
@

\section{Using the SFORB model for parent and metabolites}

As the FOCUS report states, there is a certain tailing of the time course of metabolite 
Z3. Also, the time course of the parent compound is not fitted very well using the 
SFO model, as residues at a certain low level remain.

Therefore, an additional model is offered here, using the single first-order 
reversible binding (SFORB) model for metabolite Z3. As expected, the $\chi^2$
error level is lower for metabolite Z3 using this model and the graphical 
fit for Z3 is improved. However, the covariance matrix is not returned.

<<FOCUS_2006_Z_fits_7, echo=TRUE, fig.height=4>>=
Z.mkin.1 <- mkinmod(Z0 = list(type = "SFO", to = "Z1", sink = FALSE),
                    Z1 = list(type = "SFO", to = "Z2", sink = FALSE),
                    Z2 = list(type = "SFO", to = "Z3"),
                    Z3 = list(type = "SFORB"))
m.Z.mkin.1 <- mkinfit(Z.mkin.1, FOCUS_2006_Z_mkin, 
                      parms.ini = c(k_Z0_Z1 = 0.5, k_Z1_Z2 = 0.3),
                      quiet = TRUE)
plot(m.Z.mkin.1)
summary(m.Z.mkin.1, data = FALSE)
@

Therefore, a further stepwise model building is performed starting from the
stage of parent and one metabolite, starting from the assumption that the model
fit for the parent compound can be improved by using the SFORB model.

<<FOCUS_2006_Z_fits_8, echo=TRUE, fig.height=4>>=
Z.mkin.2 <- mkinmod(Z0 = list(type = "SFORB", to = "Z1", sink = FALSE),
                    Z1 = list(type = "SFO"))
m.Z.mkin.2 <- mkinfit(Z.mkin.2, FOCUS_2006_Z_mkin, quiet = TRUE)
plot(m.Z.mkin.2)
summary(m.Z.mkin.2, data = FALSE)
@

When metabolite Z2 is added, the additional sink for Z1 is turned off again,
for the same reasons as in the original analysis.

<<FOCUS_2006_Z_fits_9, echo=TRUE, fig.height=4>>=
Z.mkin.3 <- mkinmod(Z0 = list(type = "SFORB", to = "Z1", sink = FALSE),
                    Z1 = list(type = "SFO", to = "Z2", sink = FALSE),
                    Z2 = list(type = "SFO"))
m.Z.mkin.3 <- mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE)
plot(m.Z.mkin.3)
summary(m.Z.mkin.3, data = FALSE)
@

This results in a much better representation of the behaviour of the parent 
compound Z0.

Finally, Z3 is added as well. These models appear overparameterised (no
covariance matrix returned) if the sink for Z1 is left in the models.

<<FOCUS_2006_Z_fits_10, echo=TRUE, fig.height=4>>=
Z.mkin.4 <- mkinmod(Z0 = list(type = "SFORB", to = "Z1", sink = FALSE),
                    Z1 = list(type = "SFO", to = "Z2", sink = FALSE),
                    Z2 = list(type = "SFO", to = "Z3"),
                    Z3 = list(type = "SFO"))
m.Z.mkin.4 <- mkinfit(Z.mkin.4, FOCUS_2006_Z_mkin, 
                      parms.ini = c(k_Z1_Z2 = 0.05), 
                      quiet = TRUE)
plot(m.Z.mkin.4)
summary(m.Z.mkin.4, data = FALSE)
@

The error level of the fit, but especially of metabolite Z3, can be improved if
the SFORB model is chosen for this metabolite, as this model is capable of
representing the tailing of the metabolite decline phase.

<<FOCUS_2006_Z_fits_11, echo=TRUE, fig.height=4>>=
Z.mkin.5 <- mkinmod(Z0 = list(type = "SFORB", to = "Z1", sink = FALSE),
                    Z1 = list(type = "SFO", to = "Z2", sink = FALSE),
                    Z2 = list(type = "SFO", to = "Z3"),
                    Z3 = list(type = "SFORB"))
m.Z.mkin.5 <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin, 
                      parms.ini = m.Z.mkin.4$bparms.ode[1:5],
                      quiet = TRUE)
plot(m.Z.mkin.5)
summary(m.Z.mkin.5, data = FALSE)$bpar
@

The summary view of the backtransformed parameters shows that we get no
confidence intervals due to overparameterisation. As the optimized
\texttt{k\_Z3\_bound\_free} is excessively small, it is reasonable to fix it to
zero. 
<<FOCUS_2006_Z_fits_11a, echo=TRUE, fig.height=4>>=
m.Z.mkin.5a <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin, 
                       parms.ini = c(m.Z.mkin.4$bparms.ode[1:5],
                                    k_Z3_bound_free = 0),
                       fixed_parms = "k_Z3_bound_free",
                       quiet = TRUE)
summary(m.Z.mkin.5a, data = FALSE)$bpar
@

A graphical representation of the confidence intervals can finally be obtained.
<<FOCUS_2006_Z_fits_11b, echo=TRUE, fig.height=4>>=
mkinparplot(m.Z.mkin.5a)
@

It is clear that nothing can be said about the degradation rate of Z3 towards
the end of the experiment. However, this appears to be a feature of the data.

<<FOCUS_2006_Z_residuals_11>>=
par(mfrow = c(2, 2))
mkinresplot(m.Z.mkin.5, "Z0", lpos = "bottomright")
mkinresplot(m.Z.mkin.5, "Z1", lpos = "bottomright")
mkinresplot(m.Z.mkin.5, "Z2", lpos = "bottomright")
mkinresplot(m.Z.mkin.5, "Z3", lpos = "bottomright")
@

As expected, the residual plots are much more random than in the case of the 
all SFO model for which they were shown above. In conclusion, the model
\texttt{Z.mkin.5} is proposed as the best-fit model for the dataset from
Appendix 7 of the FOCUS report.

\bibliographystyle{plainnat}
\bibliography{references}

\end{document}
% vim: set foldmethod=syntax:

Contact - Imprint