aboutsummaryrefslogtreecommitdiff
path: root/docs/reference/mkinpredict.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/reference/mkinpredict.html')
-rw-r--r--docs/reference/mkinpredict.html336
1 files changed, 336 insertions, 0 deletions
diff --git a/docs/reference/mkinpredict.html b/docs/reference/mkinpredict.html
new file mode 100644
index 00000000..31556527
--- /dev/null
+++ b/docs/reference/mkinpredict.html
@@ -0,0 +1,336 @@
+<!-- Generated by pkgdown: do not edit by hand -->
+<!DOCTYPE html>
+<html>
+ <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>
+ — mkinpredict • 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-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">
+ <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">
+
+ </ul>
+ </div><!--/.nav-collapse -->
+ </div><!--/.container -->
+</div><!--/.navbar -->
+
+
+ </header>
+
+ <div class="row">
+ <div class="col-md-9 contents">
+ <div class="page-header">
+ <h1>
+</h1>
+ </div>
+
+
+ <p>This function produces a time series for all the observed variables in a
+ kinetic model as specified by <code><a href='mkinmod.html'>mkinmod</a></code>, using a specific set of
+ kinetic parameters and initial values for the state variables.</p>
+
+
+ <pre><span class='fu'>mkinpredict</span>(<span class='no'>mkinmod</span>, <span class='no'>odeparms</span>, <span class='no'>odeini</span>, <span class='no'>outtimes</span>, <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"deSolve"</span>,
+ <span class='kw'>use_compiled</span> <span class='kw'>=</span> <span class='st'>"auto"</span>, <span class='kw'>method.ode</span> <span class='kw'>=</span> <span class='st'>"lsoda"</span>, <span class='kw'>atol</span> <span class='kw'>=</span> <span class='fl'>1e-08</span>, <span class='kw'>rtol</span> <span class='kw'>=</span> <span class='fl'>1e-10</span>,
+ <span class='kw'>map_output</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='no'>...</span>)</pre>
+
+ <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a> Arguments</h2>
+ <dl class="dl-horizontal">
+ <dt>mkinmod</dt>
+ <dd>
+ A kinetic model as produced by <code><a href='mkinmod.html'>mkinmod</a></code>.
+ </dd>
+ <dt>odeparms</dt>
+ <dd>
+ A numeric vector specifying the parameters used in the kinetic model, which
+ is generally defined as a set of ordinary differential equations.
+ </dd>
+ <dt>odeini</dt>
+ <dd>
+ A numeric vectory containing the initial values of the state variables of
+ the model. Note that the state variables can differ from the observed
+ variables, for example in the case of the SFORB model.
+ </dd>
+ <dt>outtimes</dt>
+ <dd>
+ A numeric vector specifying the time points for which model predictions
+ should be generated.
+ </dd>
+ <dt>solution_type</dt>
+ <dd>
+ The method that should be used for producing the predictions. This should
+ generally be &quot;analytical&quot; if there is only one observed variable, and
+ usually &quot;deSolve&quot; in the case of several observed variables. The third
+ possibility &quot;eigen&quot; is faster but not applicable to some models e.g.
+ using FOMC for the parent compound.
+ </dd>
+ <dt>method.ode</dt>
+ <dd>
+ The solution method passed via <code>mkinpredict</code> to
+ <code>ode</code> in case the solution type is &quot;deSolve&quot;. The default
+ &quot;lsoda&quot; is performant, but sometimes fails to converge.
+ </dd>
+ <dt>use_compiled</dt>
+ <dd>
+ If set to <code>FALSE</code>, no compiled version of the <code><a href='mkinmod.html'>mkinmod</a></code>
+ model is used, even if is present.
+ </dd>
+ <dt>atol</dt>
+ <dd>
+ Absolute error tolerance, passed to <code>ode</code>. Default is 1e-8,
+ lower than in <code>lsoda</code>.
+ </dd>
+ <dt>rtol</dt>
+ <dd>
+ Absolute error tolerance, passed to <code>ode</code>. Default is 1e-10,
+ much lower than in <code>lsoda</code>.
+ </dd>
+ <dt>map_output</dt>
+ <dd>
+ Boolean to specify if the output should list values for the observed
+ variables (default) or for all state variables (if set to FALSE).
+ </dd>
+ <dt>&amp;#8230;</dt>
+ <dd>
+ Further arguments passed to the ode solver in case such a solver is used.
+ </dd>
+ </dl>
+
+ <h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
+
+ <p>A matrix in the same format as the output of <code>ode</code>.</p>
+
+
+ <h2 class="hasAnchor" id="examples">
+ <a class="anchor" href="#examples"></a>
+ Examples
+ </h2>
+ <pre class="examples"><div class='input'> <span class='no'>SFO</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span>(<span class='kw'>degradinol</span> <span class='kw'>=</span> <span class='fu'>list</span>(<span class='kw'>type</span> <span class='kw'>=</span> <span class='st'>"SFO"</span>))
+ <span class='co'># Compare solution types</span>
+ <span class='fu'>mkinpredict</span>(<span class='no'>SFO</span>, <span class='fu'>c</span>(<span class='kw'>k_degradinol_sink</span> <span class='kw'>=</span> <span class='fl'>0.3</span>), <span class='fu'>c</span>(<span class='kw'>degradinol</span> <span class='kw'>=</span> <span class='fl'>100</span>), <span class='fl'>0</span>:<span class='fl'>20</span>,
+ <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"analytical"</span>)</div><div class='output co'>#&gt; time degradinol
+#&gt; 1 0 100.0000000
+#&gt; 2 1 74.0818221
+#&gt; 3 2 54.8811636
+#&gt; 4 3 40.6569660
+#&gt; 5 4 30.1194212
+#&gt; 6 5 22.3130160
+#&gt; 7 6 16.5298888
+#&gt; 8 7 12.2456428
+#&gt; 9 8 9.0717953
+#&gt; 10 9 6.7205513
+#&gt; 11 10 4.9787068
+#&gt; 12 11 3.6883167
+#&gt; 13 12 2.7323722
+#&gt; 14 13 2.0241911
+#&gt; 15 14 1.4995577
+#&gt; 16 15 1.1108997
+#&gt; 17 16 0.8229747
+#&gt; 18 17 0.6096747
+#&gt; 19 18 0.4516581
+#&gt; 20 19 0.3345965
+#&gt; 21 20 0.2478752
+#&gt; </div><div class='input'> <span class='fu'>mkinpredict</span>(<span class='no'>SFO</span>, <span class='fu'>c</span>(<span class='kw'>k_degradinol_sink</span> <span class='kw'>=</span> <span class='fl'>0.3</span>), <span class='fu'>c</span>(<span class='kw'>degradinol</span> <span class='kw'>=</span> <span class='fl'>100</span>), <span class='fl'>0</span>:<span class='fl'>20</span>,
+ <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"deSolve"</span>)</div><div class='output co'>#&gt; time degradinol
+#&gt; 1 0 100.0000000
+#&gt; 2 1 74.0818221
+#&gt; 3 2 54.8811636
+#&gt; 4 3 40.6569660
+#&gt; 5 4 30.1194212
+#&gt; 6 5 22.3130160
+#&gt; 7 6 16.5298888
+#&gt; 8 7 12.2456428
+#&gt; 9 8 9.0717953
+#&gt; 10 9 6.7205513
+#&gt; 11 10 4.9787068
+#&gt; 12 11 3.6883167
+#&gt; 13 12 2.7323722
+#&gt; 14 13 2.0241911
+#&gt; 15 14 1.4995577
+#&gt; 16 15 1.1108996
+#&gt; 17 16 0.8229747
+#&gt; 18 17 0.6096747
+#&gt; 19 18 0.4516581
+#&gt; 20 19 0.3345965
+#&gt; 21 20 0.2478752
+#&gt; </div><div class='input'> <span class='fu'>mkinpredict</span>(<span class='no'>SFO</span>, <span class='fu'>c</span>(<span class='kw'>k_degradinol_sink</span> <span class='kw'>=</span> <span class='fl'>0.3</span>), <span class='fu'>c</span>(<span class='kw'>degradinol</span> <span class='kw'>=</span> <span class='fl'>100</span>), <span class='fl'>0</span>:<span class='fl'>20</span>,
+ <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"deSolve"</span>, <span class='kw'>use_compiled</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)</div><div class='output co'>#&gt; time degradinol
+#&gt; 1 0 100.0000000
+#&gt; 2 1 74.0818221
+#&gt; 3 2 54.8811636
+#&gt; 4 3 40.6569660
+#&gt; 5 4 30.1194212
+#&gt; 6 5 22.3130160
+#&gt; 7 6 16.5298888
+#&gt; 8 7 12.2456428
+#&gt; 9 8 9.0717953
+#&gt; 10 9 6.7205513
+#&gt; 11 10 4.9787068
+#&gt; 12 11 3.6883167
+#&gt; 13 12 2.7323722
+#&gt; 14 13 2.0241911
+#&gt; 15 14 1.4995577
+#&gt; 16 15 1.1108996
+#&gt; 17 16 0.8229747
+#&gt; 18 17 0.6096747
+#&gt; 19 18 0.4516581
+#&gt; 20 19 0.3345965
+#&gt; 21 20 0.2478752
+#&gt; </div><div class='input'> <span class='fu'>mkinpredict</span>(<span class='no'>SFO</span>, <span class='fu'>c</span>(<span class='kw'>k_degradinol_sink</span> <span class='kw'>=</span> <span class='fl'>0.3</span>), <span class='fu'>c</span>(<span class='kw'>degradinol</span> <span class='kw'>=</span> <span class='fl'>100</span>), <span class='fl'>0</span>:<span class='fl'>20</span>,
+ <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"eigen"</span>)</div><div class='output co'>#&gt; time degradinol
+#&gt; 1 0 100.0000000
+#&gt; 2 1 74.0818221
+#&gt; 3 2 54.8811636
+#&gt; 4 3 40.6569660
+#&gt; 5 4 30.1194212
+#&gt; 6 5 22.3130160
+#&gt; 7 6 16.5298888
+#&gt; 8 7 12.2456428
+#&gt; 9 8 9.0717953
+#&gt; 10 9 6.7205513
+#&gt; 11 10 4.9787068
+#&gt; 12 11 3.6883167
+#&gt; 13 12 2.7323722
+#&gt; 14 13 2.0241911
+#&gt; 15 14 1.4995577
+#&gt; 16 15 1.1108997
+#&gt; 17 16 0.8229747
+#&gt; 18 17 0.6096747
+#&gt; 19 18 0.4516581
+#&gt; 20 19 0.3345965
+#&gt; 21 20 0.2478752
+#&gt; </div><div class='input'>
+
+ <span class='co'># Compare integration methods to analytical solution</span>
+ <span class='fu'>mkinpredict</span>(<span class='no'>SFO</span>, <span class='fu'>c</span>(<span class='kw'>k_degradinol_sink</span> <span class='kw'>=</span> <span class='fl'>0.3</span>), <span class='fu'>c</span>(<span class='kw'>degradinol</span> <span class='kw'>=</span> <span class='fl'>100</span>), <span class='fl'>0</span>:<span class='fl'>20</span>,
+ <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"analytical"</span>)[<span class='fl'>21</span>,]</div><div class='output co'>#&gt; time degradinol
+#&gt; 21 20 0.2478752
+#&gt; </div><div class='input'> <span class='fu'>mkinpredict</span>(<span class='no'>SFO</span>, <span class='fu'>c</span>(<span class='kw'>k_degradinol_sink</span> <span class='kw'>=</span> <span class='fl'>0.3</span>), <span class='fu'>c</span>(<span class='kw'>degradinol</span> <span class='kw'>=</span> <span class='fl'>100</span>), <span class='fl'>0</span>:<span class='fl'>20</span>,
+ <span class='kw'>method</span> <span class='kw'>=</span> <span class='st'>"lsoda"</span>)[<span class='fl'>21</span>,]</div><div class='output co'>#&gt; time degradinol
+#&gt; 21 20 0.2478752
+#&gt; </div><div class='input'> <span class='fu'>mkinpredict</span>(<span class='no'>SFO</span>, <span class='fu'>c</span>(<span class='kw'>k_degradinol_sink</span> <span class='kw'>=</span> <span class='fl'>0.3</span>), <span class='fu'>c</span>(<span class='kw'>degradinol</span> <span class='kw'>=</span> <span class='fl'>100</span>), <span class='fl'>0</span>:<span class='fl'>20</span>,
+ <span class='kw'>method</span> <span class='kw'>=</span> <span class='st'>"ode45"</span>)[<span class='fl'>21</span>,]</div><div class='output co'>#&gt; time degradinol
+#&gt; 21 20 0.2478752
+#&gt; </div><div class='input'> <span class='fu'>mkinpredict</span>(<span class='no'>SFO</span>, <span class='fu'>c</span>(<span class='kw'>k_degradinol_sink</span> <span class='kw'>=</span> <span class='fl'>0.3</span>), <span class='fu'>c</span>(<span class='kw'>degradinol</span> <span class='kw'>=</span> <span class='fl'>100</span>), <span class='fl'>0</span>:<span class='fl'>20</span>,
+ <span class='kw'>method</span> <span class='kw'>=</span> <span class='st'>"rk4"</span>)[<span class='fl'>21</span>,]</div><div class='output co'>#&gt; time degradinol
+#&gt; 21 20 0.2480043
+#&gt; </div><div class='input'> <span class='co'># rk4 is not as precise here</span>
+
+ <span class='co'># The number of output times used to make a lot of difference until the</span>
+ <span class='co'># default for atol was adjusted</span>
+ <span class='fu'>mkinpredict</span>(<span class='no'>SFO</span>, <span class='fu'>c</span>(<span class='kw'>k_degradinol_sink</span> <span class='kw'>=</span> <span class='fl'>0.3</span>), <span class='fu'>c</span>(<span class='kw'>degradinol</span> <span class='kw'>=</span> <span class='fl'>100</span>),
+ <span class='fu'>seq</span>(<span class='fl'>0</span>, <span class='fl'>20</span>, <span class='kw'>by</span> <span class='kw'>=</span> <span class='fl'>0.1</span>))[<span class='fl'>201</span>,]</div><div class='output co'>#&gt; time degradinol
+#&gt; 201 20 0.2478752
+#&gt; </div><div class='input'> <span class='fu'>mkinpredict</span>(<span class='no'>SFO</span>, <span class='fu'>c</span>(<span class='kw'>k_degradinol_sink</span> <span class='kw'>=</span> <span class='fl'>0.3</span>), <span class='fu'>c</span>(<span class='kw'>degradinol</span> <span class='kw'>=</span> <span class='fl'>100</span>),
+ <span class='fu'>seq</span>(<span class='fl'>0</span>, <span class='fl'>20</span>, <span class='kw'>by</span> <span class='kw'>=</span> <span class='fl'>0.01</span>))[<span class='fl'>2001</span>,]</div><div class='output co'>#&gt; time degradinol
+#&gt; 2001 20 0.2478752
+#&gt; </div><div class='input'>
+ <span class='co'># Check compiled model versions - they are faster than the eigenvalue based solutions!</span>
+ <span class='no'>SFO_SFO</span> <span class='kw'>=</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'>list</span>(<span class='kw'>type</span> <span class='kw'>=</span> <span class='st'>"SFO"</span>, <span class='kw'>to</span> <span class='kw'>=</span> <span class='st'>"m1"</span>),
+ <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fu'>list</span>(<span class='kw'>type</span> <span class='kw'>=</span> <span class='st'>"SFO"</span>))</div><div class='output'><strong class='text-info'>Successfully compiled differential equation model from auto-generated C code.</strong></div><div class='input'> <span class='fu'>system.time</span>(
+ <span class='fu'>print</span>(<span class='fu'>mkinpredict</span>(<span class='no'>SFO_SFO</span>, <span class='fu'>c</span>(<span class='kw'>k_parent_m1</span> <span class='kw'>=</span> <span class='fl'>0.05</span>, <span class='kw'>k_parent_sink</span> <span class='kw'>=</span> <span class='fl'>0.1</span>, <span class='kw'>k_m1_sink</span> <span class='kw'>=</span> <span class='fl'>0.01</span>),
+ <span class='fu'>c</span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fl'>0</span>), <span class='fu'>seq</span>(<span class='fl'>0</span>, <span class='fl'>20</span>, <span class='kw'>by</span> <span class='kw'>=</span> <span class='fl'>0.1</span>),
+ <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"eigen"</span>)[<span class='fl'>201</span>,]))</div><div class='output co'>#&gt; time parent m1
+#&gt; 201 20 4.978707 27.46227
+#&gt; </div><div class='output co'>#&gt; user system elapsed
+#&gt; 0.028 0.004 0.004
+#&gt; </div><div class='input'> <span class='fu'>system.time</span>(
+ <span class='fu'>print</span>(<span class='fu'>mkinpredict</span>(<span class='no'>SFO_SFO</span>, <span class='fu'>c</span>(<span class='kw'>k_parent_m1</span> <span class='kw'>=</span> <span class='fl'>0.05</span>, <span class='kw'>k_parent_sink</span> <span class='kw'>=</span> <span class='fl'>0.1</span>, <span class='kw'>k_m1_sink</span> <span class='kw'>=</span> <span class='fl'>0.01</span>),
+ <span class='fu'>c</span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fl'>0</span>), <span class='fu'>seq</span>(<span class='fl'>0</span>, <span class='fl'>20</span>, <span class='kw'>by</span> <span class='kw'>=</span> <span class='fl'>0.1</span>),
+ <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"deSolve"</span>)[<span class='fl'>201</span>,]))</div><div class='output co'>#&gt; time parent m1
+#&gt; 201 20 4.978707 27.46227
+#&gt; </div><div class='output co'>#&gt; user system elapsed
+#&gt; 0.016 0.004 0.002
+#&gt; </div><div class='input'> <span class='fu'>system.time</span>(
+ <span class='fu'>print</span>(<span class='fu'>mkinpredict</span>(<span class='no'>SFO_SFO</span>, <span class='fu'>c</span>(<span class='kw'>k_parent_m1</span> <span class='kw'>=</span> <span class='fl'>0.05</span>, <span class='kw'>k_parent_sink</span> <span class='kw'>=</span> <span class='fl'>0.1</span>, <span class='kw'>k_m1_sink</span> <span class='kw'>=</span> <span class='fl'>0.01</span>),
+ <span class='fu'>c</span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>100</span>, <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fl'>0</span>), <span class='fu'>seq</span>(<span class='fl'>0</span>, <span class='fl'>20</span>, <span class='kw'>by</span> <span class='kw'>=</span> <span class='fl'>0.1</span>),
+ <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"deSolve"</span>, <span class='kw'>use_compiled</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)[<span class='fl'>201</span>,]))</div><div class='output co'>#&gt; time parent m1
+#&gt; 201 20 4.978707 27.46227
+#&gt; </div><div class='output co'>#&gt; user system elapsed
+#&gt; 0.052 0.000 0.052
+#&gt; </div></pre>
+ </div>
+ <div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
+ <h2>Contents</h2>
+ <ul class="nav nav-pills nav-stacked">
+ <li><a href="#arguments">Arguments</a></li>
+
+ <li><a href="#value">Value</a></li>
+
+ <li><a href="#examples">Examples</a></li>
+ </ul>
+
+ <h2>Author</h2>
+
+ Johannes Ranke
+
+ </div>
+</div>
+
+ <footer>
+ <div class="copyright">
+ <p>Developed by Johannes Ranke, Eurofins Regulatory AG.</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