@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | $this->_bins = array(); |
107 | 107 | $this->_stats = array('x' => new \HuasoFoundries\Math\Stats(), 'y' => new \HuasoFoundries\Math\Stats(), 'z' => new \HuasoFoundries\Math\Stats()); |
108 | 108 | $this->_statsMode = $statsMode; |
109 | - $deltaX = ($this->_rangeHigh['x'] - $this->_rangeLow['x']) / $this->_nbins['x']; |
|
110 | - $deltaY = ($this->_rangeHigh['y'] - $this->_rangeLow['y']) / $this->_nbins['y']; |
|
111 | - $deltaZ = ($this->_rangeHigh['z'] - $this->_rangeLow['z']) / $this->_nbins['z']; |
|
109 | + $deltaX = ($this->_rangeHigh['x'] - $this->_rangeLow['x'])/$this->_nbins['x']; |
|
110 | + $deltaY = ($this->_rangeHigh['y'] - $this->_rangeLow['y'])/$this->_nbins['y']; |
|
111 | + $deltaZ = ($this->_rangeHigh['z'] - $this->_rangeLow['z'])/$this->_nbins['z']; |
|
112 | 112 | $data = $this->_histogramData(); |
113 | 113 | $dataX = $data['x']; |
114 | 114 | $dataY = $data['y']; |
@@ -117,20 +117,20 @@ discard block |
||
117 | 117 | $cumm = 0; |
118 | 118 | $nData = count($dataX); |
119 | 119 | for ($i = 0; $i < $this->_nbins['x']; $i++) { |
120 | - $loXBin = $this->_rangeLow['x'] + $i * $deltaX; |
|
120 | + $loXBin = $this->_rangeLow['x'] + $i*$deltaX; |
|
121 | 121 | $hiXBin = $loXBin + $deltaX; |
122 | 122 | $xBin = array('low' => $loXBin, 'high' => $hiXBin, |
123 | - 'mid' => ($hiXBin + $loXBin) / 2); |
|
123 | + 'mid' => ($hiXBin + $loXBin)/2); |
|
124 | 124 | for ($j = 0; $j < $this->_nbins['y']; $j++) { |
125 | - $loYBin = $this->_rangeLow['y'] + $j * $deltaY; |
|
125 | + $loYBin = $this->_rangeLow['y'] + $j*$deltaY; |
|
126 | 126 | $hiYBin = $loYBin + $deltaY; |
127 | 127 | $yBin = array('low' => $loYBin, 'high' => $hiYBin, |
128 | - 'mid' => ($hiYBin + $loYBin) / 2); |
|
128 | + 'mid' => ($hiYBin + $loYBin)/2); |
|
129 | 129 | for ($m = 0; $m < $this->_nbins['z']; $m++) { |
130 | - $loZBin = $this->_rangeLow['z'] + $m * $deltaZ; |
|
130 | + $loZBin = $this->_rangeLow['z'] + $m*$deltaZ; |
|
131 | 131 | $hiZBin = $loZBin + $deltaZ; |
132 | 132 | $zBin = array('low' => $loZBin, 'high' => $hiZBin, |
133 | - 'mid' => ($hiZBin + $loZBin) / 2); |
|
133 | + 'mid' => ($hiZBin + $loZBin)/2); |
|
134 | 134 | $bin = array('x' => $xBin, 'y' => $yBin, 'z' => $zBin); |
135 | 135 | $freq = 0; |
136 | 136 | for ($k = 0; $k < $nData; $k++) { |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $out[] = implode($separator, $bins[$i]); |
250 | 250 | } |
251 | 251 | |
252 | - return implode("\n", $out) . "\n"; |
|
252 | + return implode("\n", $out)."\n"; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $this->_stats = new \HuasoFoundries\Math\Stats(); |
112 | 112 | |
113 | 113 | $this->_statsMode = $statsMode; |
114 | - $delta = ($this->_rangeHigh - $this->_rangeLow) / $this->_nbins; |
|
114 | + $delta = ($this->_rangeHigh - $this->_rangeLow)/$this->_nbins; |
|
115 | 115 | $lastpos = 0; |
116 | 116 | $cumm = 0; |
117 | 117 | $data = $this->_histogramData(); |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | $ignoreList = array(); |
120 | 120 | |
121 | 121 | for ($i = 0; $i < $this->_nbins; $i++) { |
122 | - $loBin = $this->_rangeLow + $i * $delta; |
|
122 | + $loBin = $this->_rangeLow + $i*$delta; |
|
123 | 123 | $hiBin = $loBin + $delta; |
124 | 124 | $this->_bins[$i]["low"] = $loBin; |
125 | 125 | $this->_bins[$i]["high"] = $hiBin; |
126 | - $this->_bins[$i]["mid"] = ($hiBin + $loBin) / 2; |
|
126 | + $this->_bins[$i]["mid"] = ($hiBin + $loBin)/2; |
|
127 | 127 | if ($this->_type == self::HISTOGRAM_CUMMULATIVE) { |
128 | 128 | $this->_bins[$i]["count"] = $cumm; |
129 | 129 | } else { |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $out[] = "{$bin}{$separator}{$freq}"; |
210 | 210 | } |
211 | 211 | |
212 | - return implode("\n", $out) . "\n"; |
|
212 | + return implode("\n", $out)."\n"; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | throw new \PEAR_Exception("histogram has not been calculated"); |
268 | 268 | } |
269 | 269 | $out = ($this->_type == self::HISTOGRAM_CUMMULATIVE) ? "Cummulative Frequency" : "Histogram"; |
270 | - $out .= "\n\tNumber of bins: " . $this->_nbins . "\n"; |
|
271 | - $out .= "\tPlot range: [" . $this->_rangeLow . ", " . $this->_rangeHigh . "]\n"; |
|
270 | + $out .= "\n\tNumber of bins: ".$this->_nbins."\n"; |
|
271 | + $out .= "\tPlot range: [".$this->_rangeLow.", ".$this->_rangeHigh."]\n"; |
|
272 | 272 | $hdata = $this->_histogramData(); |
273 | - $out .= "\tData range: [" . min($hdata) . ", " . max($hdata) . "]\n"; |
|
274 | - $out .= "\tOriginal data range: [" . min($this->_data) . ", " . max($this->_data) . "]\n"; |
|
273 | + $out .= "\tData range: [".min($hdata).", ".max($hdata)."]\n"; |
|
274 | + $out .= "\tOriginal data range: [".min($this->_data).", ".max($this->_data)."]\n"; |
|
275 | 275 | $out .= "BIN (FREQUENCY) ASCII_BAR (%)\n"; |
276 | 276 | $fmt = "%-4.3f (%-4d) |%s\n"; |
277 | 277 | $bins = $this->_filterBins($mode); |
@@ -295,14 +295,14 @@ discard block |
||
295 | 295 | */ |
296 | 296 | public function _bar($freq, $maxfreq, $total) |
297 | 297 | { |
298 | - $fact = floatval(($maxfreq > 40) ? 40 / $maxfreq : 1); |
|
299 | - $niter = round($freq * $fact); |
|
298 | + $fact = floatval(($maxfreq > 40) ? 40/$maxfreq : 1); |
|
299 | + $niter = round($freq*$fact); |
|
300 | 300 | $out = ""; |
301 | 301 | for ($i = 0; $i < $niter; $i++) { |
302 | 302 | $out .= "*"; |
303 | 303 | } |
304 | 304 | |
305 | - return $out . sprintf(" (%.1f%%)", $freq / $total * 100); |
|
305 | + return $out.sprintf(" (%.1f%%)", $freq/$total*100); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | $out = ($this->_hist->_type == \HuasoFoundries\Histogram\Histogram::HISTOGRAM_CUMMULATIVE) ? "Cummulative Frequency" : "Histogram"; |
47 | 47 | $out .= "\n\tNumber of bins: {$binopts['nbins']}\n"; |
48 | 48 | $out .= "\tPlot range: [{$binopts['rangeLow']}, {$binopts['rangeHigh']}]\n"; |
49 | - $out .= "\tData range: [" . min($hdata) . ", " . max($hdata) . "]\n"; |
|
50 | - $out .= "\tOriginal data range: [" . min($data) . ", " . max($data) . "]\n"; |
|
49 | + $out .= "\tData range: [".min($hdata).", ".max($hdata)."]\n"; |
|
50 | + $out .= "\tOriginal data range: [".min($data).", ".max($data)."]\n"; |
|
51 | 51 | $out .= "BIN (FREQUENCY) ASCII_BAR (%)\n"; |
52 | 52 | foreach ($bins as $bin => $freq) { |
53 | 53 | $out .= sprintf($fmt, $bin, $freq, $this->_bar($freq, $maxfreq, $total)); |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function _bar($freq, $maxfreq, $total) |
106 | 106 | { |
107 | - $fact = floatval(($maxfreq > 40) ? 40 / $maxfreq : 1); |
|
108 | - $niter = round($freq * $fact); |
|
107 | + $fact = floatval(($maxfreq > 40) ? 40/$maxfreq : 1); |
|
108 | + $niter = round($freq*$fact); |
|
109 | 109 | $out = ""; |
110 | 110 | for ($i = 0; $i < $niter; $i++) { |
111 | 111 | $out .= "*"; |
112 | 112 | } |
113 | 113 | |
114 | - return $out . sprintf(" (%.1f%%)", $freq / $total * 100); |
|
114 | + return $out.sprintf(" (%.1f%%)", $freq/$total*100); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | $out = ''; |
128 | 128 | foreach ($stats as $name => $value) { |
129 | 129 | if (is_array($value)) { |
130 | - $out .= $prefix . $name . ":\n"; |
|
131 | - $out .= $this->_printStats($value, $prefix . "\t"); |
|
130 | + $out .= $prefix.$name.":\n"; |
|
131 | + $out .= $this->_printStats($value, $prefix."\t"); |
|
132 | 132 | } else { |
133 | 133 | $out .= "{$prefix}{$name}: $value\n"; |
134 | 134 | } |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | $this->_bins = array(); |
108 | 108 | $this->_stats = array('x' => new \HuasoFoundries\Math\Stats(), 'y' => new \HuasoFoundries\Math\Stats()); |
109 | 109 | $this->_statsMode = $statsMode; |
110 | - $deltaX = ($this->_rangeHigh['x'] - $this->_rangeLow['x']) / $this->_nbins['x']; |
|
111 | - $deltaY = ($this->_rangeHigh['y'] - $this->_rangeLow['y']) / $this->_nbins['y']; |
|
110 | + $deltaX = ($this->_rangeHigh['x'] - $this->_rangeLow['x'])/$this->_nbins['x']; |
|
111 | + $deltaY = ($this->_rangeHigh['y'] - $this->_rangeLow['y'])/$this->_nbins['y']; |
|
112 | 112 | $data = $this->_histogramData(); |
113 | 113 | //$dataX = $this->_data['x']; |
114 | 114 | //$dataY = $this->_data['y']; |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | $cumm = 0; |
119 | 119 | $nData = count($dataX); |
120 | 120 | for ($i = 0; $i < $this->_nbins['x']; $i++) { |
121 | - $loXBin = $this->_rangeLow['x'] + $i * $deltaX; |
|
121 | + $loXBin = $this->_rangeLow['x'] + $i*$deltaX; |
|
122 | 122 | $hiXBin = $loXBin + $deltaX; |
123 | 123 | $xBin = array('low' => $loXBin, 'high' => $hiXBin, |
124 | - 'mid' => ($hiXBin + $loXBin) / 2); |
|
124 | + 'mid' => ($hiXBin + $loXBin)/2); |
|
125 | 125 | for ($j = 0; $j < $this->_nbins['y']; $j++) { |
126 | - $loYBin = $this->_rangeLow['y'] + $j * $deltaY; |
|
126 | + $loYBin = $this->_rangeLow['y'] + $j*$deltaY; |
|
127 | 127 | $hiYBin = $loYBin + $deltaY; |
128 | 128 | $yBin = array('low' => $loYBin, 'high' => $hiYBin, |
129 | - 'mid' => ($hiYBin + $loYBin) / 2); |
|
129 | + 'mid' => ($hiYBin + $loYBin)/2); |
|
130 | 130 | $bin = array('x' => $xBin, 'y' => $yBin); |
131 | 131 | $freq = 0; |
132 | 132 | for ($k = 0; $k < $nData; $k++) { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $out[] = implode($separator, $bins[$i]); |
233 | 233 | } |
234 | 234 | |
235 | - return implode("\n", $out) . "\n"; |
|
235 | + return implode("\n", $out)."\n"; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $this->_nullOption = $nullOption; |
179 | 179 | return true; |
180 | 180 | } else { |
181 | - throw new \PEAR_Exception('invalid null handling option expecting: ' . |
|
181 | + throw new \PEAR_Exception('invalid null handling option expecting: '. |
|
182 | 182 | 'STATS_REJECT_NULL, STATS_IGNORE_NULL or STATS_USE_NULL_AS_ZERO'); |
183 | 183 | } |
184 | 184 | } |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | $arr = array(); |
213 | 213 | if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) { |
214 | 214 | foreach ($this->_data as $val => $freq) { |
215 | - $newval = ($val - $mean) / $std; |
|
215 | + $newval = ($val - $mean)/$std; |
|
216 | 216 | $arr["$newval"] = $freq; |
217 | 217 | } |
218 | 218 | } else { |
219 | 219 | foreach ($this->_data as $val) { |
220 | - $newval = ($val - $mean) / $std; |
|
220 | + $newval = ($val - $mean)/$std; |
|
221 | 221 | $arr[] = $newval; |
222 | 222 | } |
223 | 223 | } |
@@ -480,11 +480,11 @@ discard block |
||
480 | 480 | $sumN = 0; |
481 | 481 | if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) { |
482 | 482 | foreach ($this->_data as $val => $freq) { |
483 | - $sumN += $freq * pow((double) $val, (double) $n); |
|
483 | + $sumN += $freq*pow((double)$val, (double)$n); |
|
484 | 484 | } |
485 | 485 | } else { |
486 | 486 | foreach ($this->_data as $val) { |
487 | - $sumN += pow((double) $val, (double) $n); |
|
487 | + $sumN += pow((double)$val, (double)$n); |
|
488 | 488 | } |
489 | 489 | } |
490 | 490 | return $sumN; |
@@ -536,8 +536,8 @@ discard block |
||
536 | 536 | if ($val == 0) { |
537 | 537 | return 0.0; |
538 | 538 | } |
539 | - $prodN *= $freq * pow((double) $val, (double) $n); |
|
540 | - if ($prodN > 10000 * $n) { |
|
539 | + $prodN *= $freq*pow((double)$val, (double)$n); |
|
540 | + if ($prodN > 10000*$n) { |
|
541 | 541 | $partial[] = $prodN; |
542 | 542 | $prodN = 1.0; |
543 | 543 | } |
@@ -547,8 +547,8 @@ discard block |
||
547 | 547 | if ($val == 0) { |
548 | 548 | return 0.0; |
549 | 549 | } |
550 | - $prodN *= pow((double) $val, (double) $n); |
|
551 | - if ($prodN > 10 * $n) { |
|
550 | + $prodN *= pow((double)$val, (double)$n); |
|
551 | + if ($prodN > 10*$n) { |
|
552 | 552 | $partial[] = $prodN; |
553 | 553 | $prodN = 1.0; |
554 | 554 | } |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | } catch (\PEAR_Exception $e) { |
616 | 616 | return $count; |
617 | 617 | } |
618 | - $this->_calculatedValues['mean'] = $sum / $count; |
|
618 | + $this->_calculatedValues['mean'] = $sum/$count; |
|
619 | 619 | } catch (\PEAR_Exception $e) { |
620 | 620 | return $sum; |
621 | 621 | } |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | return $count; |
815 | 815 | } |
816 | 816 | |
817 | - $this->_calculatedValues['skewness'] = ($sumdiff3 / ($count * pow($stDev, 3))); |
|
817 | + $this->_calculatedValues['skewness'] = ($sumdiff3/($count*pow($stDev, 3))); |
|
818 | 818 | } |
819 | 819 | return $this->_calculatedValues['skewness']; |
820 | 820 | } |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | return $count; |
857 | 857 | } |
858 | 858 | |
859 | - $this->_calculatedValues['kurtosis'] = ($sumdiff4 / ($count * pow($stDev, 4))) - 3; |
|
859 | + $this->_calculatedValues['kurtosis'] = ($sumdiff4/($count*pow($stDev, 4))) - 3; |
|
860 | 860 | } |
861 | 861 | return $this->_calculatedValues['kurtosis']; |
862 | 862 | } |
@@ -891,9 +891,9 @@ discard block |
||
891 | 891 | return $n; |
892 | 892 | } |
893 | 893 | |
894 | - $h = intval($n / 2); |
|
895 | - if ($n % 2 == 0) { |
|
896 | - $median = ($arr[$h] + $arr[$h - 1]) / 2; |
|
894 | + $h = intval($n/2); |
|
895 | + if ($n%2 == 0) { |
|
896 | + $median = ($arr[$h] + $arr[$h - 1])/2; |
|
897 | 897 | } else { |
898 | 898 | $median = $arr[$h]; |
899 | 899 | } |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | return $min; |
972 | 972 | } |
973 | 973 | |
974 | - $this->_calculatedValues['midrange'] = (($max + $min) / 2); |
|
974 | + $this->_calculatedValues['midrange'] = (($max + $min)/2); |
|
975 | 975 | } |
976 | 976 | return $this->_calculatedValues['midrange']; |
977 | 977 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | if (is_array($prod)) { |
1003 | 1003 | $geomMean = 1.0; |
1004 | 1004 | foreach ($prod as $val) { |
1005 | - $geomMean *= pow($val, 1 / $count); |
|
1005 | + $geomMean *= pow($val, 1/$count); |
|
1006 | 1006 | } |
1007 | 1007 | $this->_calculatedValues['geometricMean'] = $geomMean; |
1008 | 1008 | } else { |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | if ($prod < 0) { |
1013 | 1013 | throw new \PEAR_Exception('The product of the data set is negative, geometric mean undefined.'); |
1014 | 1014 | } |
1015 | - $this->_calculatedValues['geometricMean'] = pow($prod, 1 / $count); |
|
1015 | + $this->_calculatedValues['geometricMean'] = pow($prod, 1/$count); |
|
1016 | 1016 | } |
1017 | 1017 | } |
1018 | 1018 | return $this->_calculatedValues['geometricMean']; |
@@ -1042,21 +1042,21 @@ discard block |
||
1042 | 1042 | if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) { |
1043 | 1043 | foreach ($this->_data as $val => $freq) { |
1044 | 1044 | if ($val == 0) { |
1045 | - throw new \PEAR_Exception('cannot calculate a ' . |
|
1045 | + throw new \PEAR_Exception('cannot calculate a '. |
|
1046 | 1046 | 'harmonic mean with data values of zero.'); |
1047 | 1047 | } |
1048 | - $invsum += $freq / $val; |
|
1048 | + $invsum += $freq/$val; |
|
1049 | 1049 | } |
1050 | 1050 | } else { |
1051 | 1051 | foreach ($this->_data as $val) { |
1052 | 1052 | if ($val == 0) { |
1053 | - throw new \PEAR_Exception('cannot calculate a ' . |
|
1053 | + throw new \PEAR_Exception('cannot calculate a '. |
|
1054 | 1054 | 'harmonic mean with data values of zero.'); |
1055 | 1055 | } |
1056 | - $invsum += 1 / $val; |
|
1056 | + $invsum += 1/$val; |
|
1057 | 1057 | } |
1058 | 1058 | } |
1059 | - $this->_calculatedValues['harmonicMean'] = $count / $invsum; |
|
1059 | + $this->_calculatedValues['harmonicMean'] = $count/$invsum; |
|
1060 | 1060 | } |
1061 | 1061 | return $this->_calculatedValues['harmonicMean']; |
1062 | 1062 | } |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | return $count; |
1090 | 1090 | } |
1091 | 1091 | if ($count == 0) { |
1092 | - throw new \PEAR_Exception("Cannot calculate {$n}th sample moment, " . |
|
1092 | + throw new \PEAR_Exception("Cannot calculate {$n}th sample moment, ". |
|
1093 | 1093 | 'there are zero data entries'); |
1094 | 1094 | } |
1095 | 1095 | try { |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | } catch (\PEAR_Exception $e) { |
1098 | 1098 | return $sum; |
1099 | 1099 | } |
1100 | - return ($sum / $count); |
|
1100 | + return ($sum/$count); |
|
1101 | 1101 | } |
1102 | 1102 | |
1103 | 1103 | /** |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | return $count; |
1126 | 1126 | } |
1127 | 1127 | if ($count == 0) { |
1128 | - throw new \PEAR_Exception("Cannot calculate {$n}th raw moment, " . |
|
1128 | + throw new \PEAR_Exception("Cannot calculate {$n}th raw moment, ". |
|
1129 | 1129 | 'there are zero data entries.'); |
1130 | 1130 | } |
1131 | 1131 | try { |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | } catch (\PEAR_Exception $e) { |
1134 | 1134 | return $sum; |
1135 | 1135 | } |
1136 | - return ($sum / $count); |
|
1136 | + return ($sum/$count); |
|
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | /** |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | } |
1159 | 1159 | |
1160 | 1160 | if ($mean == 0.0) { |
1161 | - throw new \PEAR_Exception('cannot calculate the coefficient ' . |
|
1161 | + throw new \PEAR_Exception('cannot calculate the coefficient '. |
|
1162 | 1162 | 'of variation, mean of sample is zero'); |
1163 | 1163 | } |
1164 | 1164 | try { |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | return $stDev; |
1168 | 1168 | } |
1169 | 1169 | |
1170 | - $this->_calculatedValues['coeffOfVariation'] = $stDev / $mean; |
|
1170 | + $this->_calculatedValues['coeffOfVariation'] = $stDev/$mean; |
|
1171 | 1171 | } |
1172 | 1172 | return $this->_calculatedValues['coeffOfVariation']; |
1173 | 1173 | } |
@@ -1202,7 +1202,7 @@ discard block |
||
1202 | 1202 | } catch (\PEAR_Exception $e) { |
1203 | 1203 | return $stDev; |
1204 | 1204 | } |
1205 | - $this->_calculatedValues['stdErrorOfMean'] = $stDev / sqrt($count); |
|
1205 | + $this->_calculatedValues['stdErrorOfMean'] = $stDev/sqrt($count); |
|
1206 | 1206 | } |
1207 | 1207 | return $this->_calculatedValues['stdErrorOfMean']; |
1208 | 1208 | } |
@@ -1309,10 +1309,10 @@ discard block |
||
1309 | 1309 | } |
1310 | 1310 | } |
1311 | 1311 | if ($n == 0) { |
1312 | - throw new \PEAR_Exception('error calculating interquartile mean, ' . |
|
1312 | + throw new \PEAR_Exception('error calculating interquartile mean, '. |
|
1313 | 1313 | 'empty interquartile range of values.'); |
1314 | 1314 | } |
1315 | - $this->_calculatedValues['interquartileMean'] = $sum / $n; |
|
1315 | + $this->_calculatedValues['interquartileMean'] = $sum/$n; |
|
1316 | 1316 | } |
1317 | 1317 | return $this->_calculatedValues['interquartileMean']; |
1318 | 1318 | } |
@@ -1365,7 +1365,7 @@ discard block |
||
1365 | 1365 | } catch (\PEAR_Exception $e) { |
1366 | 1366 | return $iqr; |
1367 | 1367 | } |
1368 | - $this->_calculatedValues['quartileDeviation'] = $iqr / 2; |
|
1368 | + $this->_calculatedValues['quartileDeviation'] = $iqr/2; |
|
1369 | 1369 | } |
1370 | 1370 | return $this->_calculatedValues['quartileDeviation']; |
1371 | 1371 | } |
@@ -1394,7 +1394,7 @@ discard block |
||
1394 | 1394 | $q1 = $quart['25']; |
1395 | 1395 | $d = $q3 - $q1; |
1396 | 1396 | $s = $q3 + $q1; |
1397 | - $this->_calculatedValues['quartileVariationCoefficient'] = 100 * $d / $s; |
|
1397 | + $this->_calculatedValues['quartileVariationCoefficient'] = 100*$d/$s; |
|
1398 | 1398 | } |
1399 | 1399 | return $this->_calculatedValues['quartileVariationCoefficient']; |
1400 | 1400 | } |
@@ -1423,9 +1423,9 @@ discard block |
||
1423 | 1423 | $q3 = $quart['75']; |
1424 | 1424 | $q2 = $quart['50']; |
1425 | 1425 | $q1 = $quart['25']; |
1426 | - $d = $q3 - 2 * $q2 + $q1; |
|
1426 | + $d = $q3 - 2*$q2 + $q1; |
|
1427 | 1427 | $s = $q3 - $q1; |
1428 | - $this->_calculatedValues['quartileSkewnessCoefficient'] = $d / $s; |
|
1428 | + $this->_calculatedValues['quartileSkewnessCoefficient'] = $d/$s; |
|
1429 | 1429 | } |
1430 | 1430 | return $this->_calculatedValues['quartileSkewnessCoefficient']; |
1431 | 1431 | } |
@@ -1467,7 +1467,7 @@ discard block |
||
1467 | 1467 | } else { |
1468 | 1468 | $data = &$this->_data; |
1469 | 1469 | } |
1470 | - $obsidx = $p * ($count + 1) / 100; |
|
1470 | + $obsidx = $p*($count + 1)/100; |
|
1471 | 1471 | if (intval($obsidx) == $obsidx) { |
1472 | 1472 | return $data[($obsidx - 1)]; |
1473 | 1473 | } elseif ($obsidx < 1) { |
@@ -1477,7 +1477,7 @@ discard block |
||
1477 | 1477 | } else { |
1478 | 1478 | $left = floor($obsidx - 1); |
1479 | 1479 | $right = ceil($obsidx - 1); |
1480 | - return ($data[$left] + $data[$right]) / 2; |
|
1480 | + return ($data[$left] + $data[$right])/2; |
|
1481 | 1481 | } |
1482 | 1482 | } |
1483 | 1483 | |
@@ -1511,11 +1511,11 @@ discard block |
||
1511 | 1511 | $sdiff = 0; |
1512 | 1512 | if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) { |
1513 | 1513 | foreach ($this->_data as $val => $freq) { |
1514 | - $sdiff += $freq * pow((double) ($val - $mean), (double) $power); |
|
1514 | + $sdiff += $freq*pow((double)($val - $mean), (double)$power); |
|
1515 | 1515 | } |
1516 | 1516 | } else { |
1517 | 1517 | foreach ($this->_data as $val) { |
1518 | - $sdiff += pow((double) ($val - $mean), (double) $power); |
|
1518 | + $sdiff += pow((double)($val - $mean), (double)$power); |
|
1519 | 1519 | } |
1520 | 1520 | } |
1521 | 1521 | return $sdiff; |
@@ -1550,7 +1550,7 @@ discard block |
||
1550 | 1550 | if ($count == 1) { |
1551 | 1551 | throw new \PEAR_Exception('cannot calculate variance of a singe data point'); |
1552 | 1552 | } |
1553 | - return ($sumdiff2 / ($count - 1)); |
|
1553 | + return ($sumdiff2/($count - 1)); |
|
1554 | 1554 | } |
1555 | 1555 | |
1556 | 1556 | /** |
@@ -1579,7 +1579,7 @@ discard block |
||
1579 | 1579 | return $count; |
1580 | 1580 | } |
1581 | 1581 | |
1582 | - return $sumabsdev / $count; |
|
1582 | + return $sumabsdev/$count; |
|
1583 | 1583 | } |
1584 | 1584 | |
1585 | 1585 | /** |
@@ -1603,7 +1603,7 @@ discard block |
||
1603 | 1603 | $sdev = 0; |
1604 | 1604 | if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) { |
1605 | 1605 | foreach ($this->_data as $val => $freq) { |
1606 | - $sdev += $freq * abs($val - $mean); |
|
1606 | + $sdev += $freq*abs($val - $mean); |
|
1607 | 1607 | } |
1608 | 1608 | } else { |
1609 | 1609 | foreach ($this->_data as $val) { |