ILIAS
release_8 Revision v8.19
|
This class provides mathematical functions for statistics. More...
Public Member Functions | |
__construct ($nan_handling=NAN_HANDLING_REMOVE) | |
Constructor of ilStatistics class. More... | |
setNANHandling ($nan_handling=NAN_HANDLING_REMOVE) | |
Set the handling of elements which are not a number. More... | |
getNANHandling () | |
Get the handling of elements which are not a number. More... | |
setData ($stat_data) | |
Sets the data and checks for invalid values. More... | |
getData () | |
Returns the numeric value array containing the data. More... | |
min () | |
Calculates the minimum value. More... | |
max () | |
Calculates the maximum value. More... | |
count () | |
Calculates number of data values. More... | |
sum_n ($n) | |
Calculates the sum of x_1^n + x_2^n + ... More... | |
sum () | |
Calculates the sum of x_1 + x_2 + ... More... | |
sum2 () | |
Calculates the sum of x_1^2 + x_2^2 + ... More... | |
product_n ($n) | |
Calculates the product of x_1^n * x_2^n * ... More... | |
product ($n) | |
Calculates the product of x_1 * x_2 * ... More... | |
arithmetic_mean () | |
Arithmetic mean of the data values xbar = (1/n)*∑x_i. More... | |
geometric_mean () | |
Geometric mean of the data values geometric_mean = (x_1 * x_2 * ... More... | |
harmonic_mean () | |
Harmonic mean of the data values harmonic_mean = n/(1/x_1 + 1/x_2 + ... More... | |
median () | |
Median of the data values. More... | |
rank ($value) | |
Returns the rank of a given value. More... | |
rank_median () | |
Returns the rank of the median. More... | |
quantile ($n) | |
n-Quantile of the data values More... | |
validate () | |
Validates the numeric data and handles values which are not a number according to the $nan_handling variable. More... | |
Data Fields | |
$nan_handling | |
$stat_data | |
This class provides mathematical functions for statistics.
It works on an array of numeric values.
Definition at line 32 of file class.ilStatistics.php.
ilStatistics::__construct | ( | $nan_handling = NAN_HANDLING_REMOVE | ) |
Constructor of ilStatistics class.
public
Definition at line 57 of file class.ilStatistics.php.
References $nan_handling.
ilStatistics::arithmetic_mean | ( | ) |
Arithmetic mean of the data values xbar = (1/n)*∑x_i.
Definition at line 242 of file class.ilStatistics.php.
References count(), and sum().
ilStatistics::count | ( | ) |
Calculates number of data values.
Definition at line 154 of file class.ilStatistics.php.
Referenced by arithmetic_mean(), geometric_mean(), harmonic_mean(), max(), median(), min(), product_n(), quantile(), rank(), rank_median(), and sum_n().
ilStatistics::geometric_mean | ( | ) |
Geometric mean of the data values geometric_mean = (x_1 * x_2 * ...
The geometric mean of a set of positive data is defined as the product of all the members of the set, raised to a power equal to the reciprocal of the number of members.
Definition at line 266 of file class.ilStatistics.php.
References count(), and product().
ilStatistics::getData | ( | ) |
Returns the numeric value array containing the data.
Definition at line 109 of file class.ilStatistics.php.
References $stat_data.
ilStatistics::getNANHandling | ( | ) |
Get the handling of elements which are not a number.
Returns NAN_HANDLING_REMOVE if all elements which are not a number will be removed. Returns NAN_HANDLING_ZERO if all elements which are not a number will be set to zero.
Definition at line 86 of file class.ilStatistics.php.
References $nan_handling.
ilStatistics::harmonic_mean | ( | ) |
Harmonic mean of the data values harmonic_mean = n/(1/x_1 + 1/x_2 + ...
Definition at line 286 of file class.ilStatistics.php.
References count(), and min().
ilStatistics::max | ( | ) |
Calculates the maximum value.
Definition at line 138 of file class.ilStatistics.php.
References count().
ilStatistics::median | ( | ) |
Median of the data values.
Definition at line 309 of file class.ilStatistics.php.
References count().
ilStatistics::min | ( | ) |
Calculates the minimum value.
Definition at line 121 of file class.ilStatistics.php.
References count().
Referenced by harmonic_mean(), and product_n().
ilStatistics::product | ( | $n | ) |
Calculates the product of x_1 * x_2 * ...
numeric | $n | The exponent |
Definition at line 230 of file class.ilStatistics.php.
References product_n().
Referenced by geometric_mean().
ilStatistics::product_n | ( | $n | ) |
Calculates the product of x_1^n * x_2^n * ...
numeric | $n | The exponent |
Definition at line 208 of file class.ilStatistics.php.
References count(), and min().
Referenced by product().
ilStatistics::quantile | ( | $n | ) |
n-Quantile of the data values
double | $n | A value between 0 an 100 calculating the n-Quantile |
Definition at line 374 of file class.ilStatistics.php.
References count().
ilStatistics::rank | ( | $value | ) |
Returns the rank of a given value.
Definition at line 330 of file class.ilStatistics.php.
References count().
ilStatistics::rank_median | ( | ) |
Returns the rank of the median.
This method is different from the rank method because the median could be the arithmetic mean of the two middle values when the data size is even. In this case the median could a value which is not part of the data set.
Definition at line 352 of file class.ilStatistics.php.
References count().
ilStatistics::setData | ( | $stat_data | ) |
Sets the data and checks for invalid values.
array | $stat_data | An array containing the numeric data public |
Definition at line 97 of file class.ilStatistics.php.
References $stat_data, and validate().
ilStatistics::setNANHandling | ( | $nan_handling = NAN_HANDLING_REMOVE | ) |
Set the handling of elements which are not a number.
If set to NAN_HANDLING_REMOVE, all elements which are not a number will be removed, if set to NAN_HANDLING_ZERO, all elements which are not a number will be set to zero.
integer | $nan_handling | A constant defining the handling of elements which are not a number public |
Definition at line 72 of file class.ilStatistics.php.
References $nan_handling.
ilStatistics::sum | ( | ) |
Calculates the sum of x_1 + x_2 + ...
Definition at line 184 of file class.ilStatistics.php.
References sum_n().
Referenced by arithmetic_mean().
ilStatistics::sum2 | ( | ) |
Calculates the sum of x_1^2 + x_2^2 + ...
Definition at line 196 of file class.ilStatistics.php.
References sum_n().
ilStatistics::sum_n | ( | $n | ) |
Calculates the sum of x_1^n + x_2^n + ...
numeric | $n | The exponent |
Definition at line 166 of file class.ilStatistics.php.
References count().
Referenced by sum(), and sum2().
ilStatistics::validate | ( | ) |
Validates the numeric data and handles values which are not a number according to the $nan_handling variable.
After validation the data is sorted.
Definition at line 404 of file class.ilStatistics.php.
References ILIAS\LTI\ToolProvider\$key, NAN_HANDLING_REMOVE, and NAN_HANDLING_ZERO.
Referenced by setData().
ilStatistics::$nan_handling |
Definition at line 42 of file class.ilStatistics.php.
Referenced by __construct(), getNANHandling(), and setNANHandling().
ilStatistics::$stat_data |
Definition at line 50 of file class.ilStatistics.php.