aboutsummaryrefslogtreecommitdiff
path: root/docs/articles/chemCal.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/articles/chemCal.html')
-rw-r--r--docs/articles/chemCal.html80
1 files changed, 43 insertions, 37 deletions
diff --git a/docs/articles/chemCal.html b/docs/articles/chemCal.html
index e301880..ce745fb 100644
--- a/docs/articles/chemCal.html
+++ b/docs/articles/chemCal.html
@@ -6,18 +6,19 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Introduction to chemCal • chemCal</title>
-<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous">
-<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous">
-<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- sticky kit --><script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
+<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous">
+<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css">
+<script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
+<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
+<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><meta property="og:title" content="Introduction to chemCal">
-<meta property="og:description" content="">
-<meta name="twitter:card" content="summary">
+<meta property="og:description" content="chemCal">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></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>
+<body data-spy="scroll" data-target="#toc">
<div class="container template-article">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
@@ -38,7 +39,7 @@
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
- <span class="fa fa-home fa-lg"></span>
+ <span class="fas fa fas fa-home fa-lg"></span>
</a>
</li>
@@ -52,7 +53,14 @@
<a href="../news/index.html">Changelog</a>
</li>
</ul>
-<ul class="nav navbar-nav navbar-right"></ul>
+<ul class="nav navbar-nav navbar-right">
+<li>
+ <a href="http://github.com/jranke/chemCal/">
+ <span class="fab fa fab fa-github fa-lg"></span>
+
+ </a>
+</li>
+ </ul>
</div>
<!--/.nav-collapse -->
</div>
@@ -61,15 +69,16 @@
<!--/.navbar -->
+
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header toc-ignore">
- <h1>Introduction to chemCal</h1>
+ <h1 data-toc-skip>Introduction to chemCal</h1>
<h4 class="author">Johannes Ranke</h4>
- <h4 class="date">2019-02-21</h4>
-
+ <h4 class="date">2020-05-20</h4>
+ <small class="dont-index">Source: <a href="http://github.com/jranke/chemCal/blob/master/vignettes/chemCal.Rmd"><code>vignettes/chemCal.Rmd</code></a></small>
<div class="hidden name"><code>chemCal.Rmd</code></div>
</div>
@@ -90,25 +99,25 @@
<a href="#usage" class="anchor"></a>Usage</h1>
<p>When calibrating an analytical method, the first task is to generate a suitable model. If we want to use the <code>chemCal</code> functions, we have to restrict ourselves to univariate, possibly weighted, linear regression so far.</p>
<p>Once such a model has been created, the calibration can be graphically shown by using the <code>calplot</code> function:</p>
-<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(chemCal)</a>
-<a class="sourceLine" id="cb1-2" data-line-number="2">m0 &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/stats/topics/lm">lm</a></span>(y <span class="op">~</span><span class="st"> </span>x, <span class="dt">data =</span> massart97ex3)</a>
-<a class="sourceLine" id="cb1-3" data-line-number="3"><span class="kw"><a href="../reference/calplot.lm.html">calplot</a></span>(m0)</a></code></pre></div>
+<div class="sourceCode" id="cb1"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">chemCal</span>)
+<span class="no">m0</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span>(<span class="no">y</span> ~ <span class="no">x</span>, <span class="kw">data</span> <span class="kw">=</span> <span class="no">massart97ex3</span>)
+<span class="fu"><a href="../reference/calplot.lm.html">calplot</a></span>(<span class="no">m0</span>)</pre></body></html></div>
<p><img src="chemCal_files/figure-html/unnamed-chunk-1-1.png" width="700"></p>
<p>As we can see, the scatter increases with increasing x. This is also illustrated by one of the diagnostic plots for linear models provided by R:</p>
-<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/plot">plot</a></span>(m0, <span class="dt">which=</span><span class="dv">3</span>)</a></code></pre></div>
+<div class="sourceCode" id="cb2"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/plot.html">plot</a></span>(<span class="no">m0</span>, <span class="kw">which</span><span class="kw">=</span><span class="fl">3</span>)</pre></body></html></div>
<p><img src="chemCal_files/figure-html/unnamed-chunk-2-1.png" width="700"></p>
<p>Therefore, in Example 8 in <span class="citation">Massart et al. (1997)</span>, weighted regression is proposed which can be reproduced by the following code. Note that we are building the model on the mean values for each standard in order to be able to reproduce the results given in the book with the current version of chemCal.</p>
-<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1">weights &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/with">with</a></span>(massart97ex3, {</a>
-<a class="sourceLine" id="cb3-2" data-line-number="2"> yx &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/split">split</a></span>(y, x)</a>
-<a class="sourceLine" id="cb3-3" data-line-number="3"> ybar &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/lapply">sapply</a></span>(yx, mean)</a>
-<a class="sourceLine" id="cb3-4" data-line-number="4"> s &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/lapply">sapply</a></span>(yx, sd), <span class="dt">digits =</span> <span class="dv">2</span>)</a>
-<a class="sourceLine" id="cb3-5" data-line-number="5"> w &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/Round">round</a></span>(<span class="dv">1</span> <span class="op">/</span><span class="st"> </span>(s<span class="op">^</span><span class="dv">2</span>), <span class="dt">digits =</span> <span class="dv">3</span>)</a>
-<a class="sourceLine" id="cb3-6" data-line-number="6">})</a>
-<a class="sourceLine" id="cb3-7" data-line-number="7">massart97ex3.means &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/stats/topics/aggregate">aggregate</a></span>(y <span class="op">~</span><span class="st"> </span>x, massart97ex3, mean)</a>
-<a class="sourceLine" id="cb3-8" data-line-number="8"></a>
-<a class="sourceLine" id="cb3-9" data-line-number="9">m &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/stats/topics/lm">lm</a></span>(y <span class="op">~</span><span class="st"> </span>x, <span class="dt">w =</span> weights, <span class="dt">data =</span> massart97ex3.means)</a></code></pre></div>
+<div class="sourceCode" id="cb3"><html><body><pre class="r"><span class="no">weights</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/with.html">with</a></span>(<span class="no">massart97ex3</span>, {
+ <span class="no">yx</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/split.html">split</a></span>(<span class="no">y</span>, <span class="no">x</span>)
+ <span class="no">ybar</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/lapply.html">sapply</a></span>(<span class="no">yx</span>, <span class="no">mean</span>)
+ <span class="no">s</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/Round.html">round</a></span>(<span class="fu"><a href="https://rdrr.io/r/base/lapply.html">sapply</a></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"><a href="https://rdrr.io/r/base/Round.html">round</a></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"><a href="https://rdrr.io/r/stats/aggregate.html">aggregate</a></span>(<span class="no">y</span> ~ <span class="no">x</span>, <span class="no">massart97ex3</span>, <span class="no">mean</span>)
+
+<span class="no">m</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/lm.html">lm</a></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>)</pre></body></html></div>
<p>If we now want to predict a new x value from measured y values, we use the <code>inverse.predict</code> function:</p>
-<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="kw"><a href="../reference/inverse.predict.html">inverse.predict</a></span>(m, <span class="dv">15</span>, <span class="dt">ws=</span><span class="fl">1.67</span>)</a></code></pre></div>
+<div class="sourceCode" id="cb4"><html><body><pre class="r"><span class="fu"><a href="../reference/inverse.predict.html">inverse.predict</a></span>(<span class="no">m</span>, <span class="fl">15</span>, <span class="kw">ws</span><span class="kw">=</span><span class="fl">1.67</span>)</pre></body></html></div>
<pre><code>## $Prediction
## [1] 5.865367
##
@@ -120,7 +129,7 @@
##
## $`Confidence Limits`
## [1] 3.387082 8.343652</code></pre>
-<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="kw"><a href="../reference/inverse.predict.html">inverse.predict</a></span>(m, <span class="dv">90</span>, <span class="dt">ws =</span> <span class="fl">0.145</span>)</a></code></pre></div>
+<div class="sourceCode" id="cb6"><html><body><pre class="r"><span class="fu"><a href="../reference/inverse.predict.html">inverse.predict</a></span>(<span class="no">m</span>, <span class="fl">90</span>, <span class="kw">ws</span> <span class="kw">=</span> <span class="fl">0.145</span>)</pre></body></html></div>
<pre><code>## $Prediction
## [1] 44.06025
##
@@ -178,32 +187,29 @@ s_{\hat{x_s}} = \frac{1}{b_1} \sqrt{\frac{{s_s}^2}{w_s m} +
</div>
</div>
- <div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
- <div id="tocnav">
- <h2 class="hasAnchor">
-<a href="#tocnav" class="anchor"></a>Contents</h2>
- <ul class="nav nav-pills nav-stacked">
-<li><a href="#basic-calibration-functions">Basic calibration functions</a></li>
- <li><a href="#usage">Usage</a></li>
- <li><a href="#background-for-inverse-predict">Background for <code>inverse.predict</code></a></li>
- </ul>
+ <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
+
+ <nav id="toc" data-toggle="toc"><h2 data-toc-skip>Contents</h2>
+ </nav>
</div>
- </div>
</div>
+
<footer><div class="copyright">
<p>Developed by Johannes Ranke.</p>
</div>
<div class="pkgdown">
- <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
+ <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
</div>
+
</footer>
</div>
+
</body>
</html>

Contact - Imprint