<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>scipy.stats.argus — SciPy v1.1.0.dev0+4e64658 Reference Guide</title> <link rel="stylesheet" type="text/css" href="../_static/css/spc-bootstrap.css"> <link rel="stylesheet" type="text/css" href="../_static/css/spc-extend.css"> <link rel="stylesheet" href="../_static/scipy.css" type="text/css" > <link rel="stylesheet" href="../_static/pygments.css" type="text/css" > <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '1.1.0.dev0+4e64658', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: false }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/scipy-mathjax/MathJax.js?config=scipy-mathjax"></script> <script type="text/javascript" src="../_static/js/copybutton.js"></script> <link rel="index" title="Index" href="../genindex.html" > <link rel="search" title="Search" href="../search.html" > <link rel="top" title="SciPy v1.1.0.dev0+4e64658 Reference Guide" href="../index.html" > <link rel="up" title="Statistical functions (scipy.stats)" href="../stats.html" > <link rel="next" title="scipy.stats.beta" href="scipy.stats.beta.html" > <link rel="prev" title="scipy.stats.arcsine" href="scipy.stats.arcsine.html" > </head> <body> <div class="container"> <div class="header"> </div> </div> <div class="container"> <div class="main"> <div class="row-fluid"> <div class="span12"> <div class="spc-navbar"> <ul class="nav nav-pills pull-left"> <li class="active"><a href="../index.html">SciPy v1.1.0.dev0+4e64658 Reference Guide</a></li> <li class="active"><a href="../stats.html" accesskey="U">Statistical functions (<code class="docutils literal"><span class="pre">scipy.stats</span></code>)</a></li> </ul> <ul class="nav nav-pills pull-right"> <li class="active"> <a href="../genindex.html" title="General Index" accesskey="I">index</a> </li> <li class="active"> <a href="../py-modindex.html" title="Python Module Index" >modules</a> </li> <li class="active"> <a href="scipy.stats.beta.html" title="scipy.stats.beta" accesskey="N">next</a> </li> <li class="active"> <a href="scipy.stats.arcsine.html" title="scipy.stats.arcsine" accesskey="P">previous</a> </li> </ul> </div> </div> </div> <div class="row-fluid"> <div class="spc-rightsidebar span3"> <div class="sphinxsidebarwrapper"> <p class="logo"><a href="../index.html"> <img class="logo" src="../_static/scipyshiny_small.png" alt="Logo"> </a></p> <h4>Previous topic</h4> <p class="topless"><a href="scipy.stats.arcsine.html" title="previous chapter">scipy.stats.arcsine</a></p> <h4>Next topic</h4> <p class="topless"><a href="scipy.stats.beta.html" title="next chapter">scipy.stats.beta</a></p> </div> </div> <div class="span9"> <div class="bodywrapper"> <div class="body" id="spc-section-body"> <div class="section" id="scipy-stats-argus"> <h1>scipy.stats.argus<a class="headerlink" href="#scipy-stats-argus" title="Permalink to this headline">¶</a></h1> <dl class="data"> <dt id="scipy.stats.argus"> <code class="descclassname">scipy.stats.</code><code class="descname">argus</code><em class="property"> = <scipy.stats._continuous_distns.argus_gen object></em><a class="reference external" href="https://github.com/scipy/scipy/blob/4e64658/scipy/stats/_continuous_distns.py"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#scipy.stats.argus" title="Permalink to this definition">¶</a></dt> <dd><p>Argus distribution</p> <p>As an instance of the <a class="reference internal" href="scipy.stats.rv_continuous.html#scipy.stats.rv_continuous" title="scipy.stats.rv_continuous"><code class="xref py py-obj docutils literal"><span class="pre">rv_continuous</span></code></a> class, <a class="reference internal" href="#scipy.stats.argus" title="scipy.stats.argus"><code class="xref py py-obj docutils literal"><span class="pre">argus</span></code></a> object inherits from it a collection of generic methods (see below for the full list), and completes them with details specific for this particular distribution.</p> <p class="rubric">Notes</p> <p>The probability density function for <a class="reference internal" href="#scipy.stats.argus" title="scipy.stats.argus"><code class="xref py py-obj docutils literal"><span class="pre">argus</span></code></a> is:</p> <div class="math"> \[ \begin{align}\begin{aligned}f(x, \chi) = \frac{\chi^3}{\sqrt{2\pi} \Psi(\chi)} x \sqrt{1-x^2} \exp(- 0.5 \chi^2 (1 - x^2))\\where:\end{aligned}\end{align} \]</div> <div class="math"> \[\Psi(\chi) = \Phi(\chi) - \chi \phi(\chi) - 1/2\]</div> <p>with <span class="math">\(\Phi\)</span> and <span class="math">\(\phi\)</span> being the CDF and PDF of a standard normal distribution, respectively.</p> <p><a class="reference internal" href="#scipy.stats.argus" title="scipy.stats.argus"><code class="xref py py-obj docutils literal"><span class="pre">argus</span></code></a> takes <span class="math">\(\chi\)</span> as shape a parameter.</p> <p class="rubric">References</p> <table class="docutils citation" frame="void" id="r576" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a class="fn-backref" href="#id1">[R576]</a></td><td>“ARGUS distribution”, <a class="reference external" href="https://en.wikipedia.org/wiki/ARGUS_distribution">https://en.wikipedia.org/wiki/ARGUS_distribution</a></td></tr> </tbody> </table> <p>The probability density above is defined in the “standardized” form. To shift and/or scale the distribution use the <code class="docutils literal"><span class="pre">loc</span></code> and <code class="docutils literal"><span class="pre">scale</span></code> parameters. Specifically, <code class="docutils literal"><span class="pre">argus.pdf(x,</span> <span class="pre">chi,</span> <span class="pre">loc,</span> <span class="pre">scale)</span></code> is identically equivalent to <code class="docutils literal"><span class="pre">argus.pdf(y,</span> <span class="pre">chi)</span> <span class="pre">/</span> <span class="pre">scale</span></code> with <code class="docutils literal"><span class="pre">y</span> <span class="pre">=</span> <span class="pre">(x</span> <span class="pre">-</span> <span class="pre">loc)</span> <span class="pre">/</span> <span class="pre">scale</span></code>.</p> <div class="versionadded"> <p><span class="versionmodified">New in version 0.19.0.</span></p> </div> <p class="rubric">Examples</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">scipy.stats</span> <span class="k">import</span> <span class="n">argus</span> <span class="gp">>>> </span><span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span> <span class="gp">>>> </span><span class="n">fig</span><span class="p">,</span> <span class="n">ax</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplots</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> </pre></div> </div> <p>Calculate a few first moments:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">chi</span> <span class="o">=</span> <span class="mi">1</span> <span class="gp">>>> </span><span class="n">mean</span><span class="p">,</span> <span class="n">var</span><span class="p">,</span> <span class="n">skew</span><span class="p">,</span> <span class="n">kurt</span> <span class="o">=</span> <span class="n">argus</span><span class="o">.</span><span class="n">stats</span><span class="p">(</span><span class="n">chi</span><span class="p">,</span> <span class="n">moments</span><span class="o">=</span><span class="s1">'mvsk'</span><span class="p">)</span> </pre></div> </div> <p>Display the probability density function (<code class="docutils literal"><span class="pre">pdf</span></code>):</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="n">argus</span><span class="o">.</span><span class="n">ppf</span><span class="p">(</span><span class="mf">0.01</span><span class="p">,</span> <span class="n">chi</span><span class="p">),</span> <span class="gp">... </span> <span class="n">argus</span><span class="o">.</span><span class="n">ppf</span><span class="p">(</span><span class="mf">0.99</span><span class="p">,</span> <span class="n">chi</span><span class="p">),</span> <span class="mi">100</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">argus</span><span class="o">.</span><span class="n">pdf</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">chi</span><span class="p">),</span> <span class="gp">... </span> <span class="s1">'r-'</span><span class="p">,</span> <span class="n">lw</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s1">'argus pdf'</span><span class="p">)</span> </pre></div> </div> <p>Alternatively, the distribution object can be called (as a function) to fix the shape, location and scale parameters. This returns a “frozen” RV object holding the given parameters fixed.</p> <p>Freeze the distribution and display the frozen <code class="docutils literal"><span class="pre">pdf</span></code>:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">rv</span> <span class="o">=</span> <span class="n">argus</span><span class="p">(</span><span class="n">chi</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">rv</span><span class="o">.</span><span class="n">pdf</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="s1">'k-'</span><span class="p">,</span> <span class="n">lw</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s1">'frozen pdf'</span><span class="p">)</span> </pre></div> </div> <p>Check accuracy of <code class="docutils literal"><span class="pre">cdf</span></code> and <code class="docutils literal"><span class="pre">ppf</span></code>:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">vals</span> <span class="o">=</span> <span class="n">argus</span><span class="o">.</span><span class="n">ppf</span><span class="p">([</span><span class="mf">0.001</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.999</span><span class="p">],</span> <span class="n">chi</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">np</span><span class="o">.</span><span class="n">allclose</span><span class="p">([</span><span class="mf">0.001</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.999</span><span class="p">],</span> <span class="n">argus</span><span class="o">.</span><span class="n">cdf</span><span class="p">(</span><span class="n">vals</span><span class="p">,</span> <span class="n">chi</span><span class="p">))</span> <span class="go">True</span> </pre></div> </div> <p>Generate random numbers:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">r</span> <span class="o">=</span> <span class="n">argus</span><span class="o">.</span><span class="n">rvs</span><span class="p">(</span><span class="n">chi</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">1000</span><span class="p">)</span> </pre></div> </div> <p>And compare the histogram:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">ax</span><span class="o">.</span><span class="n">hist</span><span class="p">(</span><span class="n">r</span><span class="p">,</span> <span class="n">normed</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">histtype</span><span class="o">=</span><span class="s1">'stepfilled'</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.2</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">ax</span><span class="o">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s1">'best'</span><span class="p">,</span> <span class="n">frameon</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span> </pre></div> </div> <div class="figure"> <img alt="../_images/scipy-stats-argus-1.png" src="../_images/scipy-stats-argus-1.png" /> </div> <p class="rubric">Methods</p> <table border="1" class="docutils"> <colgroup> <col width="51%" /> <col width="49%" /> </colgroup> <tbody valign="top"> <tr class="row-odd"><td><code class="docutils literal"><span class="pre">rvs(chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1,</span> <span class="pre">size=1,</span> <span class="pre">random_state=None)</span></code></td> <td>Random variates.</td> </tr> <tr class="row-even"><td><code class="docutils literal"><span class="pre">pdf(x,</span> <span class="pre">chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Probability density function.</td> </tr> <tr class="row-odd"><td><code class="docutils literal"><span class="pre">logpdf(x,</span> <span class="pre">chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Log of the probability density function.</td> </tr> <tr class="row-even"><td><code class="docutils literal"><span class="pre">cdf(x,</span> <span class="pre">chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Cumulative distribution function.</td> </tr> <tr class="row-odd"><td><code class="docutils literal"><span class="pre">logcdf(x,</span> <span class="pre">chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Log of the cumulative distribution function.</td> </tr> <tr class="row-even"><td><code class="docutils literal"><span class="pre">sf(x,</span> <span class="pre">chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Survival function (also defined as <code class="docutils literal"><span class="pre">1</span> <span class="pre">-</span> <span class="pre">cdf</span></code>, but <em class="xref py py-obj">sf</em> is sometimes more accurate).</td> </tr> <tr class="row-odd"><td><code class="docutils literal"><span class="pre">logsf(x,</span> <span class="pre">chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Log of the survival function.</td> </tr> <tr class="row-even"><td><code class="docutils literal"><span class="pre">ppf(q,</span> <span class="pre">chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Percent point function (inverse of <code class="docutils literal"><span class="pre">cdf</span></code> — percentiles).</td> </tr> <tr class="row-odd"><td><code class="docutils literal"><span class="pre">isf(q,</span> <span class="pre">chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Inverse survival function (inverse of <code class="docutils literal"><span class="pre">sf</span></code>).</td> </tr> <tr class="row-even"><td><code class="docutils literal"><span class="pre">moment(n,</span> <span class="pre">chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Non-central moment of order n</td> </tr> <tr class="row-odd"><td><code class="docutils literal"><span class="pre">stats(chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1,</span> <span class="pre">moments='mv')</span></code></td> <td>Mean(‘m’), variance(‘v’), skew(‘s’), and/or kurtosis(‘k’).</td> </tr> <tr class="row-even"><td><code class="docutils literal"><span class="pre">entropy(chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>(Differential) entropy of the RV.</td> </tr> <tr class="row-odd"><td><code class="docutils literal"><span class="pre">fit(data,</span> <span class="pre">chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Parameter estimates for generic data.</td> </tr> <tr class="row-even"><td><code class="docutils literal"><span class="pre">expect(func,</span> <span class="pre">args=(chi,),</span> <span class="pre">loc=0,</span> <span class="pre">scale=1,</span> <span class="pre">lb=None,</span> <span class="pre">ub=None,</span> <span class="pre">conditional=False,</span> <span class="pre">**kwds)</span></code></td> <td>Expected value of a function (of one argument) with respect to the distribution.</td> </tr> <tr class="row-odd"><td><code class="docutils literal"><span class="pre">median(chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Median of the distribution.</td> </tr> <tr class="row-even"><td><code class="docutils literal"><span class="pre">mean(chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Mean of the distribution.</td> </tr> <tr class="row-odd"><td><code class="docutils literal"><span class="pre">var(chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Variance of the distribution.</td> </tr> <tr class="row-even"><td><code class="docutils literal"><span class="pre">std(chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Standard deviation of the distribution.</td> </tr> <tr class="row-odd"><td><code class="docutils literal"><span class="pre">interval(alpha,</span> <span class="pre">chi,</span> <span class="pre">loc=0,</span> <span class="pre">scale=1)</span></code></td> <td>Endpoints of the range that contains alpha percent of the distribution</td> </tr> </tbody> </table> </dd></dl> </div> </div> </div> </div> </div> </div> </div> <div class="container container-navbar-bottom"> <div class="spc-navbar"> </div> </div> <div class="container"> <div class="footer"> <div class="row-fluid"> <ul class="inline pull-left"> <li> © Copyright 2008-2016, The Scipy community. </li> <li> Last updated on Sep 21, 2017. </li> <li> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.6.3. </li> </ul> </div> </div> </div> </body> </html>