
<!DOCTYPE html>

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

    <title>Case Study: Simple Extrapolation &#8212; lsqfit 13.0.1 documentation</title>
    <link rel="stylesheet" type="text/css" href="_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="_static/pyramid.css" />
    <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
    <script src="_static/jquery.js"></script>
    <script src="_static/underscore.js"></script>
    <script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
    <script src="_static/doctools.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Case Study: Numerical Analysis inside a Fit" href="case-pendulum.html" />
    <link rel="prev" title="Non-Gaussian Behavior; Testing Fits" href="testing.html" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="_static/ie6.css" type="text/css" media="screen" charset="utf-8" />
<![endif]-->

  </head><body>

    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="case-pendulum.html" title="Case Study: Numerical Analysis inside a Fit"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="testing.html" title="Non-Gaussian Behavior; Testing Fits"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">lsqfit 13.0.1 documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">Case Study: Simple Extrapolation</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="case-study-simple-extrapolation">
<h1>Case Study: Simple Extrapolation<a class="headerlink" href="#case-study-simple-extrapolation" title="Permalink to this heading">¶</a></h1>
<p>In this case study, we examine a simple extrapolation problem. We show first
how <em>not</em> to solve this problem. A better solution follows, together with
a discussion of priors and Bayes factors. Finally a very simple,
alternative solution, using marginalization, is described.</p>
<section id="the-problem">
<h2>The Problem<a class="headerlink" href="#the-problem" title="Permalink to this heading">¶</a></h2>
<p>Consider a problem where we have five pieces of uncorrelated data for a
function <code class="docutils literal notranslate"><span class="pre">y(x)</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">x</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>       <span class="n">y</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
<span class="o">----------------------</span>
<span class="mf">0.1</span>        <span class="mf">0.5351</span> <span class="p">(</span><span class="mi">54</span><span class="p">)</span>
<span class="mf">0.3</span>        <span class="mf">0.6762</span> <span class="p">(</span><span class="mi">67</span><span class="p">)</span>
<span class="mf">0.5</span>        <span class="mf">0.9227</span> <span class="p">(</span><span class="mi">91</span><span class="p">)</span>
<span class="mf">0.7</span>        <span class="mf">1.3803</span><span class="p">(</span><span class="mi">131</span><span class="p">)</span>
<span class="mf">0.95</span>       <span class="mf">4.0145</span><span class="p">(</span><span class="mi">399</span><span class="p">)</span>
</pre></div>
</div>
<p>We know that <code class="docutils literal notranslate"><span class="pre">y(x)</span></code> has a Taylor expansion in <code class="docutils literal notranslate"><span class="pre">x</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">y</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">=</span> <span class="n">sum_n</span><span class="o">=</span><span class="mf">0.</span><span class="o">.</span><span class="n">inf</span> <span class="n">p</span><span class="p">[</span><span class="n">n</span><span class="p">]</span> <span class="n">x</span><span class="o">**</span><span class="n">n</span>
</pre></div>
</div>
<p>The challenge is to extract a reliable estimate for <code class="docutils literal notranslate"><span class="pre">y(0)=p[0]</span></code> from the
data — that is, the challenge is to fit the data and use
the fit to extrapolate the data to <code class="docutils literal notranslate"><span class="pre">x=0</span></code>.</p>
</section>
<section id="a-bad-solution">
<h2>A Bad Solution<a class="headerlink" href="#a-bad-solution" title="Permalink to this heading">¶</a></h2>
<p>One approach that is certainly wrong is to fit the data with
a power series expansion for
<code class="docutils literal notranslate"><span class="pre">y(x)</span></code> that is truncated after five terms (<code class="docutils literal notranslate"><span class="pre">n&lt;=4</span></code>) —
there are only five pieces of data and such a fit would have five
parameters.
This approach gives the following fit, where the gray band shows the 1-sigma
uncertainty in the fit function evaluated with the best-fit parameters:</p>
<a class="reference internal image-reference" href="_images/eg-appendix1a.png"><img alt="_images/eg-appendix1a.png" src="_images/eg-appendix1a.png" style="width: 80%;" /></a>
<p>This fit was generated using the following code:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">gvar</span> <span class="k">as</span> <span class="nn">gv</span>
<span class="kn">import</span> <span class="nn">lsqfit</span>

<span class="c1"># fit data</span>
<span class="n">y</span> <span class="o">=</span> <span class="n">gv</span><span class="o">.</span><span class="n">gvar</span><span class="p">([</span>
   <span class="s1">&#39;0.5351(54)&#39;</span><span class="p">,</span> <span class="s1">&#39;0.6762(67)&#39;</span><span class="p">,</span> <span class="s1">&#39;0.9227(91)&#39;</span><span class="p">,</span> <span class="s1">&#39;1.3803(131)&#39;</span><span class="p">,</span> <span class="s1">&#39;4.0145(399)&#39;</span>
   <span class="p">])</span>
<span class="n">x</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.1</span><span class="p">,</span> <span class="mf">0.3</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.7</span><span class="p">,</span> <span class="mf">0.95</span><span class="p">])</span>

<span class="c1"># fit function</span>
<span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">p</span><span class="p">):</span>
   <span class="k">return</span> <span class="nb">sum</span><span class="p">(</span><span class="n">pn</span> <span class="o">*</span> <span class="n">x</span> <span class="o">**</span> <span class="n">n</span> <span class="k">for</span> <span class="n">n</span><span class="p">,</span> <span class="n">pn</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">p</span><span class="p">))</span>

<span class="n">p0</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="mf">5.</span><span class="p">)</span>              <span class="c1"># starting value for chi**2 minimization</span>
<span class="n">fit</span> <span class="o">=</span> <span class="n">lsqfit</span><span class="o">.</span><span class="n">nonlinear_fit</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="n">p0</span><span class="o">=</span><span class="n">p0</span><span class="p">,</span> <span class="n">fcn</span><span class="o">=</span><span class="n">f</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">fit</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">maxline</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span>
</pre></div>
</div>
<p>Note that here the function <code class="docutils literal notranslate"><span class="pre">gv.gvar</span></code> converts the strings
<code class="docutils literal notranslate"><span class="pre">'0.5351(54)'</span></code>, <em>etc.</em> into <code class="xref py py-class docutils literal notranslate"><span class="pre">gvar.GVar</span></code>s. Running the code gives the
following output:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Least</span> <span class="n">Square</span> <span class="n">Fit</span> <span class="p">(</span><span class="n">no</span> <span class="n">prior</span><span class="p">):</span>
  <span class="n">chi2</span><span class="o">/</span><span class="n">dof</span> <span class="p">[</span><span class="n">dof</span><span class="p">]</span> <span class="o">=</span> <span class="mf">4.5e-24</span> <span class="p">[</span><span class="mi">0</span><span class="p">]</span>    <span class="n">Q</span> <span class="o">=</span> <span class="mi">0</span>    <span class="n">logGBF</span> <span class="o">=</span> <span class="kc">None</span>

<span class="n">Parameters</span><span class="p">:</span>
              <span class="mi">0</span>    <span class="mf">0.742</span> <span class="p">(</span><span class="mi">39</span><span class="p">)</span>     <span class="p">[</span>   <span class="mi">1</span> <span class="o">+-</span> <span class="n">inf</span> <span class="p">]</span>  
              <span class="mi">1</span>    <span class="o">-</span><span class="mf">3.86</span> <span class="p">(</span><span class="mi">59</span><span class="p">)</span>     <span class="p">[</span>   <span class="mi">1</span> <span class="o">+-</span> <span class="n">inf</span> <span class="p">]</span>  
              <span class="mi">2</span>    <span class="mf">21.5</span> <span class="p">(</span><span class="mf">2.4</span><span class="p">)</span>     <span class="p">[</span>   <span class="mi">1</span> <span class="o">+-</span> <span class="n">inf</span> <span class="p">]</span>  
              <span class="mi">3</span>   <span class="o">-</span><span class="mf">39.1</span> <span class="p">(</span><span class="mf">3.7</span><span class="p">)</span>     <span class="p">[</span>   <span class="mi">1</span> <span class="o">+-</span> <span class="n">inf</span> <span class="p">]</span>  
              <span class="mi">4</span>    <span class="mf">25.8</span> <span class="p">(</span><span class="mf">1.9</span><span class="p">)</span>     <span class="p">[</span>   <span class="mi">1</span> <span class="o">+-</span> <span class="n">inf</span> <span class="p">]</span>  

<span class="n">Fit</span><span class="p">:</span>
     <span class="n">x</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>           <span class="n">y</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>      <span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="n">k</span><span class="p">],</span><span class="n">p</span><span class="p">)</span>
<span class="o">---------------------------------------</span>
      <span class="mf">0.1</span>    <span class="mf">0.5351</span> <span class="p">(</span><span class="mi">54</span><span class="p">)</span>    <span class="mf">0.5351</span> <span class="p">(</span><span class="mi">54</span><span class="p">)</span>  
      <span class="mf">0.3</span>    <span class="mf">0.6762</span> <span class="p">(</span><span class="mi">67</span><span class="p">)</span>    <span class="mf">0.6762</span> <span class="p">(</span><span class="mi">67</span><span class="p">)</span>  
      <span class="mf">0.5</span>    <span class="mf">0.9227</span> <span class="p">(</span><span class="mi">91</span><span class="p">)</span>    <span class="mf">0.9227</span> <span class="p">(</span><span class="mi">91</span><span class="p">)</span>  
      <span class="mf">0.7</span>     <span class="mf">1.380</span> <span class="p">(</span><span class="mi">13</span><span class="p">)</span>     <span class="mf">1.380</span> <span class="p">(</span><span class="mi">13</span><span class="p">)</span>  
     <span class="mf">0.95</span>     <span class="mf">4.014</span> <span class="p">(</span><span class="mi">40</span><span class="p">)</span>     <span class="mf">4.014</span> <span class="p">(</span><span class="mi">40</span><span class="p">)</span>  

<span class="n">Settings</span><span class="p">:</span>
  <span class="n">svdcut</span><span class="o">/</span><span class="n">n</span> <span class="o">=</span> <span class="mf">1e-12</span><span class="o">/</span><span class="mi">0</span>    <span class="n">tol</span> <span class="o">=</span> <span class="p">(</span><span class="mf">1e-08</span><span class="o">*</span><span class="p">,</span><span class="mf">1e-10</span><span class="p">,</span><span class="mf">1e-10</span><span class="p">)</span>    <span class="p">(</span><span class="n">itns</span><span class="o">/</span><span class="n">time</span> <span class="o">=</span> <span class="mi">11</span><span class="o">/</span><span class="mf">0.0</span><span class="p">)</span>

</pre></div>
</div>
<p>This is a “perfect” fit in that the fit function agrees exactly with
the data; the <code class="docutils literal notranslate"><span class="pre">chi**2</span></code> for the fit is zero. The 5-parameter fit
gives a fairly precise answer for <code class="docutils literal notranslate"><span class="pre">p[0]</span></code>
(<code class="docutils literal notranslate"><span class="pre">0.74(4)</span></code>), but the curve looks oddly stiff. Also some of the
best-fit values for the coefficients are quite
large (<em>e.g.</em>, <code class="docutils literal notranslate"><span class="pre">p[3]=</span> <span class="pre">-39(4)</span></code>), perhaps unreasonably large.</p>
</section>
<section id="a-better-solution-priors">
<h2>A Better Solution — Priors<a class="headerlink" href="#a-better-solution-priors" title="Permalink to this heading">¶</a></h2>
<p>The problem with a 5-parameter fit is that there is no reason to neglect
terms in the expansion of <code class="docutils literal notranslate"><span class="pre">y(x)</span></code> with <code class="docutils literal notranslate"><span class="pre">n&gt;4</span></code>. Whether or not
extra terms are important depends entirely on how large we
expect the coefficients <code class="docutils literal notranslate"><span class="pre">p[n]</span></code> for <code class="docutils literal notranslate"><span class="pre">n&gt;4</span></code> to be. The extrapolation
problem is impossible without some idea of the size of these
parameters; we need extra information.</p>
<p>In this case that extra information is obviously connected to questions
of convergence of the Taylor expansion we are using to model <code class="docutils literal notranslate"><span class="pre">y(x)</span></code>.
Let’s assume we know, from previous work, that the <code class="docutils literal notranslate"><span class="pre">p[n]</span></code> are of
order one. Then we would need to keep at least 91 terms in the
Taylor expansion if we wanted the terms we dropped to be small compared
with the 1% data errors at <code class="docutils literal notranslate"><span class="pre">x=0.95</span></code>. So a possible fitting function
would be:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">y</span><span class="p">(</span><span class="n">x</span><span class="p">;</span> <span class="n">N</span><span class="p">)</span> <span class="o">=</span> <span class="n">sum_n</span><span class="o">=</span><span class="mf">0.</span><span class="o">.</span><span class="n">N</span> <span class="n">p</span><span class="p">[</span><span class="n">n</span><span class="p">]</span> <span class="n">x</span><span class="o">**</span><span class="n">n</span>
</pre></div>
</div>
<p>with <code class="docutils literal notranslate"><span class="pre">N=90</span></code>.</p>
<p>Fitting a 91-parameter formula to five pieces of data is also impossible.
Here, however, we have extra (<em>prior</em>) information: each coefficient is order
one, which we make specific by saying that they equal 0±1. We include
these <em>a priori</em> estimates for the parameters as extra data that must be
fit, together with our original data. So we are
actually fitting 91+5 pieces of data with 91 parameters.</p>
<p>The prior information is introduced into the fit as a <em>prior</em>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">gvar</span> <span class="k">as</span> <span class="nn">gv</span>
<span class="kn">import</span> <span class="nn">lsqfit</span>

<span class="c1"># fit data</span>
<span class="n">y</span> <span class="o">=</span> <span class="n">gv</span><span class="o">.</span><span class="n">gvar</span><span class="p">([</span>
   <span class="s1">&#39;0.5351(54)&#39;</span><span class="p">,</span> <span class="s1">&#39;0.6762(67)&#39;</span><span class="p">,</span> <span class="s1">&#39;0.9227(91)&#39;</span><span class="p">,</span> <span class="s1">&#39;1.3803(131)&#39;</span><span class="p">,</span> <span class="s1">&#39;4.0145(399)&#39;</span>
   <span class="p">])</span>
<span class="n">x</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.1</span><span class="p">,</span> <span class="mf">0.3</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.7</span><span class="p">,</span> <span class="mf">0.95</span><span class="p">])</span>

<span class="c1"># fit function</span>
<span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">p</span><span class="p">):</span>
   <span class="k">return</span> <span class="nb">sum</span><span class="p">(</span><span class="n">pn</span> <span class="o">*</span> <span class="n">x</span> <span class="o">**</span> <span class="n">n</span> <span class="k">for</span> <span class="n">n</span><span class="p">,</span> <span class="n">pn</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">p</span><span class="p">))</span>

<span class="c1"># 91-parameter prior for the fit</span>
<span class="n">prior</span> <span class="o">=</span> <span class="n">gv</span><span class="o">.</span><span class="n">gvar</span><span class="p">(</span><span class="mi">91</span> <span class="o">*</span> <span class="p">[</span><span class="s1">&#39;0(1)&#39;</span><span class="p">])</span>

<span class="n">fit</span> <span class="o">=</span> <span class="n">lsqfit</span><span class="o">.</span><span class="n">nonlinear_fit</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="n">prior</span><span class="o">=</span><span class="n">prior</span><span class="p">,</span> <span class="n">fcn</span><span class="o">=</span><span class="n">f</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">fit</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">maxline</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span>
</pre></div>
</div>
<p>Note that a starting value <code class="docutils literal notranslate"><span class="pre">p0</span></code> is not needed when a prior is specified.
This code also gives an excellent fit, with a <code class="docutils literal notranslate"><span class="pre">chi**2</span></code> per degree of
freedom of <code class="docutils literal notranslate"><span class="pre">0.35</span></code> (note that the data point at <code class="docutils literal notranslate"><span class="pre">x=0.95</span></code> is off the chart,
but agrees with the fit to within its 1% errors):</p>
<a class="reference internal image-reference" href="_images/eg-appendix1b.png"><img alt="_images/eg-appendix1b.png" src="_images/eg-appendix1b.png" style="width: 80%;" /></a>
<p>The fit code output is:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Least</span> <span class="n">Square</span> <span class="n">Fit</span><span class="p">:</span>
  <span class="n">chi2</span><span class="o">/</span><span class="n">dof</span> <span class="p">[</span><span class="n">dof</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.35</span> <span class="p">[</span><span class="mi">5</span><span class="p">]</span>    <span class="n">Q</span> <span class="o">=</span> <span class="mf">0.88</span>    <span class="n">logGBF</span> <span class="o">=</span> <span class="o">-</span><span class="mf">0.45508</span>

<span class="n">Parameters</span><span class="p">:</span>
              <span class="mi">0</span>      <span class="mf">0.489</span> <span class="p">(</span><span class="mi">17</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">1</span>       <span class="mf">0.40</span> <span class="p">(</span><span class="mi">20</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">2</span>       <span class="mf">0.60</span> <span class="p">(</span><span class="mi">64</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">3</span>       <span class="mf">0.44</span> <span class="p">(</span><span class="mi">80</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">4</span>       <span class="mf">0.28</span> <span class="p">(</span><span class="mi">87</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">5</span>       <span class="mf">0.19</span> <span class="p">(</span><span class="mi">87</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">6</span>       <span class="mf">0.16</span> <span class="p">(</span><span class="mi">90</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">7</span>       <span class="mf">0.16</span> <span class="p">(</span><span class="mi">93</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">8</span>       <span class="mf">0.17</span> <span class="p">(</span><span class="mi">95</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">9</span>       <span class="mf">0.18</span> <span class="p">(</span><span class="mi">96</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">10</span>       <span class="mf">0.19</span> <span class="p">(</span><span class="mi">97</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">11</span>       <span class="mf">0.19</span> <span class="p">(</span><span class="mi">97</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">12</span>       <span class="mf">0.19</span> <span class="p">(</span><span class="mi">97</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">13</span>       <span class="mf">0.19</span> <span class="p">(</span><span class="mi">97</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">14</span>       <span class="mf">0.18</span> <span class="p">(</span><span class="mi">97</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">15</span>       <span class="mf">0.18</span> <span class="p">(</span><span class="mi">97</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">16</span>       <span class="mf">0.17</span> <span class="p">(</span><span class="mi">97</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">17</span>       <span class="mf">0.16</span> <span class="p">(</span><span class="mi">98</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">18</span>       <span class="mf">0.16</span> <span class="p">(</span><span class="mi">98</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">19</span>       <span class="mf">0.15</span> <span class="p">(</span><span class="mi">98</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">20</span>       <span class="mf">0.14</span> <span class="p">(</span><span class="mi">98</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">21</span>       <span class="mf">0.14</span> <span class="p">(</span><span class="mi">98</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">22</span>       <span class="mf">0.13</span> <span class="p">(</span><span class="mi">98</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">23</span>       <span class="mf">0.12</span> <span class="p">(</span><span class="mi">99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">24</span>       <span class="mf">0.12</span> <span class="p">(</span><span class="mi">99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">25</span>       <span class="mf">0.11</span> <span class="p">(</span><span class="mi">99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">26</span>       <span class="mf">0.11</span> <span class="p">(</span><span class="mi">99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">27</span>       <span class="mf">0.10</span> <span class="p">(</span><span class="mi">99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">28</span>       <span class="mf">0.10</span> <span class="p">(</span><span class="mi">99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">29</span>       <span class="mf">0.09</span> <span class="p">(</span><span class="mi">99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">30</span>       <span class="mf">0.09</span> <span class="p">(</span><span class="mi">99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">31</span>       <span class="mf">0.08</span> <span class="p">(</span><span class="mi">99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">32</span>       <span class="mf">0.08</span> <span class="p">(</span><span class="mi">99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">33</span>       <span class="mf">0.07</span> <span class="p">(</span><span class="mi">99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">34</span>     <span class="mf">0.07</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">35</span>     <span class="mf">0.07</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">36</span>     <span class="mf">0.06</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">37</span>     <span class="mf">0.06</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">38</span>     <span class="mf">0.06</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">39</span>     <span class="mf">0.06</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">40</span>     <span class="mf">0.05</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">41</span>     <span class="mf">0.05</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">42</span>     <span class="mf">0.05</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">43</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">44</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">45</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">46</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">47</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">48</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">49</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">50</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">51</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">52</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">53</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">54</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">55</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">56</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">57</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">58</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">59</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">60</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">61</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">62</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">63</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">64</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">65</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">66</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">67</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">68</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">69</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">70</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">71</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">72</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">73</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">1.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">74</span>   <span class="mf">0.009</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">75</span>   <span class="mf">0.009</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">76</span>   <span class="mf">0.008</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">77</span>   <span class="mf">0.008</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">78</span>   <span class="mf">0.007</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">79</span>   <span class="mf">0.007</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">80</span>   <span class="mf">0.007</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">81</span>   <span class="mf">0.006</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">82</span>   <span class="mf">0.006</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">83</span>   <span class="mf">0.006</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">84</span>   <span class="mf">0.005</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">85</span>   <span class="mf">0.005</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">86</span>   <span class="mf">0.005</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">87</span>   <span class="mf">0.005</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">88</span>   <span class="mf">0.004</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">89</span>   <span class="mf">0.004</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">90</span>   <span class="mf">0.004</span> <span class="p">(</span><span class="mf">1.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  

<span class="n">Fit</span><span class="p">:</span>
     <span class="n">x</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>           <span class="n">y</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>      <span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="n">k</span><span class="p">],</span><span class="n">p</span><span class="p">)</span>
<span class="o">---------------------------------------</span>
      <span class="mf">0.1</span>    <span class="mf">0.5351</span> <span class="p">(</span><span class="mi">54</span><span class="p">)</span>    <span class="mf">0.5349</span> <span class="p">(</span><span class="mi">54</span><span class="p">)</span>  
      <span class="mf">0.3</span>    <span class="mf">0.6762</span> <span class="p">(</span><span class="mi">67</span><span class="p">)</span>    <span class="mf">0.6768</span> <span class="p">(</span><span class="mi">65</span><span class="p">)</span>  
      <span class="mf">0.5</span>    <span class="mf">0.9227</span> <span class="p">(</span><span class="mi">91</span><span class="p">)</span>    <span class="mf">0.9219</span> <span class="p">(</span><span class="mi">87</span><span class="p">)</span>  
      <span class="mf">0.7</span>     <span class="mf">1.380</span> <span class="p">(</span><span class="mi">13</span><span class="p">)</span>     <span class="mf">1.381</span> <span class="p">(</span><span class="mi">13</span><span class="p">)</span>  
     <span class="mf">0.95</span>     <span class="mf">4.014</span> <span class="p">(</span><span class="mi">40</span><span class="p">)</span>     <span class="mf">4.014</span> <span class="p">(</span><span class="mi">40</span><span class="p">)</span>  

<span class="n">Settings</span><span class="p">:</span>
  <span class="n">svdcut</span><span class="o">/</span><span class="n">n</span> <span class="o">=</span> <span class="mf">1e-12</span><span class="o">/</span><span class="mi">0</span>    <span class="n">tol</span> <span class="o">=</span> <span class="p">(</span><span class="mf">1e-08</span><span class="o">*</span><span class="p">,</span><span class="mf">1e-10</span><span class="p">,</span><span class="mf">1e-10</span><span class="p">)</span>    <span class="p">(</span><span class="n">itns</span><span class="o">/</span><span class="n">time</span> <span class="o">=</span> <span class="mi">8</span><span class="o">/</span><span class="mf">0.1</span><span class="p">)</span>

</pre></div>
</div>
<p>This is a much more plausible fit than than the 5-parameter fit, and gives an
extrapolated value of <code class="docutils literal notranslate"><span class="pre">p[0]=0.489(17)</span></code>. The original data points were
created using  a Taylor expansion with random coefficients, but
with <code class="docutils literal notranslate"><span class="pre">p[0]</span></code> set equal to <code class="docutils literal notranslate"><span class="pre">0.5</span></code>. So this fit to the five data points (plus
91 <em>a priori</em> values for the <code class="docutils literal notranslate"><span class="pre">p[n]</span></code> with <code class="docutils literal notranslate"><span class="pre">n&lt;91</span></code>) gives the correct
result.  Increasing the number of terms further would have no effect since the
last terms added are having no impact, and so end up equal to the prior value
—  the fit data are not sufficiently precise to add new information about
these parameters.</p>
</section>
<section id="bayes-factors">
<h2>Bayes Factors<a class="headerlink" href="#bayes-factors" title="Permalink to this heading">¶</a></h2>
<p>We can test our priors for this fit by re-doing the fit with broader and
narrower priors. Setting <code class="docutils literal notranslate"><span class="pre">prior</span> <span class="pre">=</span> <span class="pre">gv.gvar(91</span> <span class="pre">*</span> <span class="pre">['0(3)'])</span></code> gives an excellent
fit,</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Least</span> <span class="n">Square</span> <span class="n">Fit</span><span class="p">:</span>
  <span class="n">chi2</span><span class="o">/</span><span class="n">dof</span> <span class="p">[</span><span class="n">dof</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.039</span> <span class="p">[</span><span class="mi">5</span><span class="p">]</span>    <span class="n">Q</span> <span class="o">=</span> <span class="mi">1</span>    <span class="n">logGBF</span> <span class="o">=</span> <span class="o">-</span><span class="mf">5.0993</span>

<span class="n">Parameters</span><span class="p">:</span>
              <span class="mi">0</span>      <span class="mf">0.490</span> <span class="p">(</span><span class="mi">33</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">1</span>       <span class="mf">0.38</span> <span class="p">(</span><span class="mi">48</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">2</span>       <span class="mf">0.6</span> <span class="p">(</span><span class="mf">1.8</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">3</span>       <span class="mf">0.5</span> <span class="p">(</span><span class="mf">2.4</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">4</span>       <span class="mf">0.3</span> <span class="p">(</span><span class="mf">2.6</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">5</span>       <span class="mf">0.2</span> <span class="p">(</span><span class="mf">2.6</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">6</span>       <span class="mf">0.1</span> <span class="p">(</span><span class="mf">2.7</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">7</span>       <span class="mf">0.1</span> <span class="p">(</span><span class="mf">2.8</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">8</span>       <span class="mf">0.2</span> <span class="p">(</span><span class="mf">2.8</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">9</span>       <span class="mf">0.2</span> <span class="p">(</span><span class="mf">2.9</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">10</span>       <span class="mf">0.2</span> <span class="p">(</span><span class="mf">2.9</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">11</span>       <span class="mf">0.2</span> <span class="p">(</span><span class="mf">2.9</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">12</span>       <span class="mf">0.2</span> <span class="p">(</span><span class="mf">2.9</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">13</span>       <span class="mf">0.2</span> <span class="p">(</span><span class="mf">2.9</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">14</span>       <span class="mf">0.2</span> <span class="p">(</span><span class="mf">2.9</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">15</span>       <span class="mf">0.2</span> <span class="p">(</span><span class="mf">2.9</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">16</span>       <span class="mf">0.2</span> <span class="p">(</span><span class="mf">2.9</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">17</span>       <span class="mf">0.2</span> <span class="p">(</span><span class="mf">2.9</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">18</span>       <span class="mf">0.2</span> <span class="p">(</span><span class="mf">2.9</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">19</span>       <span class="mf">0.2</span> <span class="p">(</span><span class="mf">2.9</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">20</span>       <span class="mf">0.1</span> <span class="p">(</span><span class="mf">2.9</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">21</span>       <span class="mf">0.1</span> <span class="p">(</span><span class="mf">2.9</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">22</span>       <span class="mf">0.1</span> <span class="p">(</span><span class="mf">2.9</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">23</span>       <span class="mf">0.1</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">24</span>       <span class="mf">0.1</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">25</span>       <span class="mf">0.1</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">26</span>       <span class="mf">0.1</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">27</span>       <span class="mf">0.1</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">28</span>       <span class="mf">0.1</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">29</span>       <span class="mf">0.1</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">30</span>     <span class="mf">0.09</span> <span class="p">(</span><span class="mf">2.98</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">31</span>     <span class="mf">0.09</span> <span class="p">(</span><span class="mf">2.98</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">32</span>     <span class="mf">0.08</span> <span class="p">(</span><span class="mf">2.98</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">33</span>     <span class="mf">0.08</span> <span class="p">(</span><span class="mf">2.98</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">34</span>     <span class="mf">0.07</span> <span class="p">(</span><span class="mf">2.99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">35</span>     <span class="mf">0.07</span> <span class="p">(</span><span class="mf">2.99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">36</span>     <span class="mf">0.07</span> <span class="p">(</span><span class="mf">2.99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">37</span>     <span class="mf">0.06</span> <span class="p">(</span><span class="mf">2.99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">38</span>     <span class="mf">0.06</span> <span class="p">(</span><span class="mf">2.99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">39</span>     <span class="mf">0.06</span> <span class="p">(</span><span class="mf">2.99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">40</span>     <span class="mf">0.05</span> <span class="p">(</span><span class="mf">2.99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">41</span>     <span class="mf">0.05</span> <span class="p">(</span><span class="mf">2.99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">42</span>     <span class="mf">0.05</span> <span class="p">(</span><span class="mf">2.99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">43</span>     <span class="mf">0.05</span> <span class="p">(</span><span class="mf">2.99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">44</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mf">2.99</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">45</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">46</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">47</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">48</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">49</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">50</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">51</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">52</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">53</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">54</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">55</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">56</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">57</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">58</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">59</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">60</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">61</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">62</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">63</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">64</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">65</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">66</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">67</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">68</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">69</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">70</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">71</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">72</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">73</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mf">3.00</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">74</span>   <span class="mf">0.009</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">75</span>   <span class="mf">0.009</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">76</span>   <span class="mf">0.009</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">77</span>   <span class="mf">0.008</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">78</span>   <span class="mf">0.008</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">79</span>   <span class="mf">0.007</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">80</span>   <span class="mf">0.007</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">81</span>   <span class="mf">0.007</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">82</span>   <span class="mf">0.006</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">83</span>   <span class="mf">0.006</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">84</span>   <span class="mf">0.006</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">85</span>   <span class="mf">0.005</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">86</span>   <span class="mf">0.005</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">87</span>   <span class="mf">0.005</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">88</span>   <span class="mf">0.005</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">89</span>   <span class="mf">0.004</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">90</span>   <span class="mf">0.004</span> <span class="p">(</span><span class="mf">3.000</span><span class="p">)</span>      <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span> <span class="p">]</span>  

<span class="n">Fit</span><span class="p">:</span>
     <span class="n">x</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>           <span class="n">y</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>      <span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="n">k</span><span class="p">],</span><span class="n">p</span><span class="p">)</span>
<span class="o">---------------------------------------</span>
      <span class="mf">0.1</span>    <span class="mf">0.5351</span> <span class="p">(</span><span class="mi">54</span><span class="p">)</span>    <span class="mf">0.5351</span> <span class="p">(</span><span class="mi">54</span><span class="p">)</span>  
      <span class="mf">0.3</span>    <span class="mf">0.6762</span> <span class="p">(</span><span class="mi">67</span><span class="p">)</span>    <span class="mf">0.6763</span> <span class="p">(</span><span class="mi">67</span><span class="p">)</span>  
      <span class="mf">0.5</span>    <span class="mf">0.9227</span> <span class="p">(</span><span class="mi">91</span><span class="p">)</span>    <span class="mf">0.9226</span> <span class="p">(</span><span class="mi">91</span><span class="p">)</span>  
      <span class="mf">0.7</span>     <span class="mf">1.380</span> <span class="p">(</span><span class="mi">13</span><span class="p">)</span>     <span class="mf">1.380</span> <span class="p">(</span><span class="mi">13</span><span class="p">)</span>  
     <span class="mf">0.95</span>     <span class="mf">4.014</span> <span class="p">(</span><span class="mi">40</span><span class="p">)</span>     <span class="mf">4.014</span> <span class="p">(</span><span class="mi">40</span><span class="p">)</span>  

<span class="n">Settings</span><span class="p">:</span>
  <span class="n">svdcut</span><span class="o">/</span><span class="n">n</span> <span class="o">=</span> <span class="mf">1e-12</span><span class="o">/</span><span class="mi">0</span>    <span class="n">tol</span> <span class="o">=</span> <span class="p">(</span><span class="mf">1e-08</span><span class="p">,</span><span class="mf">1e-10</span><span class="o">*</span><span class="p">,</span><span class="mf">1e-10</span><span class="p">)</span>    <span class="p">(</span><span class="n">itns</span><span class="o">/</span><span class="n">time</span> <span class="o">=</span> <span class="mi">9</span><span class="o">/</span><span class="mf">0.1</span><span class="p">)</span>

</pre></div>
</div>
<p>but with a very small <code class="docutils literal notranslate"><span class="pre">chi2/dof</span></code> and somewhat larger errors on the best-fit
estimates for the parameters. The logarithm of the (Gaussian) Bayes Factor,
<code class="docutils literal notranslate"><span class="pre">logGBF</span></code>, can be used to compare fits with different priors. It is the
logarithm of the probability that our data would come from parameters
generated at random using the prior. The exponential of <code class="docutils literal notranslate"><span class="pre">logGBF</span></code> is
more than 100 times larger with the original priors of <code class="docutils literal notranslate"><span class="pre">0(1)</span></code> than with
priors of <code class="docutils literal notranslate"><span class="pre">0(3)</span></code>. This says that our data is more than 100 times more
likely to come from a world with parameters of order one than from one with
parameters of order three. Put another way it says that
the size of the fluctuations in the data
are more consistent with coefficients of order one than with coefficients of
order three — in the latter case, there would have been larger
fluctuations in the data than are actually seen.
The <code class="docutils literal notranslate"><span class="pre">logGBF</span></code> values argue for the original prior.</p>
<p>Narrower priors, <code class="docutils literal notranslate"><span class="pre">prior</span> <span class="pre">=</span> <span class="pre">gv.gvar(91</span> <span class="pre">*</span> <span class="pre">['0.0(3)'])</span></code>, give a poor fit,
and also a less optimal <code class="docutils literal notranslate"><span class="pre">logGBF</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Least</span> <span class="n">Square</span> <span class="n">Fit</span><span class="p">:</span>
  <span class="n">chi2</span><span class="o">/</span><span class="n">dof</span> <span class="p">[</span><span class="n">dof</span><span class="p">]</span> <span class="o">=</span> <span class="mf">3.7</span> <span class="p">[</span><span class="mi">5</span><span class="p">]</span>    <span class="n">Q</span> <span class="o">=</span> <span class="mf">0.0024</span>    <span class="n">logGBF</span> <span class="o">=</span> <span class="o">-</span><span class="mf">3.3058</span>

<span class="n">Parameters</span><span class="p">:</span>
              <span class="mi">0</span>    <span class="mf">0.484</span> <span class="p">(</span><span class="mi">11</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  <span class="o">*</span>
              <span class="mi">1</span>    <span class="mf">0.454</span> <span class="p">(</span><span class="mi">98</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  <span class="o">*</span>
              <span class="mi">2</span>     <span class="mf">0.50</span> <span class="p">(</span><span class="mi">23</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  <span class="o">*</span>
              <span class="mi">3</span>     <span class="mf">0.40</span> <span class="p">(</span><span class="mi">25</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  <span class="o">*</span>
              <span class="mi">4</span>     <span class="mf">0.31</span> <span class="p">(</span><span class="mi">26</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  <span class="o">*</span>
              <span class="mi">5</span>     <span class="mf">0.26</span> <span class="p">(</span><span class="mi">27</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">6</span>     <span class="mf">0.23</span> <span class="p">(</span><span class="mi">28</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">7</span>     <span class="mf">0.21</span> <span class="p">(</span><span class="mi">29</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">8</span>     <span class="mf">0.21</span> <span class="p">(</span><span class="mi">29</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
              <span class="mi">9</span>     <span class="mf">0.20</span> <span class="p">(</span><span class="mi">29</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">10</span>     <span class="mf">0.19</span> <span class="p">(</span><span class="mi">29</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">11</span>     <span class="mf">0.19</span> <span class="p">(</span><span class="mi">29</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">12</span>     <span class="mf">0.18</span> <span class="p">(</span><span class="mi">29</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">13</span>     <span class="mf">0.17</span> <span class="p">(</span><span class="mi">29</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">14</span>     <span class="mf">0.17</span> <span class="p">(</span><span class="mi">29</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">15</span>     <span class="mf">0.16</span> <span class="p">(</span><span class="mi">29</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">16</span>     <span class="mf">0.15</span> <span class="p">(</span><span class="mi">29</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">17</span>     <span class="mf">0.15</span> <span class="p">(</span><span class="mi">29</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">18</span>     <span class="mf">0.14</span> <span class="p">(</span><span class="mi">29</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">19</span>     <span class="mf">0.13</span> <span class="p">(</span><span class="mi">29</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">20</span>     <span class="mf">0.13</span> <span class="p">(</span><span class="mi">29</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">21</span>     <span class="mf">0.12</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">22</span>     <span class="mf">0.11</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">23</span>     <span class="mf">0.11</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">24</span>     <span class="mf">0.10</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">25</span>     <span class="mf">0.10</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">26</span>     <span class="mf">0.09</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">27</span>     <span class="mf">0.09</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">28</span>     <span class="mf">0.08</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">29</span>     <span class="mf">0.08</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">30</span>     <span class="mf">0.08</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">31</span>     <span class="mf">0.07</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">32</span>     <span class="mf">0.07</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">33</span>     <span class="mf">0.07</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">34</span>     <span class="mf">0.06</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">35</span>     <span class="mf">0.06</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">36</span>     <span class="mf">0.06</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">37</span>     <span class="mf">0.05</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">38</span>     <span class="mf">0.05</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">39</span>     <span class="mf">0.05</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">40</span>     <span class="mf">0.05</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">41</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">42</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">43</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">44</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">45</span>     <span class="mf">0.04</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">46</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">47</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">48</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">49</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">50</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">51</span>     <span class="mf">0.03</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">52</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">53</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">54</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">55</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">56</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">57</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">58</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">59</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">60</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">61</span>     <span class="mf">0.02</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">62</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">63</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">64</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">65</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">66</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">67</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">68</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">69</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">70</span>     <span class="mf">0.01</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">71</span>   <span class="mf">0.009</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">72</span>   <span class="mf">0.009</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">73</span>   <span class="mf">0.008</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">74</span>   <span class="mf">0.008</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">75</span>   <span class="mf">0.008</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">76</span>   <span class="mf">0.007</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">77</span>   <span class="mf">0.007</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">78</span>   <span class="mf">0.006</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">79</span>   <span class="mf">0.006</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">80</span>   <span class="mf">0.006</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">81</span>   <span class="mf">0.006</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">82</span>   <span class="mf">0.005</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">83</span>   <span class="mf">0.005</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">84</span>   <span class="mf">0.005</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">85</span>   <span class="mf">0.005</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">86</span>   <span class="mf">0.004</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">87</span>   <span class="mf">0.004</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">88</span>   <span class="mf">0.004</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">89</span>   <span class="mf">0.004</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  
             <span class="mi">90</span>   <span class="mf">0.003</span> <span class="p">(</span><span class="mi">300</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.00</span> <span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="p">]</span>  

<span class="n">Fit</span><span class="p">:</span>
     <span class="n">x</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>           <span class="n">y</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>      <span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="n">k</span><span class="p">],</span><span class="n">p</span><span class="p">)</span>
<span class="o">---------------------------------------</span>
      <span class="mf">0.1</span>    <span class="mf">0.5351</span> <span class="p">(</span><span class="mi">54</span><span class="p">)</span>    <span class="mf">0.5344</span> <span class="p">(</span><span class="mi">53</span><span class="p">)</span>  
      <span class="mf">0.3</span>    <span class="mf">0.6762</span> <span class="p">(</span><span class="mi">67</span><span class="p">)</span>    <span class="mf">0.6787</span> <span class="p">(</span><span class="mi">56</span><span class="p">)</span>  
      <span class="mf">0.5</span>    <span class="mf">0.9227</span> <span class="p">(</span><span class="mi">91</span><span class="p">)</span>    <span class="mf">0.9191</span> <span class="p">(</span><span class="mi">75</span><span class="p">)</span>  
      <span class="mf">0.7</span>     <span class="mf">1.380</span> <span class="p">(</span><span class="mi">13</span><span class="p">)</span>     <span class="mf">1.382</span> <span class="p">(</span><span class="mi">13</span><span class="p">)</span>  
     <span class="mf">0.95</span>     <span class="mf">4.014</span> <span class="p">(</span><span class="mi">40</span><span class="p">)</span>     <span class="mf">4.008</span> <span class="p">(</span><span class="mi">40</span><span class="p">)</span>  

<span class="n">Settings</span><span class="p">:</span>
  <span class="n">svdcut</span><span class="o">/</span><span class="n">n</span> <span class="o">=</span> <span class="mf">1e-12</span><span class="o">/</span><span class="mi">0</span>    <span class="n">tol</span> <span class="o">=</span> <span class="p">(</span><span class="mf">1e-08</span><span class="o">*</span><span class="p">,</span><span class="mf">1e-10</span><span class="p">,</span><span class="mf">1e-10</span><span class="p">)</span>    <span class="p">(</span><span class="n">itns</span><span class="o">/</span><span class="n">time</span> <span class="o">=</span> <span class="mi">6</span><span class="o">/</span><span class="mf">0.1</span><span class="p">)</span>

</pre></div>
</div>
<p>Setting <code class="docutils literal notranslate"><span class="pre">prior</span> <span class="pre">=</span> <span class="pre">gv.gvar(91</span> <span class="pre">*</span> <span class="pre">['0(20)'])</span></code> gives very wide priors and
a rather strange looking fit:</p>
<a class="reference internal image-reference" href="_images/eg-appendix1d.png"><img alt="_images/eg-appendix1d.png" src="_images/eg-appendix1d.png" style="width: 80%;" /></a>
<p>Here fit errors are comparable to the data errors at the data points, as you
would expect, but balloon up in between. This is an example of
<em>over-fitting</em>: the data and priors are not sufficiently accurate to fit the
number of parameters used. Specifically the priors are too broad.
Again the Bayes Factor signals the problem: <code class="docutils literal notranslate"><span class="pre">logGBF</span> <span class="pre">=</span> <span class="pre">-14.479</span></code> here, which
means that our data are roughly a million times (<code class="docutils literal notranslate"><span class="pre">=exp(14)</span></code>) more
likely to to come from a world with coefficients of order one than
from one with coefficients of order twenty. That is, the broad priors suggest
much larger
variations between the leading parameters than is indicated by the data —
again, the
data are unnaturally regular in a world described by the very broad prior.</p>
<p>Absent useful <em>a priori</em> information about the parameters, we can sometimes use the
data to suggest a plausible width for a set of priors. We do this by setting
the width equal to the value
that maximizes <code class="docutils literal notranslate"><span class="pre">logGBF</span></code>. This approach suggests priors of <code class="docutils literal notranslate"><span class="pre">0.0(6)</span></code> for
the fit above, which gives results very similar to the fit
with priors of <code class="docutils literal notranslate"><span class="pre">0(1)</span></code>. See <a class="reference internal" href="overview.html#empirical-bayes"><span class="std std-ref">Tuning Priors with the Empirical Bayes Criterion</span></a> for more details.</p>
<p>The priors are responsible for about half of the final error in our best
estimate of <code class="docutils literal notranslate"><span class="pre">p[0]</span></code> (with priors of <code class="docutils literal notranslate"><span class="pre">0(1)</span></code>); the rest comes from the
uncertainty in the data. This can be  established by creating an error budget
using the code</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">inputs</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">prior</span><span class="o">=</span><span class="n">prior</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="n">y</span><span class="p">)</span>
<span class="n">outputs</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">p0</span><span class="o">=</span><span class="n">fit</span><span class="o">.</span><span class="n">p</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="n">gv</span><span class="o">.</span><span class="n">fmt_errorbudget</span><span class="p">(</span><span class="n">inputs</span><span class="o">=</span><span class="n">inputs</span><span class="p">,</span> <span class="n">outputs</span><span class="o">=</span><span class="n">outputs</span><span class="p">))</span>
</pre></div>
</div>
<p>which prints the following table:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Partial</span> <span class="o">%</span> <span class="n">Errors</span><span class="p">:</span>
                  <span class="n">p0</span>
<span class="o">--------------------</span>
        <span class="n">y</span><span class="p">:</span>      <span class="mf">2.67</span>
    <span class="n">prior</span><span class="p">:</span>      <span class="mf">2.23</span>
<span class="o">--------------------</span>
    <span class="n">total</span><span class="p">:</span>      <span class="mf">3.48</span>

</pre></div>
</div>
<p>The table shows that the final 3.5% error comes from a 2.7% error due
to uncertainties in <code class="docutils literal notranslate"><span class="pre">y</span></code> and a 2.2% error from uncertainties in the
prior (added in quadrature).</p>
</section>
<section id="another-solution-marginalization">
<h2>Another Solution — Marginalization<a class="headerlink" href="#another-solution-marginalization" title="Permalink to this heading">¶</a></h2>
<p>There is a second, equivalent way of fitting this data that illustrates the
idea of <em>marginalization.</em> We really only care about parameter <code class="docutils literal notranslate"><span class="pre">p[0]</span></code> in
our fit. This suggests that we remove <code class="docutils literal notranslate"><span class="pre">n&gt;0</span></code> terms from the data <em>before</em>
we do the fit:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ymod</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">y</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">-</span> <span class="n">sum_n</span><span class="o">=</span><span class="mf">1.</span><span class="o">..</span><span class="n">inf</span> <span class="n">prior</span><span class="p">[</span><span class="n">n</span><span class="p">]</span> <span class="o">*</span> <span class="n">x</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">**</span> <span class="n">n</span>
</pre></div>
</div>
<p>Before the fit, our best estimate for the parameters is from the priors. We
use these to create an estimate for the correction to each data point
coming from <code class="docutils literal notranslate"><span class="pre">n&gt;0</span></code> terms in <code class="docutils literal notranslate"><span class="pre">y(x)</span></code>. This new data, <code class="docutils literal notranslate"><span class="pre">ymod[i]</span></code>,
should be fit with
a new fitting function, <code class="docutils literal notranslate"><span class="pre">ymod(x)</span> <span class="pre">=</span> <span class="pre">p[0]</span></code> — that is, it should be fit
to a constant, independent of <code class="docutils literal notranslate"><span class="pre">x[i]</span></code>. The last three lines of the code
above are easily modified to implement this idea:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">gvar</span> <span class="k">as</span> <span class="nn">gv</span>
<span class="kn">import</span> <span class="nn">lsqfit</span>

<span class="c1"># fit data</span>
<span class="n">y</span> <span class="o">=</span> <span class="n">gv</span><span class="o">.</span><span class="n">gvar</span><span class="p">([</span>
   <span class="s1">&#39;0.5351(54)&#39;</span><span class="p">,</span> <span class="s1">&#39;0.6762(67)&#39;</span><span class="p">,</span> <span class="s1">&#39;0.9227(91)&#39;</span><span class="p">,</span> <span class="s1">&#39;1.3803(131)&#39;</span><span class="p">,</span> <span class="s1">&#39;4.0145(399)&#39;</span>
   <span class="p">])</span>
<span class="n">x</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.1</span><span class="p">,</span> <span class="mf">0.3</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.7</span><span class="p">,</span> <span class="mf">0.95</span><span class="p">])</span>

<span class="c1"># fit function</span>
<span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">p</span><span class="p">):</span>
   <span class="k">return</span> <span class="nb">sum</span><span class="p">(</span><span class="n">pn</span> <span class="o">*</span> <span class="n">x</span> <span class="o">**</span> <span class="n">n</span> <span class="k">for</span> <span class="n">n</span><span class="p">,</span> <span class="n">pn</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">p</span><span class="p">))</span>

<span class="c1"># prior for the fit</span>
<span class="n">prior</span> <span class="o">=</span> <span class="n">gv</span><span class="o">.</span><span class="n">gvar</span><span class="p">(</span><span class="mi">91</span> <span class="o">*</span> <span class="p">[</span><span class="s1">&#39;0(1)&#39;</span><span class="p">])</span>

<span class="c1"># marginalize all but one parameter (p[0])</span>
<span class="n">priormod</span> <span class="o">=</span> <span class="n">prior</span><span class="p">[:</span><span class="mi">1</span><span class="p">]</span>                       <span class="c1"># restrict fit to p[0]</span>
<span class="n">ymod</span> <span class="o">=</span> <span class="n">y</span> <span class="o">-</span> <span class="p">(</span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">prior</span><span class="p">)</span> <span class="o">-</span> <span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">priormod</span><span class="p">))</span>  <span class="c1"># correct y</span>

<span class="n">fit</span> <span class="o">=</span> <span class="n">lsqfit</span><span class="o">.</span><span class="n">nonlinear_fit</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">ymod</span><span class="p">),</span> <span class="n">prior</span><span class="o">=</span><span class="n">priormod</span><span class="p">,</span> <span class="n">fcn</span><span class="o">=</span><span class="n">f</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">fit</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">maxline</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span>
</pre></div>
</div>
<p>Running this code give:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Least</span> <span class="n">Square</span> <span class="n">Fit</span><span class="p">:</span>
  <span class="n">chi2</span><span class="o">/</span><span class="n">dof</span> <span class="p">[</span><span class="n">dof</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.35</span> <span class="p">[</span><span class="mi">5</span><span class="p">]</span>    <span class="n">Q</span> <span class="o">=</span> <span class="mf">0.88</span>    <span class="n">logGBF</span> <span class="o">=</span> <span class="o">-</span><span class="mf">0.45508</span>

<span class="n">Parameters</span><span class="p">:</span>
              <span class="mi">0</span>   <span class="mf">0.489</span> <span class="p">(</span><span class="mi">17</span><span class="p">)</span>     <span class="p">[</span>  <span class="mf">0.0</span> <span class="p">(</span><span class="mf">1.0</span><span class="p">)</span> <span class="p">]</span>  

<span class="n">Fit</span><span class="p">:</span>
     <span class="n">x</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>         <span class="n">y</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>     <span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="n">k</span><span class="p">],</span><span class="n">p</span><span class="p">)</span>
<span class="o">------------------------------------</span>
      <span class="mf">0.1</span>    <span class="mf">0.54</span> <span class="p">(</span><span class="mi">10</span><span class="p">)</span>    <span class="mf">0.489</span> <span class="p">(</span><span class="mi">17</span><span class="p">)</span>  
      <span class="mf">0.3</span>    <span class="mf">0.68</span> <span class="p">(</span><span class="mi">31</span><span class="p">)</span>    <span class="mf">0.489</span> <span class="p">(</span><span class="mi">17</span><span class="p">)</span>  
      <span class="mf">0.5</span>    <span class="mf">0.92</span> <span class="p">(</span><span class="mi">58</span><span class="p">)</span>    <span class="mf">0.489</span> <span class="p">(</span><span class="mi">17</span><span class="p">)</span>  
      <span class="mf">0.7</span>    <span class="mf">1.38</span> <span class="p">(</span><span class="mi">98</span><span class="p">)</span>    <span class="mf">0.489</span> <span class="p">(</span><span class="mi">17</span><span class="p">)</span>  
     <span class="mf">0.95</span>    <span class="mf">4.0</span> <span class="p">(</span><span class="mf">3.0</span><span class="p">)</span>    <span class="mf">0.489</span> <span class="p">(</span><span class="mi">17</span><span class="p">)</span>  <span class="o">*</span>

<span class="n">Settings</span><span class="p">:</span>
  <span class="n">svdcut</span><span class="o">/</span><span class="n">n</span> <span class="o">=</span> <span class="mf">1e-12</span><span class="o">/</span><span class="mi">0</span>    <span class="n">tol</span> <span class="o">=</span> <span class="p">(</span><span class="mf">1e-08</span><span class="o">*</span><span class="p">,</span><span class="mf">1e-10</span><span class="p">,</span><span class="mf">1e-10</span><span class="p">)</span>    <span class="p">(</span><span class="n">itns</span><span class="o">/</span><span class="n">time</span> <span class="o">=</span> <span class="mi">4</span><span class="o">/</span><span class="mf">0.0</span><span class="p">)</span>

</pre></div>
</div>
<p>Remarkably this one-parameter fit gives results for <code class="docutils literal notranslate"><span class="pre">p[0]</span></code>
that are identical (to
machine precision) to our 91-parameter fit above. The 90 parameters for
<code class="docutils literal notranslate"><span class="pre">n&gt;0</span></code> are said to have been <em>marginalized</em> in this fit.
Marginalizing a parameter
in this way has no effect if the fit function is linear in that parameter.
Marginalization has almost no effect for nonlinear fits as well,
provided the fit data have small errors (in which case the parameters are
effectively linear). The fit here is:</p>
<a class="reference internal image-reference" href="_images/eg-appendix1c.png"><img alt="_images/eg-appendix1c.png" src="_images/eg-appendix1c.png" style="width: 80%;" /></a>
<p>The constant is consistent with all of the data in <code class="docutils literal notranslate"><span class="pre">ymod[i]</span></code>,
even at <code class="docutils literal notranslate"><span class="pre">x[i]=0.95</span></code>, because <code class="docutils literal notranslate"><span class="pre">ymod[i]</span></code> has much larger errors for
larger <code class="docutils literal notranslate"><span class="pre">x[i]</span></code> because of the correction terms.</p>
<p>Fitting to a constant is equivalent to doing a weighted average of the
data plus the prior, so our fit can be replaced by an average:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">lsqfit</span><span class="o">.</span><span class="n">wavg</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">ymod</span><span class="p">)</span> <span class="o">+</span> <span class="nb">list</span><span class="p">(</span><span class="n">priormod</span><span class="p">))</span>
</pre></div>
</div>
<p>This again gives <code class="docutils literal notranslate"><span class="pre">0.489(17)</span></code> for our final result.
Note that the central value for this average is below the central
values for every data point in <code class="docutils literal notranslate"><span class="pre">ymod[i]</span></code>. This is a consequence of large
positive correlations introduced into <code class="docutils literal notranslate"><span class="pre">ymod</span></code> when we remove the
<code class="docutils literal notranslate"><span class="pre">n&gt;0</span></code> terms. These correlations are captured automatically in our code,
and are essential — removing the correlations between different
<code class="docutils literal notranslate"><span class="pre">ymod</span></code>s results in a final answer, <code class="docutils literal notranslate"><span class="pre">0.564(97)</span></code>, which has a much
larger error.</p>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <div>
    <h3><a href="index.html">Table of Contents</a></h3>
    <ul>
<li><a class="reference internal" href="#">Case Study: Simple Extrapolation</a><ul>
<li><a class="reference internal" href="#the-problem">The Problem</a></li>
<li><a class="reference internal" href="#a-bad-solution">A Bad Solution</a></li>
<li><a class="reference internal" href="#a-better-solution-priors">A Better Solution — Priors</a></li>
<li><a class="reference internal" href="#bayes-factors">Bayes Factors</a></li>
<li><a class="reference internal" href="#another-solution-marginalization">Another Solution — Marginalization</a></li>
</ul>
</li>
</ul>

  </div>
  <div>
    <h4>Previous topic</h4>
    <p class="topless"><a href="testing.html"
                          title="previous chapter">Non-Gaussian Behavior; Testing Fits</a></p>
  </div>
  <div>
    <h4>Next topic</h4>
    <p class="topless"><a href="case-pendulum.html"
                          title="next chapter">Case Study: Numerical Analysis inside a Fit</a></p>
  </div>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/case-extrapolation.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="case-pendulum.html" title="Case Study: Numerical Analysis inside a Fit"
             >next</a> |</li>
        <li class="right" >
          <a href="testing.html" title="Non-Gaussian Behavior; Testing Fits"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">lsqfit 13.0.1 documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">Case Study: Simple Extrapolation</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2009-2019, G. P. Lepage.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.0.2.
    </div>
  </body>
</html>