aboutsummaryrefslogblamecommitdiff
path: root/docs/inverse.predict.html
blob: 4d6654927717febcc96910c31b3e98fc16bcedc4 (plain) (tree)











































































































































































































                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
<title>inverse.predict. chemCal 0.1-37</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="">

<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<link href="css/highlight.css" rel="stylesheet">
<link href="css/staticdocs.css" rel="stylesheet">

<!--[if lt IE 9]>
  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>
<script type="text/javascript"
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
  </head>

  <body>
    <div class="navbar">
  <div class="navbar-inner">
    <div class="container">
      <a class="brand" href="index.html">chemCal 0.1-37</a>
      <div class="nav">
        <ul class="nav">
          <li><a href="index.html">Home</a></li>
          <li><a href="reference.html">Reference</a></li>
        </ul>
      </div>
    </div>
  </div>
</div>


    <div class="container">
      <header>
        
      </header>
      
      <h1>Predict x from y for a linear calibration</h1>

<div class="row">
  <div class="span8">
    <h2>Usage</h2>
    <pre><span class="functioncall"><a href='inverse.predict.html'>inverse.predict</a></span><span class="keyword">(</span><span class="symbol">object</span><span class="keyword">,</span> <span class="symbol">newdata</span><span class="keyword">,</span> <span class="symbol">...</span><span class="keyword">,</span>
  <span class="symbol">ws</span><span class="keyword">,</span> <span class="argument">alpha</span><span class="argument">=</span><span class="number">0.05</span><span class="keyword">,</span> <span class="argument">var.s</span>&nbsp;<span class="argument">=</span>&nbsp;<span class="string">"auto"</span><span class="keyword">)</span></pre>
    
    <h2>Arguments</h2>
    <dl>
      <dt>object</dt>
      <dd>
    A univariate model object of class <code><a href='http://www.rdocumentation.org/packages/stats/topics/lm'>lm</a></code> or 
    <code><a href='http://www.rdocumentation.org/packages/MASS/topics/rlm'>rlm</a></code> 
    with model formula <code>y ~ x</code> or <code>y ~ x - 1</code>.
  </dd>
      <dt>newdata</dt>
      <dd> 
    A vector of observed y values for one sample.
  </dd>
      <dt>...</dt>
      <dd>
    Placeholder for further arguments that might be needed by 
    future implementations.
  </dd>
      <dt>ws</dt>
      <dd> 
    The weight attributed to the sample. This argument is obligatory
    if <code>object</code> has weights.
  </dd>
      <dt>alpha</dt>
      <dd>
    The error tolerance level for the confidence interval to be reported.
  </dd>
      <dt>var.s</dt>
      <dd>
    The estimated variance of the sample measurements. The default is to take
    the residual standard error from the calibration and to adjust it
    using <code>ws</code>, if applicable. This means that <code>var.s</code>
    overrides <code>ws</code>.
  </dd>
    </dl>
    
    <div class="Value">
      <h2>Value</h2>

      <p><dl>
  A list containing the predicted x value, its standard error and a
  confidence interval.
</dl></p>

    </div>

    <div class="Description">
      <h2>Description</h2>

      <p>This function predicts x values using a univariate linear model that has been
  generated for the purpose of calibrating a measurement method. Prediction
  intervals are given at the specified confidence level.
  The calculation method was taken from Massart et al. (1997). In particular,
  Equations 8.26 and 8.28 were combined in order to yield a general treatment
  of inverse prediction for univariate linear models, taking into account 
  weights that have been used to create the linear model, and at the same
  time providing the possibility to specify a precision in sample measurements
  differing from the precision in standard samples used for the calibration.
  This is elaborated in the package vignette.</p>

    </div>

    <div class="Note">
      <h2>Note</h2>

      <p>The function was validated with examples 7 and 8 from Massart et al. (1997).</p>

    </div>

    <div class="References">
      <h2>References</h2>

      <p>Massart, L.M, Vandenginste, B.G.M., Buydens, L.M.C., De Jong, S., Lewi, P.J.,
  Smeyers-Verbeke, J. (1997) Handbook of Chemometrics and Qualimetrics: Part A,
  p. 200</p>

    </div>
    
    <h2 id="examples">Examples</h2>
    <pre class="examples"><div class='input'><span class="comment"># This is example 7 from Chapter 8 in Massart et al. (1997)</span>
<span class="functioncall"><a href='http://www.rdocumentation.org/packages/utils/topics/data'>data</a></span><span class="keyword">(</span><span class="symbol">massart97ex1</span><span class="keyword">)</span>
<span class="symbol">m</span> <span class="assignement">&lt;-</span> <span class="functioncall"><a href='http://www.rdocumentation.org/packages/stats/topics/lm'>lm</a></span><span class="keyword">(</span><span class="symbol">y</span> <span class="keyword">~</span> <span class="symbol">x</span><span class="keyword">,</span> <span class="argument">data</span> <span class="argument">=</span> <span class="symbol">massart97ex1</span><span class="keyword">)</span>
<span class="functioncall"><a href='inverse.predict.html'>inverse.predict</a></span><span class="keyword">(</span><span class="symbol">m</span><span class="keyword">,</span> <span class="number">15</span><span class="keyword">)</span>        <span class="comment">#  6.1 +- 4.9</span></div>
<div class='output'>$Prediction
[1] 6.09381

$`Standard Error`
[1] 1.767278

$Confidence
[1] 4.906751

$`Confidence Limits`
[1]  1.187059 11.000561

</div>
<div class='input'><span class="functioncall"><a href='inverse.predict.html'>inverse.predict</a></span><span class="keyword">(</span><span class="symbol">m</span><span class="keyword">,</span> <span class="number">90</span><span class="keyword">)</span>        <span class="comment"># 43.9 +- 4.9</span></div>
<div class='output'>$Prediction
[1] 43.93983

$`Standard Error`
[1] 1.767747

$Confidence
[1] 4.908053

$`Confidence Limits`
[1] 39.03178 48.84788

</div>
<div class='input'><span class="functioncall"><a href='inverse.predict.html'>inverse.predict</a></span><span class="keyword">(</span><span class="symbol">m</span><span class="keyword">,</span> <span class="functioncall"><a href='http://www.rdocumentation.org/packages/base/topics/rep'>rep</a></span><span class="keyword">(</span><span class="number">90</span><span class="keyword">,</span><span class="number">5</span><span class="keyword">)</span><span class="keyword">)</span> <span class="comment"># 43.9 +- 3.2</span></div>
<div class='output'>$Prediction
[1] 43.93983

$`Standard Error`
[1] 1.141204

$Confidence
[1] 3.168489

$`Confidence Limits`
[1] 40.77134 47.10832

</div></pre>
  </div>
  <div class="span4 sidebar">
    <!-- <ul>
      <li>inverse.predict</li><li>inverse.predict.lm</li><li>inverse.predict.rlm</li><li>inverse.predict.default</li>
    </ul>
    <ul>
      <li>manip</li>
    </ul> -->




  </div>
</div>
      
      <footer>
      <p class="pull-right"><a href="#">Back to top</a></p>
<p>Built by <a href="https://github.com/hadley/staticdocs">staticdocs</a>. Styled with <a href="https://getbootstrap.com/2.0.4/">bootstrap</a>.</p>
      </footer>
    </div>
  </body>
</html>

Contact - Imprint