aboutsummaryrefslogtreecommitdiff
path: root/inst/web/plot.mkinfit.html
blob: 6a37657fa108bc3efa53118a4efa5a8cd577bd94 (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
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
<title>plot.mkinfit. mkin 0.9.43.9000</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="
  Johannes Ranke
">

<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<link href="css/highlight.css" rel="stylesheet">
<link href="css/staticdocs.css" rel="stylesheet">

<!--[if lt IE 9]>
  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>
<script type="text/javascript"
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
  </head>

  <body>
    <div class="navbar">
  <div class="navbar-inner">
    <div class="container">
      <a class="brand" href="#">mkin 0.9.43.9000</a>
      <div class="nav">
        <ul class="nav">
          <li><a href="index.html"><i class="icon-home icon-white"></i> Index</a></li>
        </ul>
      </div>
    </div>
  </div>
</div>

    <div class="container">
      <header>
        
      </header>
      
      <h1>
  Plot the observed data and the fitted model of an mkinfit object
</h1>

<div class="row">
  <div class="span8">
    <h2>Usage</h2>
    <pre><div>"plot"(x, fit&nbsp;=&nbsp;x, obs_vars&nbsp;=&nbsp;names(fit$mkinmod$map), xlab&nbsp;=&nbsp;"Time", ylab&nbsp;=&nbsp;"Observed",  xlim&nbsp;=&nbsp;range(fit$data$time), ylim&nbsp;=&nbsp;"default", col_obs&nbsp;=&nbsp;1:length(obs_vars), pch_obs&nbsp;=&nbsp;col_obs,  lty_obs&nbsp;=&nbsp;rep(1, length(obs_vars)), add&nbsp;=&nbsp;FALSE, legend&nbsp;=&nbsp;!add, show_residuals&nbsp;=&nbsp;FALSE, maxabs&nbsp;=&nbsp;"auto", sep_obs&nbsp;=&nbsp;FALSE, rel.height.middle&nbsp;=&nbsp;0.9, lpos&nbsp;=&nbsp;"topright", inset&nbsp;=&nbsp;c(0.05, 0.05),  show_errmin&nbsp;=&nbsp;FALSE, errmin_digits&nbsp;=&nbsp;3, ...)
plot_sep(fit, sep_obs&nbsp;=&nbsp;TRUE,  show_residuals&nbsp;=&nbsp;TRUE, show_errmin&nbsp;=&nbsp;TRUE, ...)</div></pre>
    
    <h2>Arguments</h2>
    <dl>
      <dt>x</dt>
      <dd>
    Alias for fit introduced for compatibility with the generic S3 method.  
  </dd>
      <dt>fit</dt>
      <dd>
    An object of class <code><a href='mkinfit.html'>mkinfit</a></code>.
  </dd>
      <dt>obs_vars</dt>
      <dd>
    A character vector of names of the observed variables for which the 
    data and the model should be plotted. Defauls to all observed variables
    in the model.
  </dd>
      <dt>xlab</dt>
      <dd>
    Label for the x axis.
  </dd>
      <dt>ylab</dt>
      <dd>
    Label for the y axis.
  </dd>
      <dt>xlim</dt>
      <dd>
    Plot range in x direction.
  </dd>
      <dt>ylim</dt>
      <dd>
    Plot range in y direction.
  </dd>
      <dt>col_obs</dt>
      <dd>
    Colors used for plotting the observed data and the corresponding model prediction lines.
  </dd>
      <dt>pch_obs</dt>
      <dd>
    Symbols to be used for plotting the data.
  </dd>
      <dt>lty_obs</dt>
      <dd>
    Line types to be used for the model predictions.
  </dd>
      <dt>add</dt>
      <dd>
    Should the plot be added to an existing plot?
  </dd>
      <dt>legend</dt>
      <dd>
    Should a legend be added to the plot?
  </dd>
      <dt>show_residuals</dt>
      <dd>
    Should residuals be shown? If only one plot of the fits is shown, the
    residual plot is in the lower third of the plot? Otherwise, i.e. if
    "sep_obs" is given, the residual plots will be located to the right of 
    the plots of the fitted curves.
  </dd>
      <dt>maxabs</dt>
      <dd>
    Maximum absolute value of the residuals. This is used for the scaling of
    the y axis and defaults to "auto".
  </dd>
      <dt>sep_obs</dt>
      <dd>
    Should the observed variables be shown in separate subplots? If yes, residual plots
    requested by "show_residuals" will be shown next to, not below the plot of the fits.
  </dd>
      <dt>rel.height.middle</dt>
      <dd>
    The relative height of the middle plot, if more than two rows of plots are shown.
  </dd>
      <dt>lpos</dt>
      <dd>
    Position(s) of the legend(s). Passed to <code><a href='http://www.inside-r.org/r-doc/graphics/legend'>legend</a></code> as the first argument.
    If not length one, this should be of the same length as the obs_var argument.
  </dd>
      <dt>inset</dt>
      <dd>
    Passed to <code><a href='http://www.inside-r.org/r-doc/graphics/legend'>legend</a></code> if applicable.
  </dd>
      <dt>show_errmin</dt>
      <dd>
    Should the FOCUS chi2 error value be shown in the upper margin of the plot?
  </dd>
      <dt>errmin_digits</dt>
      <dd>
    The number of significant digits for rounding the FOCUS chi2 error percentage.
  </dd>
      <dt>...</dt>
      <dd>
    Further arguments passed to <code><a href='http://www.inside-r.org/r-doc/graphics/plot'>plot</a></code>.
  </dd>
    </dl>
    
    <div class="Description">
      <h2>Description</h2>

      <p>Solves the differential equations with the optimised and fixed parameters
  from a previous successful call to <code><a href='mkinfit.html'>mkinfit</a></code> and plots 
  the observed data together with the solution of the fitted model.</p>
  
    </div>

    <div class="Value">
      <h2>Value</h2>

      <p><dl>
  The function is called for its side effect.
</dl></p>
  
    </div>
    
    <h2 id="examples">Examples</h2>
    <pre class="examples"><div class='input'># One parent compound, one metabolite, both single first order, path from
# parent to sink included, use Levenberg-Marquardt for speed
SFO_SFO &lt;- mkinmod(parent = mkinsub(&quot;SFO&quot;, &quot;m1&quot;, full = &quot;Parent&quot;),
                   m1 = mkinsub(&quot;SFO&quot;, full = &quot;Metabolite M1&quot; ))
</div>
<strong class='message'>Successfully compiled differential equation model from auto-generated C code.</strong>
<div class='input'>fit &lt;- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE, method.modFit = &quot;Marq&quot;)
plot(fit)
</div>
<p><img src='plot.mkinfit-4.png' alt='' width='540' height='400' /></p>
<div class='input'>plot(fit, show_residuals = TRUE)
</div>
<p><img src='plot.mkinfit-6.png' alt='' width='540' height='400' /></p>
<div class='input'>
# Show the observed variables separately
plot(fit, sep_obs = TRUE, lpos = c(&quot;topright&quot;, &quot;bottomright&quot;))
</div>
<p><img src='plot.mkinfit-8.png' alt='' width='540' height='400' /></p>
<div class='input'>
# Show the observed variables separately, with residuals
plot(fit, sep_obs = TRUE, show_residuals = TRUE, lpos = c(&quot;topright&quot;, &quot;bottomright&quot;),
     show_errmin = TRUE)
</div>
<p><img src='plot.mkinfit-10.png' alt='' width='540' height='400' /></p>
<div class='input'>
# The same can be obtained with less typing, using the convenience function plot_sep
plot_sep(fit, lpos = c(&quot;topright&quot;, &quot;bottomright&quot;))
</div></pre>
  </div>
  <div class="span4">
    <!-- <ul>
      <li>plot.mkinfit</li><li>plot_sep</li>
    </ul>
    <ul>
      
    </ul> -->
      
    
    <h2>Author</h2>
    
  Johannes Ranke

    
  </div>
</div>
      
      <footer>
      <p class="pull-right"><a href="#">Back to top</a></p>
<p>Built by <a href="https://github.com/hadley/staticdocs">staticdocs</a>. Styled with <a href="http://twitter.github.com/bootstrap">bootstrap</a>.</p>
      </footer>
    </div>
  </body>
</html>

Contact - Imprint