<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="pandoc" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
  <meta name="author" content="Brian Ripley, Nov. 2003; R Core Team" />
  <title>Model-Fitting Functions in R</title>
  <style>
    /* Default styles provided by pandoc.
    ** See https://pandoc.org/MANUAL.html#variables-for-html for config info.
    */
    html {
      color: #1a1a1a;
      background-color: #fdfdfd;
    }
    body {
      margin: 0 auto;
      max-width: 80ch;
      padding-left: 50px;
      padding-right: 50px;
      padding-top: 50px;
      padding-bottom: 50px;
      hyphens: auto;
      overflow-wrap: break-word;
      text-rendering: optimizeLegibility;
      font-kerning: normal;
    }
    @media (max-width: 600px) {
      body {
        font-size: 0.9em;
        padding: 12px;
      }
      h1 {
        font-size: 1.8em;
      }
    }
    @media print {
      html {
        background-color: white;
      }
      body {
        background-color: transparent;
        color: black;
        font-size: 12pt;
      }
      p, h2, h3 {
        orphans: 3;
        widows: 3;
      }
      h2, h3, h4 {
        page-break-after: avoid;
      }
    }
    p {
      margin: 1em 0;
    }
    a {
      color: #1a1a1a;
    }
    a:visited {
      color: #1a1a1a;
    }
    img {
      max-width: 100%;
    }
    svg {
      height: auto;
      max-width: 100%;
    }
    h1, h2, h3, h4, h5, h6 {
      margin-top: 1.4em;
    }
    h5, h6 {
      font-size: 1em;
      font-style: italic;
    }
    h6 {
      font-weight: normal;
    }
    ol, ul {
      padding-left: 1.7em;
      margin-top: 1em;
    }
    li > ol, li > ul {
      margin-top: 0;
    }
    blockquote {
      margin: 1em 0 1em 1.7em;
      padding-left: 1em;
      border-left: 2px solid #e6e6e6;
      color: #606060;
    }
    code {
      font-family: Menlo, Monaco, Consolas, 'Lucida Console', monospace;
      font-size: 85%;
      margin: 0;
      hyphens: manual;
    }
    pre {
      margin: 1em 0;
      overflow: auto;
    }
    pre code {
      padding: 0;
      overflow: visible;
      overflow-wrap: normal;
    }
    .sourceCode {
     background-color: transparent;
     overflow: visible;
    }
    hr {
      border: none;
      border-top: 1px solid #1a1a1a;
      height: 1px;
      margin: 1em 0;
    }
    table {
      margin: 1em 0;
      border-collapse: collapse;
      width: 100%;
      overflow-x: auto;
      display: block;
      font-variant-numeric: lining-nums tabular-nums;
    }
    table caption {
      margin-bottom: 0.75em;
    }
    tbody {
      margin-top: 0.5em;
      border-top: 1px solid #1a1a1a;
      border-bottom: 1px solid #1a1a1a;
    }
    th {
      border-top: 1px solid #1a1a1a;
      padding: 0.25em 0.5em 0.25em 0.5em;
    }
    td {
      padding: 0.125em 0.5em 0.25em 0.5em;
    }
    header {
      margin-bottom: 4em;
      text-align: center;
    }
    #TOC li {
      list-style: none;
    }
    #TOC ul {
      padding-left: 1.3em;
    }
    #TOC > ul {
      padding-left: 0;
    }
    #TOC a:not(:hover) {
      text-decoration: none;
    }
    code{white-space: pre-wrap;}
    span.smallcaps{font-variant: small-caps;}
    div.columns{display: flex; gap: min(4vw, 1.5em);}
    div.column{flex: auto; overflow-x: auto;}
    div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
    /* The extra [class] is a hack that increases specificity enough to
       override a similar rule in reveal.js */
    ul.task-list[class]{list-style: none;}
    ul.task-list li input[type="checkbox"] {
      font-size: inherit;
      width: 0.8em;
      margin: 0 0.8em 0.2em -1.6em;
      vertical-align: middle;
    }
    .display.math{display: block; text-align: center; margin: 0.5rem auto;}
    /* CSS for syntax highlighting */
    html { -webkit-text-size-adjust: 100%; }
    pre > code.sourceCode { white-space: pre; position: relative; }
    pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
    pre > code.sourceCode > span:empty { height: 1.2em; }
    .sourceCode { overflow: visible; }
    code.sourceCode > span { color: inherit; text-decoration: inherit; }
    div.sourceCode { margin: 1em 0; }
    pre.sourceCode { margin: 0; }
    @media screen {
    div.sourceCode { overflow: auto; }
    }
    @media print {
    pre > code.sourceCode { white-space: pre-wrap; }
    pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
    }
    pre.numberSource code
      { counter-reset: source-line 0; }
    pre.numberSource code > span
      { position: relative; left: -4em; counter-increment: source-line; }
    pre.numberSource code > span > a:first-child::before
      { content: counter(source-line);
        position: relative; left: -1em; text-align: right; vertical-align: baseline;
        border: none; display: inline-block;
        -webkit-touch-callout: none; -webkit-user-select: none;
        -khtml-user-select: none; -moz-user-select: none;
        -ms-user-select: none; user-select: none;
        padding: 0 4px; width: 4em;
        color: #aaaaaa;
      }
    pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
    div.sourceCode
      {   }
    @media screen {
    pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
    }
    code span.al { color: #ff0000; font-weight: bold; } /* Alert */
    code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
    code span.at { color: #7d9029; } /* Attribute */
    code span.bn { color: #40a070; } /* BaseN */
    code span.bu { color: #008000; } /* BuiltIn */
    code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
    code span.ch { color: #4070a0; } /* Char */
    code span.cn { color: #880000; } /* Constant */
    code span.co { color: #60a0b0; font-style: italic; } /* Comment */
    code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
    code span.do { color: #ba2121; font-style: italic; } /* Documentation */
    code span.dt { color: #902000; } /* DataType */
    code span.dv { color: #40a070; } /* DecVal */
    code span.er { color: #ff0000; font-weight: bold; } /* Error */
    code span.ex { } /* Extension */
    code span.fl { color: #40a070; } /* Float */
    code span.fu { color: #06287e; } /* Function */
    code span.im { color: #008000; font-weight: bold; } /* Import */
    code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
    code span.kw { color: #007020; font-weight: bold; } /* Keyword */
    code span.op { color: #666666; } /* Operator */
    code span.ot { color: #007020; } /* Other */
    code span.pp { color: #bc7a00; } /* Preprocessor */
    code span.sc { color: #4070a0; } /* SpecialChar */
    code span.ss { color: #bb6688; } /* SpecialString */
    code span.st { color: #4070a0; } /* String */
    code span.va { color: #19177c; } /* Variable */
    code span.vs { color: #4070a0; } /* VerbatimString */
    code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
  </style>
</head>
<body>
<header id="title-block-header">
<h1 class="title">Model-Fitting Functions in R</h1>
<p class="author">Brian Ripley, Nov. 2003; R Core Team</p>
</header>
<p>This page documents some of the features that are available to
model-fitting functions in R, and especially the safety features that
can (and should) be enabled.</p>
<p>By model-fitting functions we mean functions like lm() which take a
formula, create a model frame and perhaps a model matrix, and have
methods (or use the default methods) for many of the standard accessor
functions such as coef(), residuals() and predict().</p>
<p>A fairly complete list of such functions in the standard and
recommended packages is</p>
<ul>
<li>stats: aov (via lm), lm, glm, ppr</li>
</ul>
<!-- -->
<ul>
<li>MASS: glm.nb, glmmPQL, lda, lm.gls, lqs, polr, qda, rlm</li>
<li>mgcv: mgcv</li>
<li>nlme: gls, lme</li>
<li>nnet: multinom, nnet</li>
<li>survival: coxph, survreg</li>
</ul>
<p>and those not using a model matrix or not intended to handle
categorical predictors</p>
<ul>
<li>stats: factanal, loess, nls, prcomp, princomp</li>
</ul>
<!-- -->
<ul>
<li>MASS: loglm</li>
<li>nlme: gnls, nlme</li>
<li>rpart: rpart</li>
</ul>
<h2 id="standard-behaviour-for-a-fitting-function">Standard behaviour
for a fitting function</h2>
<p>The annotations in the following simplified version of
<code>lm</code> (its current source is in <a
href="https::/svn.r-project.org/R/trunk/src/library/stats/R/lm.R"
class="uri">https::/svn.r-project.org/R/trunk/src/library/stats/R/lm.R</a>)
indicate what is standard for a model-fitting function.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>lm <span class="ot">&lt;-</span> <span class="cf">function</span> (formula, data, subset, weights, na.action,</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a>                <span class="at">method =</span> <span class="st">&quot;qr&quot;</span>, <span class="at">model =</span> <span class="cn">TRUE</span>, <span class="at">contrasts =</span> <span class="cn">NULL</span>, offset, ...)</span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>{</span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a>    cl <span class="ot">&lt;-</span> <span class="fu">match.call</span>()</span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a>    <span class="do">## keep only the arguments which should go into the model frame</span></span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a>    mf <span class="ot">&lt;-</span> <span class="fu">match.call</span>(<span class="at">expand.dots =</span> <span class="cn">FALSE</span>)</span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a>    m <span class="ot">&lt;-</span> <span class="fu">match</span>(<span class="fu">c</span>(<span class="st">&quot;formula&quot;</span>, <span class="st">&quot;data&quot;</span>, <span class="st">&quot;subset&quot;</span>, <span class="st">&quot;weights&quot;</span>, <span class="st">&quot;na.action&quot;</span>, <span class="st">&quot;offset&quot;</span>),</span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a>               <span class="fu">names</span>(mf), <span class="dv">0</span>)</span>
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a>    mf <span class="ot">&lt;-</span> mf[<span class="fu">c</span>(<span class="dv">1</span>, m)]</span>
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a>    mf<span class="sc">$</span>drop.unused.levels <span class="ot">&lt;-</span> <span class="cn">TRUE</span></span>
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a>    mf[[<span class="dv">1</span>]] <span class="ot">&lt;-</span> <span class="fu">quote</span>(stats<span class="sc">::</span>model.frame) <span class="co"># need stats:: for non-standard evaluation</span></span>
<span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a>    mf <span class="ot">&lt;-</span> <span class="fu">eval.parent</span>(mf)</span>
<span id="cb1-14"><a href="#cb1-14" aria-hidden="true" tabindex="-1"></a>    <span class="cf">if</span> (method <span class="sc">==</span> <span class="st">&quot;model.frame&quot;</span>) <span class="fu">return</span>(mf)</span>
<span id="cb1-15"><a href="#cb1-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-16"><a href="#cb1-16" aria-hidden="true" tabindex="-1"></a>    <span class="do">## 1) allow model.frame to update the terms object before saving it.</span></span>
<span id="cb1-17"><a href="#cb1-17" aria-hidden="true" tabindex="-1"></a>    mt <span class="ot">&lt;-</span> <span class="fu">attr</span>(mf, <span class="st">&quot;terms&quot;</span>)</span>
<span id="cb1-18"><a href="#cb1-18" aria-hidden="true" tabindex="-1"></a>    y <span class="ot">&lt;-</span> <span class="fu">model.response</span>(mf, <span class="st">&quot;numeric&quot;</span>)</span>
<span id="cb1-19"><a href="#cb1-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-20"><a href="#cb1-20" aria-hidden="true" tabindex="-1"></a>    <span class="do">## 2) retrieve the weights and offset from the model frame so</span></span>
<span id="cb1-21"><a href="#cb1-21" aria-hidden="true" tabindex="-1"></a>    <span class="do">## they can be functions of columns in arg data.</span></span>
<span id="cb1-22"><a href="#cb1-22" aria-hidden="true" tabindex="-1"></a>    w <span class="ot">&lt;-</span> <span class="fu">model.weights</span>(mf)</span>
<span id="cb1-23"><a href="#cb1-23" aria-hidden="true" tabindex="-1"></a>    offset <span class="ot">&lt;-</span> <span class="fu">model.offset</span>(mf)</span>
<span id="cb1-24"><a href="#cb1-24" aria-hidden="true" tabindex="-1"></a>    x <span class="ot">&lt;-</span> <span class="fu">model.matrix</span>(mt, mf, contrasts)</span>
<span id="cb1-25"><a href="#cb1-25" aria-hidden="true" tabindex="-1"></a>    <span class="do">## if any subsetting is done, retrieve the &quot;contrasts&quot; attribute here.</span></span>
<span id="cb1-26"><a href="#cb1-26" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-27"><a href="#cb1-27" aria-hidden="true" tabindex="-1"></a>    z <span class="ot">&lt;-</span> <span class="fu">lm.fit</span>(x, y, <span class="at">offset =</span> offset, ...)</span>
<span id="cb1-28"><a href="#cb1-28" aria-hidden="true" tabindex="-1"></a>    <span class="fu">class</span>(z) <span class="ot">&lt;-</span> <span class="fu">c</span>(<span class="cf">if</span>(<span class="fu">is.matrix</span>(y)) <span class="st">&quot;mlm&quot;</span>, <span class="st">&quot;lm&quot;</span>)</span>
<span id="cb1-29"><a href="#cb1-29" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-30"><a href="#cb1-30" aria-hidden="true" tabindex="-1"></a>    <span class="do">## 3) return the na.action info</span></span>
<span id="cb1-31"><a href="#cb1-31" aria-hidden="true" tabindex="-1"></a>    z<span class="sc">$</span>na.action <span class="ot">&lt;-</span> <span class="fu">attr</span>(mf, <span class="st">&quot;na.action&quot;</span>)</span>
<span id="cb1-32"><a href="#cb1-32" aria-hidden="true" tabindex="-1"></a>    z<span class="sc">$</span>offset <span class="ot">&lt;-</span> offset</span>
<span id="cb1-33"><a href="#cb1-33" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-34"><a href="#cb1-34" aria-hidden="true" tabindex="-1"></a>    <span class="do">## 4) return the contrasts used in fitting: possibly as saved earlier.</span></span>
<span id="cb1-35"><a href="#cb1-35" aria-hidden="true" tabindex="-1"></a>    z<span class="sc">$</span>contrasts <span class="ot">&lt;-</span> <span class="fu">attr</span>(x, <span class="st">&quot;contrasts&quot;</span>)</span>
<span id="cb1-36"><a href="#cb1-36" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-37"><a href="#cb1-37" aria-hidden="true" tabindex="-1"></a>    <span class="do">## 5) return the levelsets for factors in the formula</span></span>
<span id="cb1-38"><a href="#cb1-38" aria-hidden="true" tabindex="-1"></a>    z<span class="sc">$</span>xlevels <span class="ot">&lt;-</span> <span class="fu">.getXlevels</span>(mt, mf)</span>
<span id="cb1-39"><a href="#cb1-39" aria-hidden="true" tabindex="-1"></a>    z<span class="sc">$</span>call <span class="ot">&lt;-</span> cl</span>
<span id="cb1-40"><a href="#cb1-40" aria-hidden="true" tabindex="-1"></a>    z<span class="sc">$</span>terms <span class="ot">&lt;-</span> mt</span>
<span id="cb1-41"><a href="#cb1-41" aria-hidden="true" tabindex="-1"></a>    <span class="cf">if</span> (model)  z<span class="sc">$</span>model <span class="ot">&lt;-</span> mf</span>
<span id="cb1-42"><a href="#cb1-42" aria-hidden="true" tabindex="-1"></a>    z</span>
<span id="cb1-43"><a href="#cb1-43" aria-hidden="true" tabindex="-1"></a>}</span></code></pre></div>
<p>Note that if this approach is taken, any defaults for arguments
handled by <code>model.frame</code> are never invoked (the defaults in
<code>model.frame.default</code> are used) so it is good practice not to
supply any. (This behaviour can be overruled, and is by e.g. rpart.)</p>
<p>If this is done, the following pieces of information are stored with
the model object:</p>
<ul>
<li><p>The model frame (unless argument <code>model=FALSE</code>). This
is useful to avoid scoping problems if the model frame is needed later
(most often by predict methods).</p></li>
<li><p>What contrasts and levels were used when coding factors to form
the model matrix, and these plus the model frame allow the re-creation
of the model matrix. (The real lm() allows the model matrix to be saved,
but that is provided for S compatibility, and is normally a waste of
space.)</p></li>
<li><p>The <code>na.action</code> results are recorded for use in
forming residuals and fitted values/prediction from the original data
set.</p></li>
<li><p>The terms component records</p>
<ul>
<li><code>environment(formula)</code> as its environment,</li>
<li>details of the classes supplied for each column of the model frame
as attribute “dataClasses”,</li>
<li>in the “predvars” attribute, calls to functions such as bs() and
poly() which should be used for prediction from a new dataset. (See
<code>?makepredictcall</code> for the details.)</li>
</ul></li>
</ul>
<p>Some of these are used automatically but most require code in
class-specific methods.</p>
<h2 id="residualsfittedweights-methods">residuals/fitted/weights
methods</h2>
<p>To make use of <code>na.action</code> options like
<code>na.exclude</code>, the fitted() method needs to be along the lines
of</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>fitted.default <span class="ot">&lt;-</span> <span class="cf">function</span>(object, ...)</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>    <span class="fu">napredict</span>(object<span class="sc">$</span>na.action, object<span class="sc">$</span>fitted.values)</span></code></pre></div>
<p>For the residuals() method, replace <code>napredict</code> by
<code>naresid</code> (although for all current <code>na.action</code>s
they are the same, this need not be the case in future).</p>
<p>Similar code with a call to <code>naresid</code> is needed in a
weights() method.</p>
<h2 id="predict-methods">predict() methods</h2>
<p>Prediction from the original data used in fitting will often be
covered by the <code>fitted()</code> method, unless SEs or
confidence/prediction intervals are required.</p>
<p>In a <code>newdata</code> argument is supplied, most methods will
need to create a model matrix as if the newdata had originally been used
(but with <code>na.action</code> as set on the predict method,
defaulting to <code>na.pass</code>). A typical piece of code is</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>    m <span class="ot">&lt;-</span> <span class="fu">model.frame</span>(Terms, newdata, <span class="at">na.action =</span> na.action, <span class="at">xlev =</span> object<span class="sc">$</span>xlevels)</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>    <span class="cf">if</span>(<span class="sc">!</span><span class="fu">is.null</span>(cl <span class="ot">&lt;-</span> <span class="fu">attr</span>(Terms, <span class="st">&quot;dataClasses&quot;</span>)))</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>        <span class="fu">.checkMFClasses</span>(cl, m)</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a>    X <span class="ot">&lt;-</span> <span class="fu">model.matrix</span>(Terms, m, <span class="at">contrasts =</span> object<span class="sc">$</span>contrasts)</span></code></pre></div>
<p>Note the use of the saved levels and saved contrasts, and the safety
check on the classes of the variables found by model.frame (which of
course need not be found in <code>newdata</code>). Safe prediction from
terms involving poly(), bs() and so on will happen without needing any
code in the predict() method as this is handled in
model.frame.default().</p>
<p>If your code is like rpart() and handles ordered and unordered
factors differently use <code>.checkMFClasses(cl, m, TRUE)</code> — this
is not needed for code like lm() as both the set of levels of the
factors and the contrasts used at fit time are recorded in the fit
object and retrieved by the predict() method.</p>
<h2 id="model.frame-methods">model.frame() methods</h2>
<p>model.frame() methods are most often used to retrieve or recreate the
model frame from the fitted object, with no other arguments. For fitting
functions following the standard pattern outlined in this document no
method is needed: as from R 1.9.0 model.frame.default() will work.</p>
<p>One reason that a special method might be needed is to retrieve
columns of the data frame that correspond to arguments of the orginal
call other than <code>formula</code>, <code>subset</code> and
<code>weights</code>: for example the glm method handles
<code>offset</code>, <code>etastart</code> and <code>mustart</code>.</p>
<p>If you have a <code>model.frame()</code> method it should</p>
<ul>
<li><p>return the <code>model</code> component of the fit (and there are
no other arguments).</p></li>
<li><p>establish a suitable environment within which to look for
variables. The standard recipe is</p></li>
</ul>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>    fcall <span class="ot">&lt;-</span> formula<span class="sc">$</span>call</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>    <span class="do">## ... drop unneeded args ...</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a>    fcall[[<span class="dv">1</span>]] <span class="ot">&lt;-</span> <span class="fu">quote</span>(stats<span class="sc">::</span>model.frame)</span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a>    env <span class="ot">&lt;-</span> <span class="fu">environment</span>(formula<span class="sc">$</span>terms) <span class="sc">%||%</span> <span class="fu">parent.frame</span>()</span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a>    <span class="fu">eval</span>(fcall, env)</span></code></pre></div>
<ul>
<li>allow <code>...</code> to specify at least <code>data</code>,
<code>na.action</code> or <code>subset</code>.</li>
</ul>
</body>
</html>
