Axibase BigDecimal Statistics

BigDecimal implementation of Apache Commons Math Descriptive Statistics and Summary Statistics.

Лицензия

Лицензия

Группа

Группа

com.axibase
Идентификатор

Идентификатор

math
Последняя версия

Последняя версия

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Axibase BigDecimal Statistics
BigDecimal implementation of Apache Commons Math Descriptive Statistics and Summary Statistics.
Ссылка на сайт

Ссылка на сайт

https://github.com/axibase/math
Организация-разработчик

Организация-разработчик

Axibase
Система контроля версий

Система контроля версий

https://github.com/axibase/math.git

Скачать math

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.axibase/math/ -->
<dependency>
    <groupId>com.axibase</groupId>
    <artifactId>math</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.axibase/math/
implementation 'com.axibase:math:1.0.1'
// https://jarcasting.com/artifacts/com.axibase/math/
implementation ("com.axibase:math:1.0.1")
'com.axibase:math:jar:1.0.1'
<dependency org="com.axibase" name="math" rev="1.0.1">
  <artifact name="math" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.axibase', module='math', version='1.0.1')
)
libraryDependencies += "com.axibase" % "math" % "1.0.1"
[com.axibase/math "1.0.1"]

Зависимости

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

BigDecimal Statistics

Overview

BigDecimal implementation of Apache Commons Math Descriptive Statistics and Summary Statistics.

See JavaDocs for implementation details.

The following methods from Apache DescriptiveStatistics are not implemented in this release:

  • getGeometricMean()
  • getKurtosis()
  • getQuadraticMean()
  • getSkewness()

The MathContext object should be used for rounding for the following methods since they may return an infitinite number of fractional digits:

  • getMean()
  • getVariance()
  • getStandardDeviation()

License

The project is released under version 2.0 of the Apache License.

Examples

DescriptiveStatistics

Axibase BigDecimal DescriptiveStatistics

import com.axibase.math.stat.descriptive;

BigDecimal[] numbers = {new BigDecimal("1.3"), new BigDecimal("0.3"), new BigDecimal("0.1")};

// Get a DescriptiveStatistics instance with the default precision of 16 digits
DescriptiveStatistics stats = new DescriptiveStatistics(numbers);

// Compute some statistics
long size = stats.getN();
BigDecimal max = stats.getMax();
BigDecimal median = stats.getPercentile(new BigDecimal("50"));

BigDecimal mean = stats.getMean();
BigDecimal std = stats.getStandardDeviation();
BigDecimal sum = stats.getSum();
size = 3
max = 1.3
median = 0.300
mean = 0.5666666666666667
std = 0.6429100507328637
sum = 1.7
// Compute standard deviation with 256 digit precision
MathContext context = new MathContext(256, RoundingMode.HALF_UP);
System.out.println("std256 = " stats.getStandardDeviation(context));
std256 = 0.642910050732863666384002069828844212260460246204216827153345125848752427911243
31486000364728624057273875823889386306592350052104615439306773115570612231259706223485518
46400953679001533442110739077534147619453047556859898336326044546221595799048295894202745

Apache Math double DescriptiveStatistics

import org.apache.commons.math3.stat.descriptive;

double[] numbers = {1.3, 0.3, 0.1};

// Get a DescriptiveStatistics instance
DescriptiveStatistics stats = new DescriptiveStatistics(numbers);

// Compute some statistics
long size = stats.getN();
double max = stats.getMax();
double median = stats.getPercentile(50);
double mean = stats.getMean();
double std = stats.getStandardDeviation();
double sum = stats.getSum();
size = 3
max = 1.3
median = 0.3
mean = 0.5666666666666667
std = 0.6429100507328638
sum = 1.7000000000000002

SummaryStatistics

BigDecimal SummaryStatistics has the same interface as the Apache SummaryStatistics and is used to calculate statistics for a stream of numeric data, without storing input values.

Axibase BigDecimal SummaryStatistics

import com.axibase.math.stat.descriptive;

String[] numbers = {"1.3", "0.3", "0.1"};

// Get a SummaryStatistics instance
SummaryStatistics stats = new SummaryStatistics();

//Read data as BigDecimal values
for (String v : numbers) {
        //no precision loss
        BigDecimal bd = new BigDecimal(v);
        //update statistics
        stats.addValue(bd);
}

// Get current statistics
long size = stats.getN();
BigDecimal max = stats.getMax();
BigDecimal mean = stats.getMean();
BigDecimal std = stats.getStandardDeviation();

Apache Math double SummaryStatistics

import org.apache.commons.math3.stat.descriptive;

String[] numbers = {"1.3", "0.3", "0.1"};

// Get a SummaryStatistics instance
SummaryStatistics stats = new SummaryStatistics();

// Read data as double values
for (String v : numbers) {
        //possible precision loss
        double dbl = Double.parseDouble(v);
        //update statistics
        stats.addValue(dbl);
}

// Get current statistics
long size = stats.getN();
double max = stats.getMax();
double mean = stats.getMean();
double std = stats.getStandardDeviation();
com.axibase

Axibase Corporation

Public Axibase repositories on GitHub

Версии библиотеки

Версия
1.0.1
1.0.0