aboutsummaryrefslogtreecommitdiff
path: root/docs/reference/add_err.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/reference/add_err.html')
-rw-r--r--docs/reference/add_err.html196
1 files changed, 196 insertions, 0 deletions
diff --git a/docs/reference/add_err.html b/docs/reference/add_err.html
new file mode 100644
index 00000000..cbc925ca
--- /dev/null
+++ b/docs/reference/add_err.html
@@ -0,0 +1,196 @@
+<!-- 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>add_err. 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/bootswatch/3.3.7/cerulean/bootstrap.min.css" rel="stylesheet" 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="../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">
+ <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="../index.html">Home</a>
+</li>
+<li>
+ <a href="../reference/index.html">Reference</a>
+</li>
+ </ul>
+ <ul class="nav navbar-nav navbar-right">
+ <li>
+ <a href="https://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="page-header">
+ <h1>
+</h1>
+</div>
+
+<div class="row">
+ <div class="col-md-9">
+
+ <p>Normally distributed errors are added to data predicted for a specific
+ degradation model using <code>mkinpredict</code>. The variance of the error
+ may depend on the predicted value and is specified as a standard deviation.</p>
+
+
+ <pre><span class='fu'>add_err</span>(<span class='no'>prediction</span>, <span class='no'>sdfunc</span>,
+ <span class='kw'>n</span> <span class='kw'>=</span> <span class='fl'>1000</span>, <span class='kw'>LOD</span> <span class='kw'>=</span> <span class='fl'>0.1</span>, <span class='kw'>reps</span> <span class='kw'>=</span> <span class='fl'>2</span>,
+ <span class='kw'>digits</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>seed</span> <span class='kw'>=</span> <span class='fl'>NA</span>)</pre>
+
+ <h2>Arguments</h2>
+ <dl class="dl-horizontal">
+ <dt>prediction</dt>
+ <dd>
+ A prediction from a kinetic model as produced by <code>mkinpredict</code>.
+ </dd>
+ <dt>sdfunc</dt>
+ <dd>
+ A function taking the predicted value as its only argument and returning
+ a standard deviation that should be used for generating the random error
+ terms for this value.
+ </dd>
+ <dt>n</dt>
+ <dd>
+ The number of datasets to be generated.
+ </dd>
+ <dt>LOD</dt>
+ <dd>
+ The limit of detection (LOD). Values that are below the LOD after adding
+ the random error will be set to NA.
+ </dd>
+ <dt>reps</dt>
+ <dd>
+ The number of replicates to be generated within the datasets.
+ </dd>
+ <dt>digits</dt>
+ <dd>
+ The number of digits to which the values will be rounded.
+ </dd>
+ <dt>seed</dt>
+ <dd>
+ The seed used for the generation of random numbers. If NA, the seed
+ is not set.
+ </dd>
+ </dl>
+
+ <div class="Value">
+ <h2>Value</h2>
+
+ <p>A list of datasets compatible with <code>mmkin</code>, i.e.
+ the components of the list are datasets compatible with
+ <code>mkinfit</code>.</p>
+ </div>
+
+ <div class="References">
+ <h2>References</h2>
+
+ <p>Ranke J and Lehmann R (2015) To t-test or not to t-test, that is the question. XV Symposium on Pesticide Chemistry 2-4 September 2015, Piacenza, Italy
+ http://chem.uft.uni-bremen.de/ranke/posters/piacenza_2015.pdf</p>
+ </div>
+
+ <h2 id="examples">Examples</h2>
+ <pre class="examples"><div class='input'><span class='co'># The kinetic model</span>
+<span class='no'>m_SFO_SFO</span> <span class='kw'>&lt;-</span> <span class='fu'>mkinmod</span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'>mkinsub</span>(<span class='st'>"SFO"</span>, <span class='st'>"M1"</span>),
+ <span class='kw'>M1</span> <span class='kw'>=</span> <span class='fu'>mkinsub</span>(<span class='st'>"SFO"</span>), <span class='kw'>use_of_ff</span> <span class='kw'>=</span> <span class='st'>"max"</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='co'># Generate a prediction for a specific set of parameters</span>
+<span class='no'>sampling_times</span> <span class='kw'>=</span> <span class='fu'>c</span>(<span class='fl'>0</span>, <span class='fl'>1</span>, <span class='fl'>3</span>, <span class='fl'>7</span>, <span class='fl'>14</span>, <span class='fl'>28</span>, <span class='fl'>60</span>, <span class='fl'>90</span>, <span class='fl'>120</span>)
+
+<span class='co'># This is the prediction used for the "Type 2 datasets" on the Piacenza poster</span>
+<span class='co'># from 2015</span>
+<span class='no'>d_SFO_SFO</span> <span class='kw'>&lt;-</span> <span class='fu'>mkinpredict</span>(<span class='no'>m_SFO_SFO</span>,
+ <span class='fu'>c</span>(<span class='kw'>k_parent</span> <span class='kw'>=</span> <span class='fl'>0.1</span>, <span class='kw'>f_parent_to_M1</span> <span class='kw'>=</span> <span class='fl'>0.5</span>,
+ <span class='kw'>k_M1</span> <span class='kw'>=</span> <span class='fu'>log</span>(<span class='fl'>2</span>)/<span class='fl'>1000</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='no'>sampling_times</span>)
+
+<span class='co'># Add an error term with a constant (independent of the value) standard deviation</span>
+<span class='co'># of 10, and generate three datasets</span>
+<span class='no'>d_SFO_SFO_err</span> <span class='kw'>&lt;-</span> <span class='fu'>add_err</span>(<span class='no'>d_SFO_SFO</span>, <span class='kw'>function</span>(<span class='no'>x</span>) <span class='fl'>10</span>, <span class='kw'>n</span> <span class='kw'>=</span> <span class='fl'>3</span>, <span class='kw'>seed</span> <span class='kw'>=</span> <span class='fl'>123456789</span> )
+
+<span class='co'># Name the datasets for nicer plotting</span>
+<span class='fu'>names</span>(<span class='no'>d_SFO_SFO_err</span>) <span class='kw'>&lt;-</span> <span class='fu'>paste</span>(<span class='st'>"Dataset"</span>, <span class='fl'>1</span>:<span class='fl'>3</span>)
+
+<span class='co'># Name the model in the list of models (with only one member in this case)</span>
+<span class='co'># for nicer plotting later on.</span>
+<span class='co'># Be quiet and use the faster Levenberg-Marquardt algorithm, as the datasets</span>
+<span class='co'># are easy and examples are run often. Use only one core not to offend CRAN</span>
+<span class='co'># checks</span>
+<span class='no'>f_SFO_SFO</span> <span class='kw'>&lt;-</span> <span class='fu'>mmkin</span>(<span class='fu'>list</span>(<span class='st'>"SFO-SFO"</span> <span class='kw'>=</span> <span class='no'>m_SFO_SFO</span>),
+ <span class='no'>d_SFO_SFO_err</span>, <span class='kw'>cores</span> <span class='kw'>=</span> <span class='fl'>1</span>,
+ <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>method.modFit</span> <span class='kw'>=</span> <span class='st'>"Marq"</span>)
+
+<span class='fu'>plot</span>(<span class='no'>f_SFO_SFO</span>)</div><img src='unknown-4.png' alt='' width='540' height='400' /><div class='input'>
+<span class='co'># We would like to inspect the fit for dataset 3 more closely</span>
+<span class='co'># Using double brackets makes the returned object an mkinfit object</span>
+<span class='co'># instead of a list of mkinfit objects, so plot.mkinfit is used</span>
+<span class='fu'>plot</span>(<span class='no'>f_SFO_SFO</span><span class='kw'>[[</span><span class='fl'>3</span>]], <span class='kw'>show_residuals</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><img src='unknown-6.png' alt='' width='540' height='400' /><div class='input'>
+<span class='co'># If we use single brackets, we should give two indices (model and dataset),</span>
+<span class='co'># and plot.mmkin is used</span>
+<span class='fu'>plot</span>(<span class='no'>f_SFO_SFO</span>[<span class='fl'>1</span>, <span class='fl'>3</span>])</div><img src='unknown-8.png' alt='' width='540' height='400' /><div class='input'>
+</div></pre>
+ </div>
+ <div class="col-md-3">
+ <h2>Author</h2>
+
+ Johannes Ranke
+
+ </div>
+</div>
+
+ <footer>
+ <p>Built by <a href="http://hadley.github.io/pkgdown/">pkgdown</a>. Styled with <a href="http://getbootstrap.com">Bootstrap 3</a>.</p>
+ </footer>
+ </div>
+
+ </body>
+</html>

Contact - Imprint