19 declare(strict_types=1);
35 $this->stat_data = array_values($median_array);
36 sort($this->stat_data);
38 if (($median_user_id = array_search($this->
median(), $median_array)) !==
false) {
48 public function min(): ?float
50 if ($this->stat_data === []) {
54 return min($this->stat_data);
60 public function max(): ?float
62 if ($this->stat_data === []) {
66 return max($this->stat_data);
74 return count($this->stat_data);
80 public function sum_n(
int $n): ?float
82 if ($this->stat_data === []) {
87 foreach ($this->stat_data as $value) {
88 $sum_n += pow((
float) $value, (
float) $n);
96 public function sum(): ?float
98 return $this->
sum_n(1);
107 return $this->
sum_n(2);
115 if ($this->stat_data === []) {
119 if ($this->
min() === 0) {
124 foreach ($this->stat_data as $value) {
125 $prod_n *= pow((
float) $value, (
float) $n);
149 $count = $this->
count();
153 return (
float) ($sum / $count);
167 if (($prod ===
null) || ($prod === 0)) {
170 $count = $this->
count();
174 return pow((
float) $prod, (
float) (1 / $count));
184 if (($min ===
null) or ($min === 0)) {
187 $count = $this->
count();
192 foreach ($this->stat_data as $value) {
195 return $count / $sum;
203 if ($this->stat_data === []) {
207 $count = $this->
count();
208 if ((
count($this->stat_data) % 2) === 0) {
209 return ($this->stat_data[($count / 2) - 1] + $this->stat_data[($count / 2)]) / 2;
212 return $this->stat_data[(($count + 1) / 2) - 1];
220 $rank = array_search($value, $this->stat_data);
221 if ($rank ===
false) {
225 return $this->
count() - $rank;
237 $count = $this->
count();
242 if (($count % 2) === 0) {
246 return ($count + 1) / 2;
254 $count = $this->
count();
259 $nprod = ($n / 100) * $count;
260 if (intval($nprod) != $nprod) {
261 return $this->stat_data[ceil($nprod) - 1];
264 if ($nprod === 0.0) {
265 return $this->stat_data[0];
268 if ($nprod === (
float) $count) {
269 return $this->stat_data[(
int) $nprod - 1];
272 return ($this->stat_data[(
int) $nprod - 1] + $this->stat_data[(
int) $nprod]) / 2;
rank(float $value)
Returns the rank of a given value.
product_n(int $n)
Calculates the product of x_1^n * x_2^n * ...
ilTestEvaluationUserData $median_user
quantile(float $n)
n-Quantile of the data values
count()
Calculates number of data values.
sum()
Calculates the sum of x_1 + x_2 + ...
sum_n(int $n)
Calculates the sum of x_1^n + x_2^n + ...
arithmeticMean()
Arithmetic mean of the data values xbar = (1/n)*∑x_i.
sort()
description: > Example for rendering a Sort Glyph.
getEvaluationDataOfMedianUser()
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
rankMedian()
Returns the rank of the median.
harmonicMean()
Harmonic mean of the data values harmonic_mean = n/(1/x_1 + 1/x_2 + ...
geometricMean()
Geometric mean of the data values geometric_mean = (x_1 * x_2 * ...
max()
Calculates the maximum value.
sum2()
Calculates the sum of x_1^2 + x_2^2 + ...
__construct(\ilTestEvaluationData $eval_data)
median()
Median of the data values.
getParticipant(int $active_id)
product(int $n)
Calculates the product of x_1 * x_2 * ...