<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="description" content="Fits a linear model to the user-defined descending limb of a catch curve. Method functions extract estimates of the instantaneous (Z) and total annual (A) mortality rates with associated standard errors and confidence intervals. A plot method highlights the descending limb, shows the linear model on the descending limb, and, optionally, prints the estimated Z and A."><title>Mortality estimates from the descending limb of a catch curve. — catchCurve • FSA</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.2.2/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.2.2/bootstrap.bundle.min.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"><!-- bootstrap-toc --><script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@v1.0.1/dist/bootstrap-toc.min.js" integrity="sha256-4veVQbu7//Lk5TSmc7YV48MxtMy98e26cf5MrgZYnwo=" 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><!-- 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><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Mortality estimates from the descending limb of a catch curve. — catchCurve"><meta property="og:description" content="Fits a linear model to the user-defined descending limb of a catch curve. Method functions extract estimates of the instantaneous (Z) and total annual (A) mortality rates with associated standard errors and confidence intervals. A plot method highlights the descending limb, shows the linear model on the descending limb, and, optionally, prints the estimated Z and A."><meta property="og:image" content="https://fishr-core-team.github.io/FSA/logo.png"><!-- 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>
    <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
    

    <nav class="navbar fixed-top navbar-dark navbar-expand-lg bg-primary"><div class="container">
    
    <a class="navbar-brand me-2" href="../index.html">FSA</a>

    <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Released version">0.9.5</small>

    
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div id="navbar" class="collapse navbar-collapse ms-3">
      <ul class="navbar-nav me-auto"><li class="active nav-item">
  <a class="nav-link" href="../reference/index.html">Reference</a>
</li>
      </ul><form class="form-inline my-2 my-lg-0" role="search">
        <input type="search" class="form-control me-sm-2" aria-label="Toggle navigation" name="search-input" data-search-index="../search.json" id="search-input" placeholder="Search for" autocomplete="off"></form>

      <ul class="navbar-nav"><li class="nav-item">
  <a class="nav-link" href="../news/index.html">
    <span class="fa fa-newspaper"></span>
     
  </a>
</li>
<li class="nav-item">
  <a class="nav-link" href="../index.html">
    <span class="fa fa-home fa"></span>
     
  </a>
</li>
<li class="nav-item">
  <a class="external-link nav-link" href="https://github.com/fishR-Core-Team/FSA">
    <span class="fa fa-github fa"></span>
     
  </a>
</li>
      </ul></div>

    
  </div>
</nav><div class="container template-reference-topic">
<div class="row">
  <main id="main" class="col-md-9"><div class="page-header">
      <img src="../logo.png" class="logo" alt=""><h1>Mortality estimates from the descending limb of a catch curve.</h1>
      <small class="dont-index">Source: <a href="https://github.com/fishR-Core-Team/FSA/blob/HEAD/R/catchCurve.R" class="external-link"><code>R/catchCurve.R</code></a></small>
      <div class="d-none name"><code>catchCurve.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>Fits a linear model to the user-defined descending limb of a catch curve. Method functions extract estimates of the instantaneous (Z) and total annual (A) mortality rates with associated standard errors and confidence intervals. A plot method highlights the descending limb, shows the linear model on the descending limb, and, optionally, prints the estimated Z and A.</p>
    </div>

    <div class="section level2">
    <h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">catchCurve</span><span class="op">(</span><span class="va">x</span>, <span class="va">...</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for default</span></span>
<span><span class="fu">catchCurve</span><span class="op">(</span></span>
<span>  <span class="va">x</span>,</span>
<span>  <span class="va">catch</span>,</span>
<span>  ages2use <span class="op">=</span> <span class="va">age</span>,</span>
<span>  weighted <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  negWeightReplace <span class="op">=</span> <span class="fl">0</span>,</span>
<span>  <span class="va">...</span></span>
<span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for formula</span></span>
<span><span class="fu">catchCurve</span><span class="op">(</span></span>
<span>  <span class="va">x</span>,</span>
<span>  <span class="va">data</span>,</span>
<span>  ages2use <span class="op">=</span> <span class="va">age</span>,</span>
<span>  weighted <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  negWeightReplace <span class="op">=</span> <span class="fl">0</span>,</span>
<span>  <span class="va">...</span></span>
<span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for catchCurve</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">object</span>, parm <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"both"</span>, <span class="st">"all"</span>, <span class="st">"Z"</span>, <span class="st">"A"</span>, <span class="st">"lm"</span><span class="op">)</span>, <span class="va">...</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for catchCurve</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/stats/coef.html" class="external-link">coef</a></span><span class="op">(</span><span class="va">object</span>, parm <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"all"</span>, <span class="st">"both"</span>, <span class="st">"Z"</span>, <span class="st">"A"</span>, <span class="st">"lm"</span><span class="op">)</span>, <span class="va">...</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for catchCurve</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/stats/anova.html" class="external-link">anova</a></span><span class="op">(</span><span class="va">object</span>, <span class="va">...</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for catchCurve</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span></span>
<span>  <span class="va">object</span>,</span>
<span>  parm <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"all"</span>, <span class="st">"both"</span>, <span class="st">"Z"</span>, <span class="st">"A"</span>, <span class="st">"lm"</span><span class="op">)</span>,</span>
<span>  level <span class="op">=</span> <span class="va">conf.level</span>,</span>
<span>  conf.level <span class="op">=</span> <span class="fl">0.95</span>,</span>
<span>  <span class="va">...</span></span>
<span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for catchCurve</span></span>
<span><span class="fu"><a href="rSquared.html">rSquared</a></span><span class="op">(</span><span class="va">object</span>, digits <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"digits"</span><span class="op">)</span>, percent <span class="op">=</span> <span class="cn">FALSE</span>, <span class="va">...</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for catchCurve</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span></span>
<span>  <span class="va">x</span>,</span>
<span>  pos.est <span class="op">=</span> <span class="st">"topright"</span>,</span>
<span>  cex.est <span class="op">=</span> <span class="fl">0.95</span>,</span>
<span>  round.est <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">3</span>, <span class="fl">1</span><span class="op">)</span>,</span>
<span>  ylab <span class="op">=</span> <span class="st">"log(Catch)"</span>,</span>
<span>  xlab <span class="op">=</span> <span class="st">"Age"</span>,</span>
<span>  ylim <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  col.pt <span class="op">=</span> <span class="st">"gray30"</span>,</span>
<span>  col.mdl <span class="op">=</span> <span class="st">"black"</span>,</span>
<span>  lwd <span class="op">=</span> <span class="fl">2</span>,</span>
<span>  lty <span class="op">=</span> <span class="fl">1</span>,</span>
<span>  <span class="va">...</span></span>
<span><span class="op">)</span></span></code></pre></div>
    </div>

    <div class="section level2">
    <h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>
    <dl><dt>x</dt>
<dd><p>A numerical vector of assigned ages in the catch curve or a formula of the form <code>catch~age</code> when used in <code>catchCurve</code>. An object saved from <code>catchCurve</code> (i.e., of class <code>catchCurve</code>) when used in the methods.</p></dd>


<dt>...</dt>
<dd><p>Additional arguments for methods.</p></dd>


<dt>catch</dt>
<dd><p>A numerical vector of catches or CPUEs for the ages in the catch curve. Not used if <code>x</code> is a formula.</p></dd>


<dt>ages2use</dt>
<dd><p>A numerical vector of ages that define the descending limb of the catch curve.</p></dd>


<dt>weighted</dt>
<dd><p>A logical that indicates whether a weighted regression should be used. See details.</p></dd>


<dt>negWeightReplace</dt>
<dd><p>A single non-negative numeric that will replace negative weights (defaults to 0). Only used when <code>weighted=TRUE</code>. See details.</p></dd>


<dt>data</dt>
<dd><p>A data.frame from which the variables in the <code>x</code> formula can be found. Not used if <code>x</code> is not a formula.</p></dd>


<dt>object</dt>
<dd><p>An object saved from the <code>catchCurve</code> call (i.e., of class <code>catchCurve</code>).</p></dd>


<dt>parm</dt>
<dd><p>A numeric or string (of parameter names) vector that specifies which parameters are to be given confidence intervals. If <code>parm="lm"</code> then confidence intervals for the underlying linear model are returned.</p></dd>


<dt>level</dt>
<dd><p>Same as <code>conf.level</code>. Used for compatibility with the generic <code>confint</code> function.</p></dd>


<dt>conf.level</dt>
<dd><p>A number representing the level of confidence to use for constructing confidence intervals.</p></dd>


<dt>digits</dt>
<dd><p>The number of digits to round the <code>rSquared</code> result to.</p></dd>


<dt>percent</dt>
<dd><p>A logical that indicates if the <code>rSquared</code> result should be returned as a percentage (<code>=TRUE</code>) or as a proportion (<code>=FALSE</code>; default).</p></dd>


<dt>pos.est</dt>
<dd><p>A string to identify where to place the estimated mortality rates on the plot. Can be set to one of <code>"bottomright"</code>, <code>"bottom"</code>, <code>"bottomleft"</code>, <code>"left"</code>, <code>"topleft"</code>, <code>"top"</code>, <code>"topright"</code>, <code>"right"</code> or <code>"center"</code> for positioning the estimated mortality rates on the plot. Typically <code>"bottomleft"</code> (DEFAULT) and <code>"topright"</code> will be “out-of-the-way” placements. Set <code>pos.est</code> to <code>NULL</code> to remove the estimated mortality rates from the plot.</p></dd>


<dt>cex.est</dt>
<dd><p>A single numeric character expansion value for the estimated mortality rates on the plot.</p></dd>


<dt>round.est</dt>
<dd><p>A numeric that indicates the number of decimal place to which Z (first value) and A (second value) should be rounded. If only one value then it will be used for both Z and A.</p></dd>


<dt>ylab</dt>
<dd><p>A label for the y-axis (<code>"log(Catch)"</code> is the default).</p></dd>


<dt>xlab</dt>
<dd><p>A label for the x-axis (<code>"Age"</code> is the default).</p></dd>


<dt>ylim</dt>
<dd><p>A numeric for the limits of the y-axis. If <code>NULL</code> then will default to a minimum of 0 or the lowest negative log catch and a maximum of the maximum log catch. If a single value then it will be the maximum of the y-axis. If two values then these will the minimum and maximum values of the y-axis.</p></dd>


<dt>col.pt</dt>
<dd><p>A string that indicates the color of the plotted points.</p></dd>


<dt>col.mdl</dt>
<dd><p>A string that indicates the color of the fitted line.</p></dd>


<dt>lwd</dt>
<dd><p>A numeric that indicates the line width of the fitted line.</p></dd>


<dt>lty</dt>
<dd><p>A numeric that indicates the type of line used for the fitted line.</p></dd>

</dl></div>
    <div class="section level2">
    <h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
    

<p>A list that contains the following items:</p>
<p></p>
<ul><li><p>age The original vector of assigned ages.</p></li>
<li><p>catch The original vector of observed catches or CPUEs.</p></li>
<li><p>age.e A vector of assigned ages for which the catch curve was fit.</p></li>
<li><p>log.catch.e A vector of log catches or CPUEs for which the catch curve was fit.</p></li>
<li><p>W A vector of weights used in the catch curve fit. Will be <code>NULL</code> unless <code>weighted=TRUE</code>.</p></li>
<li><p>lm An <code>lm</code> object from the fit to the ages and log catches or CPUEs on the descending limb (i.e., in age.e and log.catch.e).</p></li>
</ul></div>
    <div class="section level2">
    <h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
    <p>The default is to use all ages in the age vector. This is appropriate only when the age and catch vectors contain only the ages and catches on the descending limb of the catch curve. Use <code>ages2use</code> to isolate only the catch and ages on the descending limb.</p>
<p>If <code>weighted=TRUE</code> then a weighted regression is used where the weights are the log(number) at each age predicted from the unweighted regression of log(number) on age (as proposed by Maceina and Bettoli (1998)). If a negative weight is computed it will be changed to the value in <code>negWeightReplace</code> and a warning will be issued.</p>
    </div>
    <div class="section level2">
    <h2 id="testing">Testing<a class="anchor" aria-label="anchor" href="#testing"></a></h2>
    <p>Tested the results of catch curve, both unweighted and weighted, against the results in Miranda and Bettoli (2007). Results for Z and the SE of Z matched perfectly. Tested the unweighted results against the results from <code>agesurv</code> in <span class="pkg">fishmethods</span> using the <code>rockbass</code> data.frame in <span class="pkg">fishmethods</span>. Results for Z and the SE of Z matched perfectly.</p>
    </div>
    <div class="section level2">
    <h2 id="ifar-chapter">IFAR Chapter<a class="anchor" aria-label="anchor" href="#ifar-chapter"></a></h2>
    <p>11-Mortality.</p>
    </div>
    <div class="section level2">
    <h2 id="references">References<a class="anchor" aria-label="anchor" href="#references"></a></h2>
    <p>Ogle, D.H. 2016. <a href="https://fishr-core-team.github.io/fishR/pages/books.html#introductory-fisheries-analyses-with-r" class="external-link">Introductory Fisheries Analyses with R</a>. Chapman &amp; Hall/CRC, Boca Raton, FL.</p>
<p>Maceina, M.J., and P.W. Bettoli. 1998. Variation in Largemouth Bass recruitment in four mainstream impoundments on the Tennessee River. North American Journal of Fisheries Management 18:998-1003.</p>
<p>Ricker, W.E. 1975. Computation and interpretation of biological statistics of fish populations. Technical Report Bulletin 191, Bulletin of the Fisheries Research Board of Canada. [Was (is?) from http://www.dfo-mpo.gc.ca/Library/1485.pdf.]</p>
    </div>
    <div class="section level2">
    <h2 id="see-also">See also<a class="anchor" aria-label="anchor" href="#see-also"></a></h2>
    <div class="dont-index"><p>See <code><a href="https://rdrr.io/pkg/fishmethods/man/agesurv.html" class="external-link">agesurv</a></code> in <span class="pkg">fishmethods</span> for similar functionality. See <code><a href="chapmanRobson.html">chapmanRobson</a></code> and <code><a href="https://rdrr.io/pkg/fishmethods/man/agesurvcl.html" class="external-link">agesurvcl</a></code> in <span class="pkg">fishmethods</span> for alternative methods to estimate mortality rates. See <code><a href="metaM.html">metaM</a></code> for empirical methods to estimate natural mortality.</p></div>
    </div>
    <div class="section level2">
    <h2 id="author">Author<a class="anchor" aria-label="anchor" href="#author"></a></h2>
    <p>Derek H. Ogle, <a href="mailto:DerekOgle51@gmail.com">DerekOgle51@gmail.com</a></p>
    </div>

    <div class="section level2">
    <h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">catch</span><span class="op">~</span><span class="va">age</span>,data<span class="op">=</span><span class="va">BrookTroutTH</span>,pch<span class="op">=</span><span class="fl">19</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="catchCurve-1.png" alt="" width="700" height="433"></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co">## demonstration of formula notation</span></span></span>
<span class="r-in"><span><span class="va">cc1</span> <span class="op">&lt;-</span> <span class="fu">catchCurve</span><span class="op">(</span><span class="va">catch</span><span class="op">~</span><span class="va">age</span>,data<span class="op">=</span><span class="va">BrookTroutTH</span>,ages2use<span class="op">=</span><span class="fl">2</span><span class="op">:</span><span class="fl">6</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">cc1</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>    Estimate Std. Error  t value   Pr(&gt;|t|)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Z  0.659987   0.136741 4.826549 0.01695159</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> A 48.314197         NA       NA         NA</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/cbind.html" class="external-link">cbind</a></span><span class="op">(</span>Est<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/stats/coef.html" class="external-link">coef</a></span><span class="op">(</span><span class="va">cc1</span><span class="op">)</span>,<span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">cc1</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>         Est    95% LCI   95% UCI</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Z  0.659987  0.2248162  1.095158</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> A 48.314197 20.1337012 66.551321</span>
<span class="r-in"><span><span class="fu"><a href="rSquared.html">rSquared</a></span><span class="op">(</span><span class="va">cc1</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.8859124</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">cc1</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">cc1</span>,parm<span class="op">=</span><span class="st">"Z"</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>   Estimate Std. Error  t value   Pr(&gt;|t|)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Z 0.659987   0.136741 4.826549 0.01695159</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/cbind.html" class="external-link">cbind</a></span><span class="op">(</span>Est<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/stats/coef.html" class="external-link">coef</a></span><span class="op">(</span><span class="va">cc1</span>,parm<span class="op">=</span><span class="st">"Z"</span><span class="op">)</span>,<span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">cc1</span>,parm<span class="op">=</span><span class="st">"Z"</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>        Est   95% LCI  95% UCI</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Z 0.659987 0.2248162 1.095158</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co">## demonstration of excluding ages2use</span></span></span>
<span class="r-in"><span><span class="va">cc2</span> <span class="op">&lt;-</span> <span class="fu">catchCurve</span><span class="op">(</span><span class="va">catch</span><span class="op">~</span><span class="va">age</span>,data<span class="op">=</span><span class="va">BrookTroutTH</span>,ages2use<span class="op">=</span><span class="op">-</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">0</span>,<span class="fl">1</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">cc2</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>    Estimate Std. Error  t value   Pr(&gt;|t|)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Z  0.659987   0.136741 4.826549 0.01695159</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> A 48.314197         NA       NA         NA</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">cc2</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="catchCurve-2.png" alt="" width="700" height="433"></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co">## demonstration of using weights</span></span></span>
<span class="r-in"><span><span class="va">cc3</span> <span class="op">&lt;-</span> <span class="fu">catchCurve</span><span class="op">(</span><span class="va">catch</span><span class="op">~</span><span class="va">age</span>,data<span class="op">=</span><span class="va">BrookTroutTH</span>,ages2use<span class="op">=</span><span class="fl">2</span><span class="op">:</span><span class="fl">6</span>,weighted<span class="op">=</span><span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">cc3</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>     Estimate Std. Error t value   Pr(&gt;|t|)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Z  0.6430183  0.1417433  4.5365 0.02004993</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> A 47.4296703         NA      NA         NA</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">cc3</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="catchCurve-3.png" alt="" width="700" height="433"></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co">## demonstration of returning the linear model results</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">cc3</span>,parm<span class="op">=</span><span class="st">"lm"</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Call:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> stats::lm(formula = log.catch.e ~ age.e, weights = W, na.action = stats::na.exclude)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Weighted Residuals:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>         1         2         3         4         5 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> -0.008845 -0.551857  1.155519 -0.513606 -0.103196 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Coefficients:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>             Estimate Std. Error t value Pr(&gt;|t|)   </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> (Intercept)   6.0086     0.5475  10.974  0.00162 **</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> age.e        -0.6430     0.1417  -4.536  0.02005 * </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> ---</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Residual standard error: 0.7988 on 3 degrees of freedom</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Multiple R-squared:  0.8728,	Adjusted R-squared:  0.8304 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> F-statistic: 20.58 on 1 and 3 DF,  p-value: 0.02005</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/cbind.html" class="external-link">cbind</a></span><span class="op">(</span>Est<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/stats/coef.html" class="external-link">coef</a></span><span class="op">(</span><span class="va">cc3</span>,parm<span class="op">=</span><span class="st">"lm"</span><span class="op">)</span>,<span class="fu"><a href="https://rdrr.io/r/stats/confint.html" class="external-link">confint</a></span><span class="op">(</span><span class="va">cc3</span>,parm<span class="op">=</span><span class="st">"lm"</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                    Est   95% LCI   95% UCI</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> (Intercept)  6.0085938  4.266116  7.751072</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> age.e       -0.6430183 -1.094109 -0.191928</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co">## demonstration of ability to work with missing age classes</span></span></span>
<span class="r-in"><span><span class="va">df</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>age<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span>  <span class="fl">2</span>, <span class="fl">3</span>, <span class="fl">4</span>, <span class="fl">5</span>, <span class="fl">7</span>, <span class="fl">9</span>,<span class="fl">12</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>                 ct<span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">100</span>,<span class="fl">92</span>,<span class="fl">83</span>,<span class="fl">71</span>,<span class="fl">56</span>,<span class="fl">35</span>, <span class="fl">1</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">cc4</span> <span class="op">&lt;-</span> <span class="fu">catchCurve</span><span class="op">(</span><span class="va">ct</span><span class="op">~</span><span class="va">age</span>,data<span class="op">=</span><span class="va">df</span>,ages2use<span class="op">=</span><span class="fl">4</span><span class="op">:</span><span class="fl">12</span><span class="op">)</span></span></span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span class="warning">Warning: </span>Some 'ages2use' not in observed ages.</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">cc4</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>     Estimate Std. Error  t value   Pr(&gt;|t|)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Z  0.5139824  0.1495532 3.436786 0.04133277</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> A 40.1891060         NA       NA         NA</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">cc4</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="catchCurve-4.png" alt="" width="700" height="433"></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co">## demonstration of ability to work with missing age classes</span></span></span>
<span class="r-in"><span><span class="co">## evein if catches are recorded as NAs</span></span></span>
<span class="r-in"><span><span class="va">df</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>age<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span>  <span class="fl">2</span>, <span class="fl">3</span>, <span class="fl">4</span>, <span class="fl">5</span>, <span class="fl">6</span>, <span class="fl">7</span>, <span class="fl">8</span>, <span class="fl">9</span>,<span class="fl">10</span>,<span class="fl">11</span>,<span class="fl">12</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>                 ct<span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">100</span>,<span class="fl">92</span>,<span class="fl">83</span>,<span class="fl">71</span>,<span class="cn">NA</span>,<span class="fl">56</span>,<span class="cn">NA</span>,<span class="fl">35</span>,<span class="cn">NA</span>,<span class="cn">NA</span>, <span class="fl">1</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">cc5</span> <span class="op">&lt;-</span> <span class="fu">catchCurve</span><span class="op">(</span><span class="va">ct</span><span class="op">~</span><span class="va">age</span>,data<span class="op">=</span><span class="va">df</span>,ages2use<span class="op">=</span><span class="fl">4</span><span class="op">:</span><span class="fl">12</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">cc5</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>     Estimate Std. Error  t value   Pr(&gt;|t|)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Z  0.5139824  0.1495532 3.436786 0.04133277</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> A 40.1891060         NA       NA         NA</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">cc5</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="catchCurve-5.png" alt="" width="700" height="433"></span>
<span class="r-in"><span></span></span>
</code></pre></div>
    </div>
  </main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>
    </nav></aside></div>


    <footer><div class="pkgdown-footer-left">
  <p></p><p>Developed by <a href="http://derekogle.com" class="external-link">Derek H. Ogle</a>, Jason C. Doll, A. Powell Wheeler, Alexis Dinno.</p>
</div>

<div class="pkgdown-footer-right">
  <p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>

    </footer></div>

  

  

  </body></html>

