| <!DOCTYPE HTML> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (21) on Thu Oct 05 19:54:57 CEST 2023 --> |
| <title>Statistics (Apache SIS 1.4 API)</title> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="dc.created" content="2023-10-05"> |
| <meta name="description" content="declaration: module: org.apache.sis.util, package: org.apache.sis.math, class: Statistics"> |
| <meta name="generator" content="javadoc/ClassWriterImpl"> |
| <meta name="keywords" content="org.apache.sis.math.Statistics class"> |
| <meta name="keywords" content="forSeries()"> |
| <meta name="keywords" content="name()"> |
| <meta name="keywords" content="reset()"> |
| <meta name="keywords" content="accept()"> |
| <meta name="keywords" content="combine()"> |
| <meta name="keywords" content="scale()"> |
| <meta name="keywords" content="countNaN()"> |
| <meta name="keywords" content="count()"> |
| <meta name="keywords" content="minimum()"> |
| <meta name="keywords" content="maximum()"> |
| <meta name="keywords" content="span()"> |
| <meta name="keywords" content="sum()"> |
| <meta name="keywords" content="mean()"> |
| <meta name="keywords" content="rms()"> |
| <meta name="keywords" content="standardDeviation()"> |
| <meta name="keywords" content="differences()"> |
| <meta name="keywords" content="toString()"> |
| <meta name="keywords" content="clone()"> |
| <meta name="keywords" content="hashCode()"> |
| <meta name="keywords" content="equals()"> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../sis.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../../script-dir/jquery-3.6.1.min.js"></script> |
| <script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script> |
| </head> |
| <body class="class-declaration-page"> |
| <script type="text/javascript">var pathtoroot = "../../../../../"; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <div class="flex-box"> |
| <header role="banner" class="flex-header"> |
| <nav role="navigation"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="top-nav" id="navbar-top"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span></button> |
| <div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div> |
| <ul id="navbar-top-firstrow" class="nav-list" title="Navigation"> |
| <li><a href="../../../../../index.html">Overview</a></li> |
| <li><a href="../../../../module-summary.html">Module</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="nav-bar-cell1-rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html#class">Help</a></li> |
| </ul> |
| <ul class="sub-nav-list-small"> |
| <li> |
| <p>Summary:</p> |
| <ul> |
| <li>Nested</li> |
| <li>Field</li> |
| <li><a href="#constructor-summary">Constr</a></li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| </li> |
| <li> |
| <p>Detail:</p> |
| <ul> |
| <li>Field</li> |
| <li><a href="#constructor-detail">Constr</a></li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="sub-nav"> |
| <div id="navbar-sub-list"> |
| <ul class="sub-nav-list"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor-summary">Constr</a> | </li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| <ul class="sub-nav-list"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor-detail">Constr</a> | </li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </div> |
| <div class="nav-list-search"><a href="../../../../../search.html">SEARCH</a> |
| <input type="text" id="search-input" disabled placeholder="Search"> |
| <input type="reset" id="reset-button" disabled value="reset"> |
| </div> |
| </div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <span class="skip-nav" id="skip-navbar-top"></span></nav> |
| </header> |
| <div class="flex-content"> |
| <main role="main"> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="sub-title"><span class="module-label-in-type">Module</span> <a href="../../../../module-summary.html">org.apache.sis.util</a></div> |
| <div class="sub-title"><span class="package-label-in-type">Package</span> <a href="package-summary.html">org.apache.sis.math</a></div> |
| <h1 title="Class Statistics" class="title">Class Statistics</h1> |
| </div> |
| <div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> |
| <div class="inheritance">Statistics</div> |
| </div> |
| <section class="class-description" id="class-description"> |
| <dl class="notes"> |
| <dt>All Implemented Interfaces:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a></code>, <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Cloneable.html" title="class or interface in java.lang" class="external-link">Cloneable</a></code>, <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/DoubleConsumer.html" title="class or interface in java.util.function" class="external-link">DoubleConsumer</a></code>, <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/LongConsumer.html" title="class or interface in java.util.function" class="external-link">LongConsumer</a></code></dd> |
| </dl> |
| <hr> |
| <div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">Statistics</span> |
| <span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> |
| implements <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/DoubleConsumer.html" title="class or interface in java.util.function" class="external-link">DoubleConsumer</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/LongConsumer.html" title="class or interface in java.util.function" class="external-link">LongConsumer</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Cloneable.html" title="class or interface in java.lang" class="external-link">Cloneable</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a></span></div> |
| <div class="block">Holds some statistics derived from a series of sample values. |
| Given a series of <var>y₀</var>, <var>y₁</var>, <var>y₂</var>, <var>y₃</var>, <i>etc…</i> samples, |
| this class computes the <a href="#minimum()">minimum</a>, <a href="#maximum()">maximum</a>, |
| <a href="#mean()">mean</a>, <a href="#rms()">root mean square</a> and |
| <a href="#standardDeviation(boolean)">standard deviation</a> of the given samples. |
| |
| <p>In addition to the statistics on the sample values, this class can optionally compute |
| statistics on the differences between consecutive sample values, i.e. the statistics on |
| <var>y₁</var>-<var>y₀</var>, <var>y₂</var>-<var>y₁</var>, <var>y₃</var>-<var>y₂</var>, <i>etc…</i>, |
| Those statistics can be fetched by a call to <a href="#differences()"><code>differences()</code></a>. |
| They are useful for verifying if the interval between sample values is approximately constant.</p> |
| |
| <p>If the samples are (at least conceptually) the result of some <var>y</var>=<var>f</var>(<var>x</var>) |
| function for <var>x</var> values increasing or decreasing at a constant interval Δ<var>x</var>, |
| then one can get the statistics on the <cite>discrete derivatives</cite> by a call to |
| <code>differences().<a href="#scale(double)">scale</a>(1/Δx)</code>.</p> |
| |
| <p>Statistics are computed on the fly using the |
| <a href="https://en.wikipedia.org/wiki/Kahan_summation_algorithm">Kahan summation algorithm</a> |
| for reducing the numerical errors; the sample values are never stored in memory.</p> |
| |
| <p>An instance of <code>Statistics</code> is initially empty: the <a href="#count()">count</a> of |
| values is set to zero, and all above-cited statistical values are set to <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a>. |
| The statistics are updated every time an <a href="#accept(double)"><code>accept(double)</code></a> method is invoked with a non-NaN |
| value.</p> |
| |
| <h2 id="examples-heading">Examples</h2> |
| The following examples assume that a <var>y</var>=<var>f</var>(<var>x</var>) function |
| is defined. A simple usage is: |
| |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java">Statistics stats = new Statistics("y"); |
| for (int i=0; i<numberOfValues; i++) { |
| stats.accept(f(i)); |
| } |
| System.out.println(stats); |
| </code></pre> |
| </div> |
| |
| |
| Following example computes the statistics on the first and second derivatives |
| in addition to the statistics on the sample values: |
| |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java">final double x₀ = ...; // Put here the x value at i=0 |
| final double Δx = ...; // Put here the interval between x values |
| Statistics stats = Statistics.forSeries("y", "∂y/∂x", "∂²y/∂x²"); |
| for (int i=0; i<numberOfValues; i++) { |
| stats.accept(f(x₀ + i*Δx)); |
| } |
| stats.differences().scale(1/Δx); |
| System.out.println(stats); |
| </code></pre> |
| </div> |
| </div> |
| <dl class="notes"> |
| <dt>Since:</dt> |
| <dd>0.3</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list"> |
| <li><a href="../../../../../serialized-form.html#org.apache.sis.math.Statistics">Serialized Form</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| <section class="summary"> |
| <ul class="summary-list"> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <li> |
| <section class="constructor-summary" id="constructor-summary"> |
| <h2>Constructor Summary</h2> |
| <div class="caption"><span>Constructors</span></div> |
| <div class="summary-table two-column-summary"> |
| <div class="table-header col-first">Constructor</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(java.lang.CharSequence)" class="member-name-link">Statistics</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> name)</code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">Constructs an initially empty set of statistics.</div> |
| </div> |
| <div class="col-constructor-name odd-row-color"><code><a href="#%3Cinit%3E(java.lang.CharSequence,int,int,double,double,double,double,boolean)" class="member-name-link">Statistics</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> name, |
| int countNaN, |
| int count, |
| double minimum, |
| double maximum, |
| double mean, |
| double standardDeviation, |
| boolean allPopulation)</code></div> |
| <div class="col-last odd-row-color"> |
| <div class="block">Constructs a set of statistics initialized to the given values.</div> |
| </div> |
| </div> |
| </section> |
| </li> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <li> |
| <section class="method-summary" id="method-summary"> |
| <h2>Method Summary</h2> |
| <div id="method-summary-table"> |
| <div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab1" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab1', 3)" class="table-tab">Static Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div> |
| <div id="method-summary-table.tabpanel" role="tabpanel"> |
| <div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Method</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#accept(double)" class="member-name-link">accept</a><wbr>(double sample)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Updates statistics for the specified floating-point sample value.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#accept(long)" class="member-name-link">accept</a><wbr>(long sample)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Updates statistics for the specified integer sample value.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="Statistics.html" title="class in org.apache.sis.math">Statistics</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#clone()" class="member-name-link">clone</a>()</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns a clone of this statistics.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#combine(org.apache.sis.math.Statistics)" class="member-name-link">combine</a><wbr>(<a href="Statistics.html" title="class in org.apache.sis.math">Statistics</a> stats)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Updates statistics with all samples from the specified <code>stats</code>.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#count()" class="member-name-link">count</a>()</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns the number of samples, excluding <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> values.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#countNaN()" class="member-name-link">countNaN</a>()</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns the number of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> samples.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="Statistics.html" title="class in org.apache.sis.math">Statistics</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#differences()" class="member-name-link">differences</a>()</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns the statistics on the differences between sample values, or <code>null</code> if none.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#equals(java.lang.Object)" class="member-name-link">equals</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> object)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Compares this statistics with the specified object for equality.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="Statistics.html" title="class in org.apache.sis.math">Statistics</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#forSeries(java.lang.CharSequence,java.lang.CharSequence...)" class="member-name-link">forSeries</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> name, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a>... differenceNames)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Constructs a new <code>Statistics</code> object which will also compute finite differences |
| up to the given order.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#hashCode()" class="member-name-link">hashCode</a>()</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns a hash code value for this statistics.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#maximum()" class="member-name-link">maximum</a>()</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns the maximum sample value, or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> if none.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#mean()" class="member-name-link">mean</a>()</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns the mean value, or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> if none.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#minimum()" class="member-name-link">minimum</a>()</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns the minimum sample value, or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> if none.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/util/InternationalString.html" title="class or interface in org.opengis.util" class="external-link">InternationalString</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#name()" class="member-name-link">name</a>()</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns the name of the phenomenon for which this object is collecting statistics.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#reset()" class="member-name-link">reset</a>()</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Resets this object state as if it was just created.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#rms()" class="member-name-link">rms</a>()</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns the root mean square, or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> if none.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#scale(double)" class="member-name-link">scale</a><wbr>(double factor)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Multiplies the statistics by the given factor.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#span()" class="member-name-link">span</a>()</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Equivalents to <a href="#maximum()">maximum</a> - <a href="#minimum()">minimum</a>.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#standardDeviation(boolean)" class="member-name-link">standardDeviation</a><wbr>(boolean allPopulation)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns the standard deviation.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#sum()" class="member-name-link">sum</a>()</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns the sum, or 0 if none.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#toString()" class="member-name-link">toString</a>()</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns a string representation of this statistics.</div> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="inherited-list"> |
| <h3 id="methods-inherited-from-class-Object">Methods inherited from class <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3> |
| <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div> |
| <div class="inherited-list"> |
| <h3 id="methods-inherited-from-class-DoubleConsumer">Methods inherited from interface <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/DoubleConsumer.html" title="class or interface in java.util.function" class="external-link">DoubleConsumer</a></h3> |
| <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/DoubleConsumer.html#andThen(java.util.function.DoubleConsumer)" title="class or interface in java.util.function" class="external-link">andThen</a></code></div> |
| <div class="inherited-list"> |
| <h3 id="methods-inherited-from-class-LongConsumer">Methods inherited from interface <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/LongConsumer.html" title="class or interface in java.util.function" class="external-link">LongConsumer</a></h3> |
| <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/LongConsumer.html#andThen(java.util.function.LongConsumer)" title="class or interface in java.util.function" class="external-link">andThen</a></code></div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <section class="details"> |
| <ul class="details-list"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <li> |
| <section class="constructor-details" id="constructor-detail"> |
| <h2>Constructor Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="<init>(java.lang.CharSequence)"> |
| <h3>Statistics</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="element-name">Statistics</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> name)</span></div> |
| <div class="block">Constructs an initially empty set of statistics. |
| The <a href="#count()">count()</a> and the <a href="#sum()"><code>sum()</code></a> are initialized to zero |
| and all other statistical values are initialized to <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>Double.NaN</code></a>. |
| |
| <p>Instances created by this constructor do not compute differences between sample values. |
| If differences or discrete derivatives are wanted, use the <a href="#forSeries(java.lang.CharSequence,java.lang.CharSequence...)"><code>forSeries(…)</code></a> |
| method instead.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>name</code> - the phenomenon for which this object is collecting statistics, or <code>null</code> if none. |
| If non-null, it will be shown as column header in the table formatted by <a href="StatisticsFormat.html" title="class in org.apache.sis.math"><code>StatisticsFormat</code></a>.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="<init>(java.lang.CharSequence,int,int,double,double,double,double,boolean)"> |
| <h3>Statistics</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="element-name">Statistics</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> name, |
| int countNaN, |
| int count, |
| double minimum, |
| double maximum, |
| double mean, |
| double standardDeviation, |
| boolean allPopulation)</span></div> |
| <div class="block">Constructs a set of statistics initialized to the given values. |
| The <code>countNaN</code> and <code>count</code> arguments must be positive. |
| If <code>count</code> is 0, all following <code>double</code> arguments are ignored. |
| Otherwise the following restrictions apply: |
| |
| <ul> |
| <li><code>minimum</code> and <code>maximum</code> arguments are mandatory and cannot be <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a>.</li> |
| <li><code>mean</code> argument is mandatory (cannot be NaN) if <code>standardDeviation</code> is not NaN.</li> |
| <li><code>mean</code> and <code>standardDeviation</code> arguments can be both <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> if unknown, |
| but statistics initialized that way will always return NaN from <a href="#sum()"><code>sum()</code></a>, <a href="#mean()"><code>mean()</code></a>, |
| <a href="#rms()"><code>rms()</code></a> and <a href="#standardDeviation(boolean)"><code>standardDeviation(boolean)</code></a> methods.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>name</code> - the phenomenon for which this object is collecting statistics, or <code>null</code> if none.</dd> |
| <dd><code>countNaN</code> - the number of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> samples.</dd> |
| <dd><code>count</code> - the number of samples, excluding <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> values.</dd> |
| <dd><code>minimum</code> - the minimum sample value. Ignored if <code>count</code> is zero.</dd> |
| <dd><code>maximum</code> - the maximum sample value. Ignored if <code>count</code> is zero.</dd> |
| <dd><code>mean</code> - the mean value. Ignored if <code>count</code> is zero.</dd> |
| <dd><code>standardDeviation</code> - the standard deviation. Ignored if <code>count</code> is zero.</dd> |
| <dd><code>allPopulation</code> - <code>true</code> if sample values were the totality of the population under study, |
| or <code>false</code> if they were only a sampling.</dd> |
| <dt>Since:</dt> |
| <dd>1.2</dd> |
| </dl> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| <!-- ============ METHOD DETAIL ========== --> |
| <li> |
| <section class="method-details" id="method-detail"> |
| <h2>Method Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="forSeries(java.lang.CharSequence,java.lang.CharSequence...)"> |
| <h3>forSeries</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="Statistics.html" title="class in org.apache.sis.math">Statistics</a></span> <span class="element-name">forSeries</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a> name, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/CharSequence.html" title="class or interface in java.lang" class="external-link">CharSequence</a>... differenceNames)</span></div> |
| <div class="block">Constructs a new <code>Statistics</code> object which will also compute finite differences |
| up to the given order. If the values to be given to the <code>accept(…)</code> methods are |
| the <var>y</var> values of some <var>y</var>=<var>f</var>(<var>x</var>) function for |
| <var>x</var> values increasing or decreasing at a constant interval Δ<var>x</var>, |
| then the finite differences are proportional to discrete derivatives. |
| |
| <p>The <code>Statistics</code> object created by this method know nothing about the Δ<var>x</var> |
| interval. In order to get the discrete derivatives, the following method needs to be invoked |
| <em>after</em> all sample values have been added:</p> |
| |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java">statistics.differences().scale(1/Δx); |
| </code></pre> |
| </div> |
| |
| |
| The maximal "derivative" order is determined by the length of the <code>differenceNames</code> array: |
| |
| <ul> |
| <li>0 if no differences are needed (equivalent to direct instantiation of a new |
| <code>Statistics</code> object).</li> |
| <li>1 for computing the statistics on the differences between consecutive samples |
| (proportional to the statistics on the first discrete derivatives) in addition |
| to the sample statistics.</li> |
| <li>2 for computing also the statistics on the differences between consecutive differences |
| (proportional to the statistics on the second discrete derivatives) in addition to the |
| above.</li> |
| <li><i>etc</i>.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>name</code> - the phenomenon for which this object is collecting statistics, or <code>null</code> |
| if none. If non-null, then this name will be shown as column header in the table |
| formatted by <a href="StatisticsFormat.html" title="class in org.apache.sis.math"><code>StatisticsFormat</code></a>.</dd> |
| <dd><code>differenceNames</code> - the names of the statistics on differences. |
| The given array cannot be null, but can contain null elements.</dd> |
| <dt>Returns:</dt> |
| <dd>the newly constructed, initially empty, set of statistics.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list"> |
| <li><a href="#differences()"><code>differences()</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="name()"> |
| <h3>name</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/util/InternationalString.html" title="class or interface in org.opengis.util" class="external-link">InternationalString</a></span> <span class="element-name">name</span>()</div> |
| <div class="block">Returns the name of the phenomenon for which this object is collecting statistics. |
| If non-null, then this name will be shown as column header in the table formatted |
| by <a href="StatisticsFormat.html" title="class in org.apache.sis.math"><code>StatisticsFormat</code></a>.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>the phenomenon for which this object is collecting statistics, or <code>null</code> if none.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="reset()"> |
| <h3>reset</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">reset</span>()</div> |
| <div class="block">Resets this object state as if it was just created. |
| The <a href="#count()">count()</a> and the <a href="#sum()"><code>sum()</code></a> are set to zero |
| and all other statistical values are set to <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>Double.NaN</code></a>.</div> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="accept(double)"> |
| <h3>accept</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">accept</span><wbr><span class="parameters">(double sample)</span></div> |
| <div class="block">Updates statistics for the specified floating-point sample value. |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> values increment the <a href="#countNaN()">NaN count</a>, |
| but are otherwise ignored.</div> |
| <dl class="notes"> |
| <dt>Specified by:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/DoubleConsumer.html#accept(double)" title="class or interface in java.util.function" class="external-link">accept</a></code> in interface <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/DoubleConsumer.html" title="class or interface in java.util.function" class="external-link">DoubleConsumer</a></code></dd> |
| <dt>Parameters:</dt> |
| <dd><code>sample</code> - the sample value (may be NaN).</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list"> |
| <li><a href="#accept(long)"><code>accept(long)</code></a></li> |
| <li><a href="#combine(org.apache.sis.math.Statistics)"><code>combine(Statistics)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="accept(long)"> |
| <h3>accept</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">accept</span><wbr><span class="parameters">(long sample)</span></div> |
| <div class="block">Updates statistics for the specified integer sample value. |
| For very large integer values (greater than 2<sup>52</sup> in magnitude), |
| this method may be more accurate than the <a href="#accept(double)"><code>accept(double)</code></a> version.</div> |
| <dl class="notes"> |
| <dt>Specified by:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/LongConsumer.html#accept(long)" title="class or interface in java.util.function" class="external-link">accept</a></code> in interface <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/LongConsumer.html" title="class or interface in java.util.function" class="external-link">LongConsumer</a></code></dd> |
| <dt>Parameters:</dt> |
| <dd><code>sample</code> - the sample value.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list"> |
| <li><a href="#accept(double)"><code>accept(double)</code></a></li> |
| <li><a href="#combine(org.apache.sis.math.Statistics)"><code>combine(Statistics)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="combine(org.apache.sis.math.Statistics)"> |
| <h3>combine</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">combine</span><wbr><span class="parameters">(<a href="Statistics.html" title="class in org.apache.sis.math">Statistics</a> stats)</span></div> |
| <div class="block">Updates statistics with all samples from the specified <code>stats</code>. |
| Invoking this method is equivalent (except for rounding errors) to invoking |
| <a href="#accept(double)"><code>accept(…)</code></a> for all samples that were added to <code>stats</code>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>stats</code> - the statistics to be added to <code>this</code>.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="scale(double)"> |
| <h3>scale</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">scale</span><wbr><span class="parameters">(double factor)</span></div> |
| <div class="block">Multiplies the statistics by the given factor. The given scale factory is also applied |
| recursively on the <a href="#differences()">differences</a> statistics, if any. |
| Invoking this method transforms the statistics as if every values given to the |
| <code>accept(…)</code> had been first multiplied by the given factor. |
| |
| <p>This method is useful for computing discrete derivatives from the differences between |
| sample values. See <a href="#differences()"><code>differences()</code></a> or <a href="#forSeries(java.lang.CharSequence,java.lang.CharSequence...)"><code>forSeries(…)</code></a> for more |
| information.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>factor</code> - the factor by which to multiply the statistics.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="countNaN()"> |
| <h3>countNaN</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">int</span> <span class="element-name">countNaN</span>()</div> |
| <div class="block">Returns the number of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> samples. |
| <code>NaN</code> samples are ignored in all other statistical computation. |
| This method count them for information purpose only.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>the number of NaN values.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="count()"> |
| <h3>count</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">int</span> <span class="element-name">count</span>()</div> |
| <div class="block">Returns the number of samples, excluding <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> values.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>the number of sample values, excluding NaN.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="minimum()"> |
| <h3>minimum</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">double</span> <span class="element-name">minimum</span>()</div> |
| <div class="block">Returns the minimum sample value, or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> if none.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>the minimum sample value, or NaN if none.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="maximum()"> |
| <h3>maximum</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">double</span> <span class="element-name">maximum</span>()</div> |
| <div class="block">Returns the maximum sample value, or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> if none.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>the maximum sample value, or NaN if none.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="span()"> |
| <h3>span</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">double</span> <span class="element-name">span</span>()</div> |
| <div class="block">Equivalents to <a href="#maximum()">maximum</a> - <a href="#minimum()">minimum</a>. |
| If no samples were added, then returns <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a>.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>the span of sample values, or NaN if none.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="sum()"> |
| <h3>sum</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">double</span> <span class="element-name">sum</span>()</div> |
| <div class="block">Returns the sum, or 0 if none. |
| May also be NaN if that value was explicitly specified to the constructor.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>the sum, or 0 if none.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="mean()"> |
| <h3>mean</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">double</span> <span class="element-name">mean</span>()</div> |
| <div class="block">Returns the mean value, or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> if none.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>the mean value, or NaN if none.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="rms()"> |
| <h3>rms</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">double</span> <span class="element-name">rms</span>()</div> |
| <div class="block">Returns the root mean square, or <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>NaN</code></a> if none.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>the root mean square, or NaN if none.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="standardDeviation(boolean)"> |
| <h3>standardDeviation</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">double</span> <span class="element-name">standardDeviation</span><wbr><span class="parameters">(boolean allPopulation)</span></div> |
| <div class="block">Returns the standard deviation. If the sample values given to the <code>accept(…)</code> |
| methods have a uniform distribution, then the returned value should be close to |
| <code>sqrt(<a href="#span()">span</a>² / 12)</code>. If they have a |
| Gaussian distribution (which is the most common case), then the returned value |
| is related to the <a href="https://en.wikipedia.org/wiki/Error_function">error |
| function</a>. |
| |
| <p>As a reminder, the table below gives the probability for a sample value to be |
| inside the <a href="#mean()">mean</a> ± <var>n</var> × <var>deviation range</var>, |
| assuming that the distribution is Gaussian (first column) or assuming that the |
| distribution is uniform (second column).</p> |
| |
| <table class="sis"> |
| <caption>Probability values for some standard deviations</caption> |
| <tr><th>n</th><th>Gaussian</th><th>uniform</th> |
| <tr><td>0.5</td><td>69.1%</td><td>28.9%</td></tr> |
| <tr><td>1.0</td><td>84.2%</td><td>57.7%</td></tr> |
| <tr><td>1.5</td><td>93.3%</td><td>86.6%</td></tr> |
| <tr><td>2.0</td><td>97.7%</td><td>100%</td></tr> |
| <tr><td>3.0</td><td>99.9%</td><td>100%</td></tr> |
| </table></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>allPopulation</code> - <code>true</code> if sample values given to <code>accept(…)</code> methods were the totality |
| of the population under study, or <code>false</code> if they were only a sampling.</dd> |
| <dt>Returns:</dt> |
| <dd>the standard deviation.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="differences()"> |
| <h3>differences</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="Statistics.html" title="class in org.apache.sis.math">Statistics</a></span> <span class="element-name">differences</span>()</div> |
| <div class="block">Returns the statistics on the differences between sample values, or <code>null</code> if none. |
| For example if the sample values given to the <code>accept(…)</code> methods were <var>y₀</var>, |
| <var>y₁</var>, <var>y₂</var> and <var>y₃</var>, then this method returns statistics on |
| <var>y₁</var>-<var>y₀</var>, <var>y₂</var>-<var>y₁</var> and <var>y₃</var>-<var>y₂</var>. |
| |
| <p>The differences between sample values are related to the discrete derivatives as below, |
| where Δ<var>x</var> is the constant interval between the <var>x</var> values of the |
| <var>y</var>=<var>f</var>(<var>x</var>) function:</p> |
| |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java">Statistics derivative = statistics.differences(); |
| derivative.scale(1/Δx); // Shall be invoked only once. |
| Statistics secondDerivative = derivative.differences(); |
| // Do not invoke scale(1/Δx) again. |
| </code></pre> |
| </div> |
| |
| |
| This method returns a non-null value only if this <code>Statistics</code> instance has been created by a |
| call to the <a href="#forSeries(java.lang.CharSequence,java.lang.CharSequence...)"><code>forSeries(…)</code></a> method with a non-empty <code>differenceNames</code> array. |
| More generally, calls to this method can be chained up to <code>differenceNames.length</code> times for |
| fetching second or higher order derivatives, as in the above example.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>the statistics on the differences between consecutive sample values, |
| or <code>null</code> if not calculated by this object.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="#forSeries(java.lang.CharSequence,java.lang.CharSequence...)"><code>forSeries(CharSequence, CharSequence[])</code></a></li> |
| <li><a href="#scale(double)"><code>scale(double)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="toString()"> |
| <h3>toString</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span> <span class="element-name">toString</span>()</div> |
| <div class="block">Returns a string representation of this statistics. This string will span |
| multiple lines, one for each statistical value. For example: |
| |
| <pre class="text"> |
| Number of values: 8726 |
| Minimum value: 6.853 |
| Maximum value: 8.259 |
| Mean value: 7.421 |
| Root Mean Square: 7.846 |
| Standard deviation: 6.489</pre></div> |
| <dl class="notes"> |
| <dt>Overrides:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a></code> in class <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></dd> |
| <dt>Returns:</dt> |
| <dd>a string representation of this statistics object.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list"> |
| <li><a href="StatisticsFormat.html" title="class in org.apache.sis.math"><code>StatisticsFormat</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="clone()"> |
| <h3>clone</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="Statistics.html" title="class in org.apache.sis.math">Statistics</a></span> <span class="element-name">clone</span>()</div> |
| <div class="block">Returns a clone of this statistics.</div> |
| <dl class="notes"> |
| <dt>Overrides:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a></code> in class <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></dd> |
| <dt>Returns:</dt> |
| <dd>a clone of this statistics.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="hashCode()"> |
| <h3>hashCode</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">int</span> <span class="element-name">hashCode</span>()</div> |
| <div class="block">Returns a hash code value for this statistics.</div> |
| <dl class="notes"> |
| <dt>Overrides:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a></code> in class <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="equals(java.lang.Object)"> |
| <h3>equals</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">boolean</span> <span class="element-name">equals</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> object)</span></div> |
| <div class="block">Compares this statistics with the specified object for equality.</div> |
| <dl class="notes"> |
| <dt>Overrides:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a></code> in class <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></dd> |
| <dt>Parameters:</dt> |
| <dd><code>object</code> - the object to compare with.</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if both objects are equal.</dd> |
| </dl> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <!-- ========= END OF CLASS DATA ========= --> |
| </main> |
| </div> |
| </div> |
| </body> |
| </html> |