diff options
Diffstat (limited to 'docs/dev/reference/add_err.html')
-rw-r--r-- | docs/dev/reference/add_err.html | 67 |
1 files changed, 37 insertions, 30 deletions
diff --git a/docs/dev/reference/add_err.html b/docs/dev/reference/add_err.html index 852ae0d9..e362ab7a 100644 --- a/docs/dev/reference/add_err.html +++ b/docs/dev/reference/add_err.html @@ -74,7 +74,7 @@ may depend on the predicted value and is specified as a standard deviation." /> </button> <span class="navbar-brand"> <a class="navbar-link" href="../index.html">mkin</a> - <span class="version label label-info" data-toggle="tooltip" data-placement="bottom" title="In-development version">0.9.50.3</span> + <span class="version label label-info" data-toggle="tooltip" data-placement="bottom" title="In-development version">0.9.50.4</span> </span> </div> @@ -122,7 +122,7 @@ may depend on the predicted value and is specified as a standard deviation." /> </ul> <ul class="nav navbar-nav navbar-right"> <li> - <a href="http://github.com/jranke/mkin/"> + <a href="https://github.com/jranke/mkin/"> <span class="fab fa fab fa-github fa-lg"></span> </a> @@ -141,7 +141,7 @@ may depend on the predicted value and is specified as a standard deviation." /> <div class="col-md-9 contents"> <div class="page-header"> <h1>Add normally distributed errors to simulated kinetic degradation data</h1> - <small class="dont-index">Source: <a href='http://github.com/jranke/mkin/blob/master/R/add_err.R'><code>R/add_err.R</code></a></small> + <small class="dont-index">Source: <a href='https://github.com/jranke/mkin/blob/master/R/add_err.R'><code>R/add_err.R</code></a></small> <div class="hidden name"><code>add_err.Rd</code></div> </div> @@ -151,16 +151,16 @@ degradation model using <code><a href='mkinpredict.html'>mkinpredict</a></code>. may depend on the predicted value and is specified as a standard deviation.</p> </div> - <pre class="usage"><span class='fu'>add_err</span>( - <span class='no'>prediction</span>, - <span class='no'>sdfunc</span>, - <span class='kw'>secondary</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"M1"</span>, <span class='st'>"M2"</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> + <pre class="usage"><span class='fu'>add_err</span><span class='op'>(</span> + <span class='va'>prediction</span>, + <span class='va'>sdfunc</span>, + secondary <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"M1"</span>, <span class='st'>"M2"</span><span class='op'>)</span>, + n <span class='op'>=</span> <span class='fl'>10</span>, + LOD <span class='op'>=</span> <span class='fl'>0.1</span>, + reps <span class='op'>=</span> <span class='fl'>2</span>, + digits <span class='op'>=</span> <span class='fl'>1</span>, + seed <span class='op'>=</span> <span class='cn'>NA</span> +<span class='op'>)</span></pre> <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2> <table class="ref-arguments"> @@ -215,46 +215,53 @@ components of the list are datasets compatible with <code><a href='mkinfit.html' the question. XV Symposium on Pesticide Chemistry 2-4 September 2015, Piacenza, Italy https://jrwb.de/posters/piacenza_2015.pdf</p> + <h2 class="hasAnchor" id="author"><a class="anchor" href="#author"></a>Author</h2> + + <p>Johannes Ranke</p> <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>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'><-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>, <span class='st'>"M1"</span>), - <span class='kw'>M1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></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 co'>#> <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'> +<span class='va'>m_SFO_SFO</span> <span class='op'><-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span><span class='op'>(</span>parent <span class='op'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span>, <span class='st'>"M1"</span><span class='op'>)</span>, + M1 <span class='op'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span><span class='op'>)</span>, use_of_ff <span class='op'>=</span> <span class='st'>"max"</span><span class='op'>)</span> +</div><div class='output co'>#> <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></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'><a href='https://rdrr.io/r/base/c.html'>c</a></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='va'>sampling_times</span> <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</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='op'>)</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'><-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span>(<span class='no'>m_SFO_SFO</span>, - <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></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'><a href='https://rdrr.io/r/base/Log.html'>log</a></span>(<span class='fl'>2</span>)/<span class='fl'>1000</span>), - <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></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='va'>d_SFO_SFO</span> <span class='op'><-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span><span class='op'>(</span><span class='va'>m_SFO_SFO</span>, + <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>k_parent <span class='op'>=</span> <span class='fl'>0.1</span>, f_parent_to_M1 <span class='op'>=</span> <span class='fl'>0.5</span>, + k_M1 <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/Log.html'>log</a></span><span class='op'>(</span><span class='fl'>2</span><span class='op'>)</span><span class='op'>/</span><span class='fl'>1000</span><span class='op'>)</span>, + <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>parent <span class='op'>=</span> <span class='fl'>100</span>, M1 <span class='op'>=</span> <span class='fl'>0</span><span class='op'>)</span>, + <span class='va'>sampling_times</span><span class='op'>)</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'><-</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='va'>d_SFO_SFO_err</span> <span class='op'><-</span> <span class='fu'>add_err</span><span class='op'>(</span><span class='va'>d_SFO_SFO</span>, <span class='kw'>function</span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span> <span class='fl'>10</span>, n <span class='op'>=</span> <span class='fl'>3</span>, seed <span class='op'>=</span> <span class='fl'>123456789</span> <span class='op'>)</span> <span class='co'># Name the datasets for nicer plotting</span> -<span class='fu'><a href='https://rdrr.io/r/base/names.html'>names</a></span>(<span class='no'>d_SFO_SFO_err</span>) <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span>(<span class='st'>"Dataset"</span>, <span class='fl'>1</span>:<span class='fl'>3</span>) +<span class='fu'><a href='https://rdrr.io/r/base/names.html'>names</a></span><span class='op'>(</span><span class='va'>d_SFO_SFO_err</span><span class='op'>)</span> <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Dataset"</span>, <span class='fl'>1</span><span class='op'>:</span><span class='fl'>3</span><span class='op'>)</span> <span class='co'># Name the model in the list of models (with only one member in this case) for</span> <span class='co'># nicer plotting later on. Be quiet and use only one core not to offend CRAN</span> <span class='co'># checks</span> <span class='co'># \dontrun{</span> -<span class='no'>f_SFO_SFO</span> <span class='kw'><-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span>(<span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></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='va'>f_SFO_SFO</span> <span class='op'><-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span><span class='st'>"SFO-SFO"</span> <span class='op'>=</span> <span class='va'>m_SFO_SFO</span><span class='op'>)</span>, + <span class='va'>d_SFO_SFO_err</span>, cores <span class='op'>=</span> <span class='fl'>1</span>, + quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span> -<span class='fu'><a href='https://rdrr.io/r/base/plot.html'>plot</a></span>(<span class='no'>f_SFO_SFO</span>)</div><div class='img'><img src='add_err-1.png' alt='' width='700' height='433' /></div><div class='input'> +<span class='fu'><a href='https://rdrr.io/r/graphics/plot.default.html'>plot</a></span><span class='op'>(</span><span class='va'>f_SFO_SFO</span><span class='op'>)</span> +</div><div class='img'><img src='add_err-1.png' alt='' width='700' height='433' /></div><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'><a href='https://rdrr.io/r/base/plot.html'>plot</a></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><div class='img'><img src='add_err-2.png' alt='' width='700' height='433' /></div><div class='input'> +<span class='fu'><a href='https://rdrr.io/r/graphics/plot.default.html'>plot</a></span><span class='op'>(</span><span class='va'>f_SFO_SFO</span><span class='op'>[[</span><span class='fl'>3</span><span class='op'>]</span><span class='op'>]</span>, show_residuals <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span> +</div><div class='img'><img src='add_err-2.png' alt='' width='700' height='433' /></div><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'><a href='https://rdrr.io/r/base/plot.html'>plot</a></span>(<span class='no'>f_SFO_SFO</span>[<span class='fl'>1</span>, <span class='fl'>3</span>])</div><div class='img'><img src='add_err-3.png' alt='' width='700' height='433' /></div><div class='input'># } +<span class='fu'><a href='https://rdrr.io/r/graphics/plot.default.html'>plot</a></span><span class='op'>(</span><span class='va'>f_SFO_SFO</span><span class='op'>[</span><span class='fl'>1</span>, <span class='fl'>3</span><span class='op'>]</span><span class='op'>)</span> +</div><div class='img'><img src='add_err-3.png' alt='' width='700' height='433' /></div><div class='input'><span class='co'># }</span> </div></pre> </div> @@ -272,7 +279,7 @@ https://jrwb.de/posters/piacenza_2015.pdf</p> </div> <div class="pkgdown"> - <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p> + <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.6.1.</p> </div> </footer> |