aboutsummaryrefslogtreecommitdiff
path: root/docs/reference/inverse.predict.html
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2018-07-17 17:29:14 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2018-07-17 17:38:29 +0200
commit280d36230052de4f94e384648c1283031fbc9840 (patch)
treedf0ba9e07386b593cc396b8b6976210d42ee1a46 /docs/reference/inverse.predict.html
parente636c17f0d354a8e74546fc1469431dbe502dc76 (diff)
Fix inverse predictions for replicate measurements
For details, see NEWS.md
Diffstat (limited to 'docs/reference/inverse.predict.html')
-rw-r--r--docs/reference/inverse.predict.html61
1 files changed, 55 insertions, 6 deletions
diff --git a/docs/reference/inverse.predict.html b/docs/reference/inverse.predict.html
index 672e322..b107154 100644
--- a/docs/reference/inverse.predict.html
+++ b/docs/reference/inverse.predict.html
@@ -70,17 +70,26 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">chemCal</a>
- <span class="label label-default" data-toggle="tooltip" data-placement="bottom" title="Released package">0.1.37.9001</span>
+ <span class="label label-default" data-toggle="tooltip" data-placement="bottom" title="Released package">0.2.1</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
- <a href="../reference/index.html">Functions and data</a>
+ <a href="../index.html">
+ <span class="fa fa-home fa-lg"></span>
+
+ </a>
</li>
<li>
- <a href="../articles/chemCal.pdf">Short manual (pdf)</a>
+ <a href="../articles/chemCal.html">Get started</a>
+</li>
+<li>
+ <a href="../reference/index.html">Reference</a>
+</li>
+<li>
+ <a href="../news/index.html">Changelog</a>
</li>
</ul>
@@ -164,7 +173,11 @@
<h2 class="hasAnchor" id="note"><a class="anchor" href="#note"></a>Note</h2>
- <p>The function was validated with examples 7 and 8 from Massart et al. (1997).</p>
+ <p>The function was validated with examples 7 and 8 from Massart et al. (1997).
+ Note that the behaviour of inverse.predict changed with chemCal version
+ 0.2.1. Confidence intervals for x values obtained from calibrations with
+ replicate measurements did not take the variation about the means into account.
+ Please refer to the vignette for details.</p>
<h2 class="hasAnchor" id="references"><a class="anchor" href="#references"></a>References</h2>
@@ -175,7 +188,6 @@
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='co'># This is example 7 from Chapter 8 in Massart et al. (1997)</span>
-<span class='fu'>data</span>(<span class='no'>massart97ex1</span>)
<span class='no'>m</span> <span class='kw'>&lt;-</span> <span class='fu'>lm</span>(<span class='no'>y</span> ~ <span class='no'>x</span>, <span class='kw'>data</span> <span class='kw'>=</span> <span class='no'>massart97ex1</span>)
<span class='fu'>inverse.predict</span>(<span class='no'>m</span>, <span class='fl'>15</span>) <span class='co'># 6.1 +- 4.9</span></div><div class='output co'>#&gt; $Prediction
#&gt; [1] 6.09381
@@ -210,7 +222,44 @@
#&gt;
#&gt; $`Confidence Limits`
#&gt; [1] 40.77134 47.10832
-#&gt; </div></pre>
+#&gt; </div><div class='input'>
+<span class='co'># For reproducing the results for replicate standard measurements in example 8,</span>
+<span class='co'># we need to do the calibration on the means when using chemCal &gt; 0.2</span>
+<span class='no'>weights</span> <span class='kw'>&lt;-</span> <span class='fu'>with</span>(<span class='no'>massart97ex3</span>, {
+ <span class='no'>yx</span> <span class='kw'>&lt;-</span> <span class='fu'>split</span>(<span class='no'>y</span>, <span class='no'>x</span>)
+ <span class='no'>ybar</span> <span class='kw'>&lt;-</span> <span class='fu'>sapply</span>(<span class='no'>yx</span>, <span class='no'>mean</span>)
+ <span class='no'>s</span> <span class='kw'>&lt;-</span> <span class='fu'>round</span>(<span class='fu'>sapply</span>(<span class='no'>yx</span>, <span class='no'>sd</span>), <span class='kw'>digits</span> <span class='kw'>=</span> <span class='fl'>2</span>)
+ <span class='no'>w</span> <span class='kw'>&lt;-</span> <span class='fu'>round</span>(<span class='fl'>1</span> / (<span class='no'>s</span>^<span class='fl'>2</span>), <span class='kw'>digits</span> <span class='kw'>=</span> <span class='fl'>3</span>)
+})
+
+<span class='no'>massart97ex3.means</span> <span class='kw'>&lt;-</span> <span class='fu'>aggregate</span>(<span class='no'>y</span> ~ <span class='no'>x</span>, <span class='no'>massart97ex3</span>, <span class='no'>mean</span>)
+
+<span class='no'>m3.means</span> <span class='kw'>&lt;-</span> <span class='fu'>lm</span>(<span class='no'>y</span> ~ <span class='no'>x</span>, <span class='kw'>w</span> <span class='kw'>=</span> <span class='no'>weights</span>, <span class='kw'>data</span> <span class='kw'>=</span> <span class='no'>massart97ex3.means</span>)
+
+<span class='fu'>inverse.predict</span>(<span class='no'>m3.means</span>, <span class='fl'>15</span>, <span class='kw'>ws</span> <span class='kw'>=</span> <span class='fl'>1.67</span>) <span class='co'># 5.9 +- 2.5</span></div><div class='output co'>#&gt; $Prediction
+#&gt; [1] 5.865367
+#&gt;
+#&gt; $`Standard Error`
+#&gt; [1] 0.8926109
+#&gt;
+#&gt; $Confidence
+#&gt; [1] 2.478285
+#&gt;
+#&gt; $`Confidence Limits`
+#&gt; [1] 3.387082 8.343652
+#&gt; </div><div class='input'><span class='fu'>inverse.predict</span>(<span class='no'>m3.means</span>, <span class='fl'>90</span>, <span class='kw'>ws</span> <span class='kw'>=</span> <span class='fl'>0.145</span>) <span class='co'># 44.1 +- 7.9</span></div><div class='output co'>#&gt; $Prediction
+#&gt; [1] 44.06025
+#&gt;
+#&gt; $`Standard Error`
+#&gt; [1] 2.829162
+#&gt;
+#&gt; $Confidence
+#&gt; [1] 7.855012
+#&gt;
+#&gt; $`Confidence Limits`
+#&gt; [1] 36.20523 51.91526
+#&gt; </div><div class='input'>
+</div></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>

Contact - Imprint