Eliminated references to factory methods dropped in math 2.0.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@925826 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2010-03-21 17:01:31 +00:00
parent 8cb2563a2c
commit bfe0b4a60c
2 changed files with 8 additions and 10 deletions

View File

@ -45,8 +45,7 @@
and a domain value, <code>x</code>, <code>cumulativeProbability</code> computes and a domain value, <code>x</code>, <code>cumulativeProbability</code> computes
<code>P(X &lt;= x)</code> (i.e. the lower tail probability of <code>X</code>). <code>P(X &lt;= x)</code> (i.e. the lower tail probability of <code>X</code>).
</p> </p>
<source>DistributionFactory factory = DistributionFactory.newInstance(); <source>TDistribution t = new TDistributionImpl(29);
TDistribution t = factory.createTDistribution(29);
double lowerTail = t.cumulativeProbability(-2.656); // P(T &lt;= -2.656) double lowerTail = t.cumulativeProbability(-2.656); // P(T &lt;= -2.656)
double upperTail = 1.0 - t.cumulativeProbability(2.75); // P(T &gt;= 2.75)</source> double upperTail = 1.0 - t.cumulativeProbability(2.75); // P(T &gt;= 2.75)</source>
<p> <p>

View File

@ -153,8 +153,8 @@
<dd>Using the <code>DescriptiveStatistics</code> aggregate <dd>Using the <code>DescriptiveStatistics</code> aggregate
(values are stored in memory): (values are stored in memory):
<source> <source>
// Get a DescriptiveStatistics instance using factory method // Get a DescriptiveStatistics instance
DescriptiveStatistics stats = DescriptiveStatistics.newInstance(); DescriptiveStatistics stats = new DescriptiveStatistics();
// Add the data from the array // Add the data from the array
for( int i = 0; i &lt; inputArray.length; i++) { for( int i = 0; i &lt; inputArray.length; i++) {
@ -170,8 +170,8 @@ double median = stats.getMedian();
<dd>Using the <code>SummaryStatistics</code> aggregate (values are <dd>Using the <code>SummaryStatistics</code> aggregate (values are
<strong>not</strong> stored in memory): <strong>not</strong> stored in memory):
<source> <source>
// Get a SummaryStatistics instance using factory method // Get a SummaryStatistics instance
SummaryStatistics stats = SummaryStatistics.newInstance(); SummaryStatistics stats = new SummaryStatistics();
// Read data from an input stream, // Read data from an input stream,
// adding values and updating sums, counters, etc. // adding values and updating sums, counters, etc.
@ -206,7 +206,7 @@ mean = StatUtils.mean(values, 0, 3);
window size set to 100 window size set to 100
<source> <source>
// Create a DescriptiveStats instance and set the window size to 100 // Create a DescriptiveStats instance and set the window size to 100
DescriptiveStatistics stats = DescriptiveStatistics.newInstance(); DescriptiveStatistics stats = new DescriptiveStatistics();
stats.setWindowSize(100); stats.setWindowSize(100);
// Read data from an input stream, // Read data from an input stream,
@ -230,7 +230,7 @@ in.close();
<source> <source>
// Create a SynchronizedDescriptiveStatistics instance and // Create a SynchronizedDescriptiveStatistics instance and
// use as any other DescriptiveStatistics instance // use as any other DescriptiveStatistics instance
DescriptiveStatistics stats = DescriptiveStatistics.newInstance(SynchronizedDescriptiveStatistics.class); DescriptiveStatistics stats = new SynchronizedDescriptiveStatistics();
</source> </source>
</dd> </dd>
<dt>Compute statistics for multiple samples and overall statistics concurrently</dt> <dt>Compute statistics for multiple samples and overall statistics concurrently</dt>
@ -842,8 +842,7 @@ System.out.println(TestUtils.t(mu, observed));
<source> <source>
double[] observed ={1d, 2d, 3d}; double[] observed ={1d, 2d, 3d};
double mu = 2.5d; double mu = 2.5d;
SummaryStatistics sampleStats = null; SummaryStatistics sampleStats = new SummaryStatistics();
sampleStats = SummaryStatistics.newInstance();
for (int i = 0; i &lt; observed.length; i++) { for (int i = 0; i &lt; observed.length; i++) {
sampleStats.addValue(observed[i]); sampleStats.addValue(observed[i]);
} }