Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Statistical often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Statistical, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
42 | { |
||
43 | if (!is_array($array1)) { |
||
44 | $array1 = array($array1); |
||
45 | } |
||
46 | if (!is_array($array2)) { |
||
47 | $array2 = array($array2); |
||
48 | } |
||
49 | |||
50 | $array1 = Functions::flattenArray($array1); |
||
51 | $array2 = Functions::flattenArray($array2); |
||
52 | View Code Duplication | foreach ($array1 as $key => $value) { |
|
|
|||
53 | if ((is_bool($value)) || (is_string($value)) || (is_null($value))) { |
||
54 | unset($array1[$key]); |
||
55 | unset($array2[$key]); |
||
56 | } |
||
57 | } |
||
58 | View Code Duplication | foreach ($array2 as $key => $value) { |
|
59 | if ((is_bool($value)) || (is_string($value)) || (is_null($value))) { |
||
60 | unset($array1[$key]); |
||
61 | unset($array2[$key]); |
||
62 | } |
||
63 | } |
||
64 | $array1 = array_merge($array1); |
||
65 | $array2 = array_merge($array2); |
||
66 | |||
67 | return true; |
||
68 | } |
||
69 | |||
70 | |||
71 | /** |
||
72 | * Beta function. |
||
73 | * |
||
74 | * @author Jaco van Kooten |
||
75 | * |
||
76 | * @param p require p>0 |
||
77 | * @param q require q>0 |
||
78 | * @return 0 if p<=0, q<=0 or p+q>2.55E305 to avoid errors and over/underflow |
||
79 | */ |
||
80 | private static function beta($p, $q) |
||
88 | |||
89 | |||
90 | /** |
||
91 | * Incomplete beta function |
||
92 | * |
||
93 | * @author Jaco van Kooten |
||
94 | * @author Paul Meagher |
||
95 | * |
||
96 | * The computation is based on formulas from Numerical Recipes, Chapter 6.4 (W.H. Press et al, 1992). |
||
97 | * @param x require 0<=x<=1 |
||
98 | * @param p require p>0 |
||
99 | * @param q require q>0 |
||
100 | * @return 0 if x<0, p<=0, q<=0 or p+q>2.55E305 and 1 if x>1 to avoid errors and over/underflow |
||
101 | */ |
||
102 | private static function incompleteBeta($x, $p, $q) |
||
118 | |||
119 | |||
120 | // Function cache for logBeta function |
||
121 | private static $logBetaCacheP = 0.0; |
||
122 | private static $logBetaCacheQ = 0.0; |
||
123 | private static $logBetaCacheResult = 0.0; |
||
124 | |||
125 | /** |
||
126 | * The natural logarithm of the beta function. |
||
127 | * |
||
128 | * @param p require p>0 |
||
129 | * @param q require q>0 |
||
130 | * @return 0 if p<=0, q<=0 or p+q>2.55E305 to avoid errors and over/underflow |
||
131 | * @author Jaco van Kooten |
||
132 | */ |
||
133 | private static function logBeta($p, $q) |
||
146 | |||
147 | |||
148 | /** |
||
149 | * Evaluates of continued fraction part of incomplete beta function. |
||
150 | * Based on an idea from Numerical Recipes (W.H. Press et al, 1992). |
||
151 | * @author Jaco van Kooten |
||
152 | */ |
||
153 | private static function betaFraction($x, $p, $q) |
||
198 | |||
199 | |||
200 | /** |
||
201 | * logGamma function |
||
202 | * |
||
203 | * @version 1.1 |
||
204 | * @author Jaco van Kooten |
||
205 | * |
||
206 | * Original author was Jaco van Kooten. Ported to PHP by Paul Meagher. |
||
207 | * |
||
208 | * The natural logarithm of the gamma function. <br /> |
||
209 | * Based on public domain NETLIB (Fortran) code by W. J. Cody and L. Stoltz <br /> |
||
210 | * Applied Mathematics Division <br /> |
||
211 | * Argonne National Laboratory <br /> |
||
212 | * Argonne, IL 60439 <br /> |
||
213 | * <p> |
||
214 | * References: |
||
215 | * <ol> |
||
216 | * <li>W. J. Cody and K. E. Hillstrom, 'Chebyshev Approximations for the Natural |
||
217 | * Logarithm of the Gamma Function,' Math. Comp. 21, 1967, pp. 198-203.</li> |
||
218 | * <li>K. E. Hillstrom, ANL/AMD Program ANLC366S, DGAMMA/DLGAMA, May, 1969.</li> |
||
219 | * <li>Hart, Et. Al., Computer Approximations, Wiley and sons, New York, 1968.</li> |
||
220 | * </ol> |
||
221 | * </p> |
||
222 | * <p> |
||
223 | * From the original documentation: |
||
224 | * </p> |
||
225 | * <p> |
||
226 | * This routine calculates the LOG(GAMMA) function for a positive real argument X. |
||
227 | * Computation is based on an algorithm outlined in references 1 and 2. |
||
228 | * The program uses rational functions that theoretically approximate LOG(GAMMA) |
||
229 | * to at least 18 significant decimal digits. The approximation for X > 12 is from |
||
230 | * reference 3, while approximations for X < 12.0 are similar to those in reference |
||
231 | * 1, but are unpublished. The accuracy achieved depends on the arithmetic system, |
||
232 | * the compiler, the intrinsic functions, and proper selection of the |
||
233 | * machine-dependent constants. |
||
234 | * </p> |
||
235 | * <p> |
||
236 | * Error returns: <br /> |
||
237 | * The program returns the value XINF for X .LE. 0.0 or when overflow would occur. |
||
238 | * The computation is believed to be free of underflow and overflow. |
||
239 | * </p> |
||
240 | * @return MAX_VALUE for x < 0.0 or when overflow would occur, i.e. x > 2.55E305 |
||
241 | */ |
||
242 | |||
243 | // Function cache for logGamma |
||
244 | private static $logGammaCacheResult = 0.0; |
||
245 | private static $logGammaCacheX = 0.0; |
||
246 | |||
247 | private static function logGamma($x) |
||
419 | |||
420 | |||
421 | // |
||
422 | // Private implementation of the incomplete Gamma function |
||
423 | // |
||
424 | private static function incompleteGamma($a, $x) |
||
437 | |||
438 | |||
439 | // |
||
440 | // Private implementation of the Gamma function |
||
441 | // |
||
442 | private static function gamma($data) |
||
468 | |||
469 | |||
470 | /*************************************************************************** |
||
471 | * inverse_ncdf.php |
||
472 | * ------------------- |
||
473 | * begin : Friday, January 16, 2004 |
||
474 | * copyright : (C) 2004 Michael Nickerson |
||
475 | * email : [email protected] |
||
476 | * |
||
477 | ***************************************************************************/ |
||
478 | private static function inverseNcdf($p) |
||
550 | |||
551 | |||
552 | private static function inverseNcdf2($prob) |
||
594 | |||
595 | |||
596 | private static function inverseNcdf3($p) |
||
695 | |||
696 | |||
697 | /** |
||
698 | * AVEDEV |
||
699 | * |
||
700 | * Returns the average of the absolute deviations of data points from their mean. |
||
701 | * AVEDEV is a measure of the variability in a data set. |
||
702 | * |
||
703 | * Excel Function: |
||
704 | * AVEDEV(value1[,value2[, ...]]) |
||
705 | * |
||
706 | * @access public |
||
707 | * @category Statistical Functions |
||
708 | * @param mixed $arg,... Data values |
||
709 | * @return float |
||
710 | */ |
||
711 | View Code Duplication | public static function AVEDEV() |
|
745 | |||
746 | |||
747 | /** |
||
748 | * AVERAGE |
||
749 | * |
||
750 | * Returns the average (arithmetic mean) of the arguments |
||
751 | * |
||
752 | * Excel Function: |
||
753 | * AVERAGE(value1[,value2[, ...]]) |
||
754 | * |
||
755 | * @access public |
||
756 | * @category Statistical Functions |
||
757 | * @param mixed $arg,... Data values |
||
758 | * @return float |
||
759 | */ |
||
760 | public static function AVERAGE() |
||
788 | |||
789 | |||
790 | /** |
||
791 | * AVERAGEA |
||
792 | * |
||
793 | * Returns the average of its arguments, including numbers, text, and logical values |
||
794 | * |
||
795 | * Excel Function: |
||
796 | * AVERAGEA(value1[,value2[, ...]]) |
||
797 | * |
||
798 | * @access public |
||
799 | * @category Statistical Functions |
||
800 | * @param mixed $arg,... Data values |
||
801 | * @return float |
||
802 | */ |
||
803 | public static function AVERAGEA() |
||
835 | |||
836 | |||
837 | /** |
||
838 | * AVERAGEIF |
||
839 | * |
||
840 | * Returns the average value from a range of cells that contain numbers within the list of arguments |
||
841 | * |
||
842 | * Excel Function: |
||
843 | * AVERAGEIF(value1[,value2[, ...]],condition) |
||
844 | * |
||
845 | * @access public |
||
846 | * @category Mathematical and Trigonometric Functions |
||
847 | * @param mixed $arg,... Data values |
||
848 | * @param string $condition The criteria that defines which cells will be checked. |
||
849 | * @param mixed[] $averageArgs Data values |
||
850 | * @return float |
||
851 | */ |
||
852 | public static function AVERAGEIF($aArgs, $condition, $averageArgs = array()) |
||
882 | |||
883 | |||
884 | /** |
||
885 | * BETADIST |
||
886 | * |
||
887 | * Returns the beta distribution. |
||
888 | * |
||
889 | * @param float $value Value at which you want to evaluate the distribution |
||
890 | * @param float $alpha Parameter to the distribution |
||
891 | * @param float $beta Parameter to the distribution |
||
892 | * @param boolean $cumulative |
||
893 | * @return float |
||
894 | * |
||
895 | */ |
||
896 | public static function BETADIST($value, $alpha, $beta, $rMin = 0, $rMax = 1) |
||
919 | |||
920 | |||
921 | /** |
||
922 | * BETAINV |
||
923 | * |
||
924 | * Returns the inverse of the beta distribution. |
||
925 | * |
||
926 | * @param float $probability Probability at which you want to evaluate the distribution |
||
927 | * @param float $alpha Parameter to the distribution |
||
928 | * @param float $beta Parameter to the distribution |
||
929 | * @param float $rMin Minimum value |
||
930 | * @param float $rMax Maximum value |
||
931 | * @param boolean $cumulative |
||
932 | * @return float |
||
933 | * |
||
934 | */ |
||
935 | public static function BETAINV($probability, $alpha, $beta, $rMin = 0, $rMax = 1) |
||
974 | |||
975 | |||
976 | /** |
||
977 | * BINOMDIST |
||
978 | * |
||
979 | * Returns the individual term binomial distribution probability. Use BINOMDIST in problems with |
||
980 | * a fixed number of tests or trials, when the outcomes of any trial are only success or failure, |
||
981 | * when trials are independent, and when the probability of success is constant throughout the |
||
982 | * experiment. For example, BINOMDIST can calculate the probability that two of the next three |
||
983 | * babies born are male. |
||
984 | * |
||
985 | * @param float $value Number of successes in trials |
||
986 | * @param float $trials Number of trials |
||
987 | * @param float $probability Probability of success on each trial |
||
988 | * @param boolean $cumulative |
||
989 | * @return float |
||
990 | * |
||
991 | * @todo Cumulative distribution function |
||
992 | * |
||
993 | */ |
||
994 | public static function BINOMDIST($value, $trials, $probability, $cumulative) |
||
1021 | |||
1022 | |||
1023 | /** |
||
1024 | * CHIDIST |
||
1025 | * |
||
1026 | * Returns the one-tailed probability of the chi-squared distribution. |
||
1027 | * |
||
1028 | * @param float $value Value for the function |
||
1029 | * @param float $degrees degrees of freedom |
||
1030 | * @return float |
||
1031 | */ |
||
1032 | public static function CHIDIST($value, $degrees) |
||
1051 | |||
1052 | |||
1053 | /** |
||
1054 | * CHIINV |
||
1055 | * |
||
1056 | * Returns the one-tailed probability of the chi-squared distribution. |
||
1057 | * |
||
1058 | * @param float $probability Probability for the function |
||
1059 | * @param float $degrees degrees of freedom |
||
1060 | * @return float |
||
1061 | */ |
||
1062 | View Code Duplication | public static function CHIINV($probability, $degrees) |
|
1107 | |||
1108 | |||
1109 | /** |
||
1110 | * CONFIDENCE |
||
1111 | * |
||
1112 | * Returns the confidence interval for a population mean |
||
1113 | * |
||
1114 | * @param float $alpha |
||
1115 | * @param float $stdDev Standard Deviation |
||
1116 | * @param float $size |
||
1117 | * @return float |
||
1118 | * |
||
1119 | */ |
||
1120 | public static function CONFIDENCE($alpha, $stdDev, $size) |
||
1137 | |||
1138 | |||
1139 | /** |
||
1140 | * CORREL |
||
1141 | * |
||
1142 | * Returns covariance, the average of the products of deviations for each data point pair. |
||
1143 | * |
||
1144 | * @param array of mixed Data Series Y |
||
1145 | * @param array of mixed Data Series X |
||
1146 | * @return float |
||
1147 | */ |
||
1148 | public static function CORREL($yValues, $xValues = null) |
||
1168 | |||
1169 | |||
1170 | /** |
||
1171 | * COUNT |
||
1172 | * |
||
1173 | * Counts the number of cells that contain numbers within the list of arguments |
||
1174 | * |
||
1175 | * Excel Function: |
||
1176 | * COUNT(value1[,value2[, ...]]) |
||
1177 | * |
||
1178 | * @access public |
||
1179 | * @category Statistical Functions |
||
1180 | * @param mixed $arg,... Data values |
||
1181 | * @return int |
||
1182 | */ |
||
1183 | public static function COUNT() |
||
1202 | |||
1203 | |||
1204 | /** |
||
1205 | * COUNTA |
||
1206 | * |
||
1207 | * Counts the number of cells that are not empty within the list of arguments |
||
1208 | * |
||
1209 | * Excel Function: |
||
1210 | * COUNTA(value1[,value2[, ...]]) |
||
1211 | * |
||
1212 | * @access public |
||
1213 | * @category Statistical Functions |
||
1214 | * @param mixed $arg,... Data values |
||
1215 | * @return int |
||
1216 | */ |
||
1217 | View Code Duplication | public static function COUNTA() |
|
1232 | |||
1233 | |||
1234 | /** |
||
1235 | * COUNTBLANK |
||
1236 | * |
||
1237 | * Counts the number of empty cells within the list of arguments |
||
1238 | * |
||
1239 | * Excel Function: |
||
1240 | * COUNTBLANK(value1[,value2[, ...]]) |
||
1241 | * |
||
1242 | * @access public |
||
1243 | * @category Statistical Functions |
||
1244 | * @param mixed $arg,... Data values |
||
1245 | * @return int |
||
1246 | */ |
||
1247 | View Code Duplication | public static function COUNTBLANK() |
|
1262 | |||
1263 | |||
1264 | /** |
||
1265 | * COUNTIF |
||
1266 | * |
||
1267 | * Counts the number of cells that contain numbers within the list of arguments |
||
1268 | * |
||
1269 | * Excel Function: |
||
1270 | * COUNTIF(value1[,value2[, ...]],condition) |
||
1271 | * |
||
1272 | * @access public |
||
1273 | * @category Statistical Functions |
||
1274 | * @param mixed $arg,... Data values |
||
1275 | * @param string $condition The criteria that defines which cells will be counted. |
||
1276 | * @return int |
||
1277 | */ |
||
1278 | public static function COUNTIF($aArgs, $condition) |
||
1298 | |||
1299 | |||
1300 | /** |
||
1301 | * COVAR |
||
1302 | * |
||
1303 | * Returns covariance, the average of the products of deviations for each data point pair. |
||
1304 | * |
||
1305 | * @param array of mixed Data Series Y |
||
1306 | * @param array of mixed Data Series X |
||
1307 | * @return float |
||
1308 | */ |
||
1309 | View Code Duplication | public static function COVAR($yValues, $xValues) |
|
1326 | |||
1327 | |||
1328 | /** |
||
1329 | * CRITBINOM |
||
1330 | * |
||
1331 | * Returns the smallest value for which the cumulative binomial distribution is greater |
||
1332 | * than or equal to a criterion value |
||
1333 | * |
||
1334 | * See http://support.microsoft.com/kb/828117/ for details of the algorithm used |
||
1335 | * |
||
1336 | * @param float $trials number of Bernoulli trials |
||
1337 | * @param float $probability probability of a success on each trial |
||
1338 | * @param float $alpha criterion value |
||
1339 | * @return int |
||
1340 | * |
||
1341 | * @todo Warning. This implementation differs from the algorithm detailed on the MS |
||
1342 | * web site in that $CumPGuessMinus1 = $CumPGuess - 1 rather than $CumPGuess - $PGuess |
||
1343 | * This eliminates a potential endless loop error, but may have an adverse affect on the |
||
1344 | * accuracy of the function (although all my tests have so far returned correct results). |
||
1345 | * |
||
1346 | */ |
||
1347 | public static function CRITBINOM($trials, $probability, $alpha) |
||
1450 | |||
1451 | |||
1452 | /** |
||
1453 | * DEVSQ |
||
1454 | * |
||
1455 | * Returns the sum of squares of deviations of data points from their sample mean. |
||
1456 | * |
||
1457 | * Excel Function: |
||
1458 | * DEVSQ(value1[,value2[, ...]]) |
||
1459 | * |
||
1460 | * @access public |
||
1461 | * @category Statistical Functions |
||
1462 | * @param mixed $arg,... Data values |
||
1463 | * @return float |
||
1464 | */ |
||
1465 | View Code Duplication | public static function DEVSQ() |
|
1501 | |||
1502 | |||
1503 | /** |
||
1504 | * EXPONDIST |
||
1505 | * |
||
1506 | * Returns the exponential distribution. Use EXPONDIST to model the time between events, |
||
1507 | * such as how long an automated bank teller takes to deliver cash. For example, you can |
||
1508 | * use EXPONDIST to determine the probability that the process takes at most 1 minute. |
||
1509 | * |
||
1510 | * @param float $value Value of the function |
||
1511 | * @param float $lambda The parameter value |
||
1512 | * @param boolean $cumulative |
||
1513 | * @return float |
||
1514 | */ |
||
1515 | public static function EXPONDIST($value, $lambda, $cumulative) |
||
1535 | |||
1536 | |||
1537 | /** |
||
1538 | * FISHER |
||
1539 | * |
||
1540 | * Returns the Fisher transformation at x. This transformation produces a function that |
||
1541 | * is normally distributed rather than skewed. Use this function to perform hypothesis |
||
1542 | * testing on the correlation coefficient. |
||
1543 | * |
||
1544 | * @param float $value |
||
1545 | * @return float |
||
1546 | */ |
||
1547 | public static function FISHER($value) |
||
1559 | |||
1560 | |||
1561 | /** |
||
1562 | * FISHERINV |
||
1563 | * |
||
1564 | * Returns the inverse of the Fisher transformation. Use this transformation when |
||
1565 | * analyzing correlations between ranges or arrays of data. If y = FISHER(x), then |
||
1566 | * FISHERINV(y) = x. |
||
1567 | * |
||
1568 | * @param float $value |
||
1569 | * @return float |
||
1570 | */ |
||
1571 | public static function FISHERINV($value) |
||
1580 | |||
1581 | |||
1582 | /** |
||
1583 | * FORECAST |
||
1584 | * |
||
1585 | * Calculates, or predicts, a future value by using existing values. The predicted value is a y-value for a given x-value. |
||
1586 | * |
||
1587 | * @param float Value of X for which we want to find Y |
||
1588 | * @param array of mixed Data Series Y |
||
1589 | * @param array of mixed Data Series X |
||
1590 | * @return float |
||
1591 | */ |
||
1592 | public static function FORECAST($xValue, $yValues, $xValues) |
||
1612 | |||
1613 | |||
1614 | /** |
||
1615 | * GAMMADIST |
||
1616 | * |
||
1617 | * Returns the gamma distribution. |
||
1618 | * |
||
1619 | * @param float $value Value at which you want to evaluate the distribution |
||
1620 | * @param float $a Parameter to the distribution |
||
1621 | * @param float $b Parameter to the distribution |
||
1622 | * @param boolean $cumulative |
||
1623 | * @return float |
||
1624 | * |
||
1625 | */ |
||
1626 | public static function GAMMADIST($value, $a, $b, $cumulative) |
||
1646 | |||
1647 | |||
1648 | /** |
||
1649 | * GAMMAINV |
||
1650 | * |
||
1651 | * Returns the inverse of the beta distribution. |
||
1652 | * |
||
1653 | * @param float $probability Probability at which you want to evaluate the distribution |
||
1654 | * @param float $alpha Parameter to the distribution |
||
1655 | * @param float $beta Parameter to the distribution |
||
1656 | * @return float |
||
1657 | * |
||
1658 | */ |
||
1659 | public static function GAMMAINV($probability, $alpha, $beta) |
||
1708 | |||
1709 | |||
1710 | /** |
||
1711 | * GAMMALN |
||
1712 | * |
||
1713 | * Returns the natural logarithm of the gamma function. |
||
1714 | * |
||
1715 | * @param float $value |
||
1716 | * @return float |
||
1717 | */ |
||
1718 | View Code Duplication | public static function GAMMALN($value) |
|
1730 | |||
1731 | |||
1732 | /** |
||
1733 | * GEOMEAN |
||
1734 | * |
||
1735 | * Returns the geometric mean of an array or range of positive data. For example, you |
||
1736 | * can use GEOMEAN to calculate average growth rate given compound interest with |
||
1737 | * variable rates. |
||
1738 | * |
||
1739 | * Excel Function: |
||
1740 | * GEOMEAN(value1[,value2[, ...]]) |
||
1741 | * |
||
1742 | * @access public |
||
1743 | * @category Statistical Functions |
||
1744 | * @param mixed $arg,... Data values |
||
1745 | * @return float |
||
1746 | */ |
||
1747 | public static function GEOMEAN() |
||
1760 | |||
1761 | |||
1762 | /** |
||
1763 | * GROWTH |
||
1764 | * |
||
1765 | * Returns values along a predicted emponential Trend |
||
1766 | * |
||
1767 | * @param array of mixed Data Series Y |
||
1768 | * @param array of mixed Data Series X |
||
1769 | * @param array of mixed Values of X for which we want to find Y |
||
1770 | * @param boolean A logical value specifying whether to force the intersect to equal 0. |
||
1771 | * @return array of float |
||
1772 | */ |
||
1773 | View Code Duplication | public static function GROWTH($yValues, $xValues = array(), $newValues = array(), $const = true) |
|
1792 | |||
1793 | |||
1794 | /** |
||
1795 | * HARMEAN |
||
1796 | * |
||
1797 | * Returns the harmonic mean of a data set. The harmonic mean is the reciprocal of the |
||
1798 | * arithmetic mean of reciprocals. |
||
1799 | * |
||
1800 | * Excel Function: |
||
1801 | * HARMEAN(value1[,value2[, ...]]) |
||
1802 | * |
||
1803 | * @access public |
||
1804 | * @category Statistical Functions |
||
1805 | * @param mixed $arg,... Data values |
||
1806 | * @return float |
||
1807 | */ |
||
1808 | public static function HARMEAN() |
||
1841 | |||
1842 | |||
1843 | /** |
||
1844 | * HYPGEOMDIST |
||
1845 | * |
||
1846 | * Returns the hypergeometric distribution. HYPGEOMDIST returns the probability of a given number of |
||
1847 | * sample successes, given the sample size, population successes, and population size. |
||
1848 | * |
||
1849 | * @param float $sampleSuccesses Number of successes in the sample |
||
1850 | * @param float $sampleNumber Size of the sample |
||
1851 | * @param float $populationSuccesses Number of successes in the population |
||
1852 | * @param float $populationNumber Population size |
||
1853 | * @return float |
||
1854 | * |
||
1855 | */ |
||
1856 | public static function HYPGEOMDIST($sampleSuccesses, $sampleNumber, $populationSuccesses, $populationNumber) |
||
1879 | |||
1880 | |||
1881 | /** |
||
1882 | * INTERCEPT |
||
1883 | * |
||
1884 | * Calculates the point at which a line will intersect the y-axis by using existing x-values and y-values. |
||
1885 | * |
||
1886 | * @param array of mixed Data Series Y |
||
1887 | * @param array of mixed Data Series X |
||
1888 | * @return float |
||
1889 | */ |
||
1890 | View Code Duplication | public static function INTERCEPT($yValues, $xValues) |
|
1907 | |||
1908 | |||
1909 | /** |
||
1910 | * KURT |
||
1911 | * |
||
1912 | * Returns the kurtosis of a data set. Kurtosis characterizes the relative peakedness |
||
1913 | * or flatness of a distribution compared with the normal distribution. Positive |
||
1914 | * kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a |
||
1915 | * relatively flat distribution. |
||
1916 | * |
||
1917 | * @param array Data Series |
||
1918 | * @return float |
||
1919 | */ |
||
1920 | public static function KURT() |
||
1948 | |||
1949 | |||
1950 | /** |
||
1951 | * LARGE |
||
1952 | * |
||
1953 | * Returns the nth largest value in a data set. You can use this function to |
||
1954 | * select a value based on its relative standing. |
||
1955 | * |
||
1956 | * Excel Function: |
||
1957 | * LARGE(value1[,value2[, ...]],entry) |
||
1958 | * |
||
1959 | * @access public |
||
1960 | * @category Statistical Functions |
||
1961 | * @param mixed $arg,... Data values |
||
1962 | * @param int $entry Position (ordered from the largest) in the array or range of data to return |
||
1963 | * @return float |
||
1964 | * |
||
1965 | */ |
||
1966 | View Code Duplication | public static function LARGE() |
|
1991 | |||
1992 | |||
1993 | /** |
||
1994 | * LINEST |
||
1995 | * |
||
1996 | * Calculates the statistics for a line by using the "least squares" method to calculate a straight line that best fits your data, |
||
1997 | * and then returns an array that describes the line. |
||
1998 | * |
||
1999 | * @param array of mixed Data Series Y |
||
2000 | * @param array of mixed Data Series X |
||
2001 | * @param boolean A logical value specifying whether to force the intersect to equal 0. |
||
2002 | * @param boolean A logical value specifying whether to return additional regression statistics. |
||
2003 | * @return array |
||
2004 | */ |
||
2005 | public static function LINEST($yValues, $xValues = null, $const = true, $stats = false) |
||
2051 | |||
2052 | |||
2053 | /** |
||
2054 | * LOGEST |
||
2055 | * |
||
2056 | * Calculates an exponential curve that best fits the X and Y data series, |
||
2057 | * and then returns an array that describes the line. |
||
2058 | * |
||
2059 | * @param array of mixed Data Series Y |
||
2060 | * @param array of mixed Data Series X |
||
2061 | * @param boolean A logical value specifying whether to force the intersect to equal 0. |
||
2062 | * @param boolean A logical value specifying whether to return additional regression statistics. |
||
2063 | * @return array |
||
2064 | */ |
||
2065 | public static function LOGEST($yValues, $xValues = null, $const = true, $stats = false) |
||
2117 | |||
2118 | |||
2119 | /** |
||
2120 | * LOGINV |
||
2121 | * |
||
2122 | * Returns the inverse of the normal cumulative distribution |
||
2123 | * |
||
2124 | * @param float $probability |
||
2125 | * @param float $mean |
||
2126 | * @param float $stdDev |
||
2127 | * @return float |
||
2128 | * |
||
2129 | * @todo Try implementing P J Acklam's refinement algorithm for greater |
||
2130 | * accuracy if I can get my head round the mathematics |
||
2131 | * (as described at) http://home.online.no/~pjacklam/notes/invnorm/ |
||
2132 | */ |
||
2133 | View Code Duplication | public static function LOGINV($probability, $mean, $stdDev) |
|
2147 | |||
2148 | |||
2149 | /** |
||
2150 | * LOGNORMDIST |
||
2151 | * |
||
2152 | * Returns the cumulative lognormal distribution of x, where ln(x) is normally distributed |
||
2153 | * with parameters mean and standard_dev. |
||
2154 | * |
||
2155 | * @param float $value |
||
2156 | * @param float $mean |
||
2157 | * @param float $stdDev |
||
2158 | * @return float |
||
2159 | */ |
||
2160 | public static function LOGNORMDIST($value, $mean, $stdDev) |
||
2174 | |||
2175 | |||
2176 | /** |
||
2177 | * MAX |
||
2178 | * |
||
2179 | * MAX returns the value of the element of the values passed that has the highest value, |
||
2180 | * with negative numbers considered smaller than positive numbers. |
||
2181 | * |
||
2182 | * Excel Function: |
||
2183 | * MAX(value1[,value2[, ...]]) |
||
2184 | * |
||
2185 | * @access public |
||
2186 | * @category Statistical Functions |
||
2187 | * @param mixed $arg,... Data values |
||
2188 | * @return float |
||
2189 | */ |
||
2190 | View Code Duplication | public static function MAX() |
|
2210 | |||
2211 | |||
2212 | /** |
||
2213 | * MAXA |
||
2214 | * |
||
2215 | * Returns the greatest value in a list of arguments, including numbers, text, and logical values |
||
2216 | * |
||
2217 | * Excel Function: |
||
2218 | * MAXA(value1[,value2[, ...]]) |
||
2219 | * |
||
2220 | * @access public |
||
2221 | * @category Statistical Functions |
||
2222 | * @param mixed $arg,... Data values |
||
2223 | * @return float |
||
2224 | */ |
||
2225 | View Code Duplication | public static function MAXA() |
|
2250 | |||
2251 | |||
2252 | /** |
||
2253 | * MAXIF |
||
2254 | * |
||
2255 | * Counts the maximum value within a range of cells that contain numbers within the list of arguments |
||
2256 | * |
||
2257 | * Excel Function: |
||
2258 | * MAXIF(value1[,value2[, ...]],condition) |
||
2259 | * |
||
2260 | * @access public |
||
2261 | * @category Mathematical and Trigonometric Functions |
||
2262 | * @param mixed $arg,... Data values |
||
2263 | * @param string $condition The criteria that defines which cells will be checked. |
||
2264 | * @return float |
||
2265 | */ |
||
2266 | View Code Duplication | public static function MAXIF($aArgs, $condition, $sumArgs = array()) |
|
2291 | |||
2292 | /** |
||
2293 | * MEDIAN |
||
2294 | * |
||
2295 | * Returns the median of the given numbers. The median is the number in the middle of a set of numbers. |
||
2296 | * |
||
2297 | * Excel Function: |
||
2298 | * MEDIAN(value1[,value2[, ...]]) |
||
2299 | * |
||
2300 | * @access public |
||
2301 | * @category Statistical Functions |
||
2302 | * @param mixed $arg,... Data values |
||
2303 | * @return float |
||
2304 | */ |
||
2305 | public static function MEDIAN() |
||
2333 | |||
2334 | |||
2335 | /** |
||
2336 | * MIN |
||
2337 | * |
||
2338 | * MIN returns the value of the element of the values passed that has the smallest value, |
||
2339 | * with negative numbers considered smaller than positive numbers. |
||
2340 | * |
||
2341 | * Excel Function: |
||
2342 | * MIN(value1[,value2[, ...]]) |
||
2343 | * |
||
2344 | * @access public |
||
2345 | * @category Statistical Functions |
||
2346 | * @param mixed $arg,... Data values |
||
2347 | * @return float |
||
2348 | */ |
||
2349 | View Code Duplication | public static function MIN() |
|
2369 | |||
2370 | |||
2371 | /** |
||
2372 | * MINA |
||
2373 | * |
||
2374 | * Returns the smallest value in a list of arguments, including numbers, text, and logical values |
||
2375 | * |
||
2376 | * Excel Function: |
||
2377 | * MINA(value1[,value2[, ...]]) |
||
2378 | * |
||
2379 | * @access public |
||
2380 | * @category Statistical Functions |
||
2381 | * @param mixed $arg,... Data values |
||
2382 | * @return float |
||
2383 | */ |
||
2384 | View Code Duplication | public static function MINA() |
|
2409 | |||
2410 | |||
2411 | /** |
||
2412 | * MINIF |
||
2413 | * |
||
2414 | * Returns the minimum value within a range of cells that contain numbers within the list of arguments |
||
2415 | * |
||
2416 | * Excel Function: |
||
2417 | * MINIF(value1[,value2[, ...]],condition) |
||
2418 | * |
||
2419 | * @access public |
||
2420 | * @category Mathematical and Trigonometric Functions |
||
2421 | * @param mixed $arg,... Data values |
||
2422 | * @param string $condition The criteria that defines which cells will be checked. |
||
2423 | * @return float |
||
2424 | */ |
||
2425 | View Code Duplication | public static function MINIF($aArgs, $condition, $sumArgs = array()) |
|
2450 | |||
2451 | |||
2452 | // |
||
2453 | // Special variant of array_count_values that isn't limited to strings and integers, |
||
2454 | // but can work with floating point numbers as values |
||
2455 | // |
||
2456 | private static function modeCalc($data) |
||
2487 | |||
2488 | |||
2489 | /** |
||
2490 | * MODE |
||
2491 | * |
||
2492 | * Returns the most frequently occurring, or repetitive, value in an array or range of data |
||
2493 | * |
||
2494 | * Excel Function: |
||
2495 | * MODE(value1[,value2[, ...]]) |
||
2496 | * |
||
2497 | * @access public |
||
2498 | * @category Statistical Functions |
||
2499 | * @param mixed $arg,... Data values |
||
2500 | * @return float |
||
2501 | */ |
||
2502 | public static function MODE() |
||
2523 | |||
2524 | |||
2525 | /** |
||
2526 | * NEGBINOMDIST |
||
2527 | * |
||
2528 | * Returns the negative binomial distribution. NEGBINOMDIST returns the probability that |
||
2529 | * there will be number_f failures before the number_s-th success, when the constant |
||
2530 | * probability of a success is probability_s. This function is similar to the binomial |
||
2531 | * distribution, except that the number of successes is fixed, and the number of trials is |
||
2532 | * variable. Like the binomial, trials are assumed to be independent. |
||
2533 | * |
||
2534 | * @param float $failures Number of Failures |
||
2535 | * @param float $successes Threshold number of Successes |
||
2536 | * @param float $probability Probability of success on each trial |
||
2537 | * @return float |
||
2538 | * |
||
2539 | */ |
||
2540 | public static function NEGBINOMDIST($failures, $successes, $probability) |
||
2561 | |||
2562 | |||
2563 | /** |
||
2564 | * NORMDIST |
||
2565 | * |
||
2566 | * Returns the normal distribution for the specified mean and standard deviation. This |
||
2567 | * function has a very wide range of applications in statistics, including hypothesis |
||
2568 | * testing. |
||
2569 | * |
||
2570 | * @param float $value |
||
2571 | * @param float $mean Mean Value |
||
2572 | * @param float $stdDev Standard Deviation |
||
2573 | * @param boolean $cumulative |
||
2574 | * @return float |
||
2575 | * |
||
2576 | */ |
||
2577 | public static function NORMDIST($value, $mean, $stdDev, $cumulative) |
||
2597 | |||
2598 | |||
2599 | /** |
||
2600 | * NORMINV |
||
2601 | * |
||
2602 | * Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation. |
||
2603 | * |
||
2604 | * @param float $value |
||
2605 | * @param float $mean Mean Value |
||
2606 | * @param float $stdDev Standard Deviation |
||
2607 | * @return float |
||
2608 | * |
||
2609 | */ |
||
2610 | View Code Duplication | public static function NORMINV($probability, $mean, $stdDev) |
|
2627 | |||
2628 | |||
2629 | /** |
||
2630 | * NORMSDIST |
||
2631 | * |
||
2632 | * Returns the standard normal cumulative distribution function. The distribution has |
||
2633 | * a mean of 0 (zero) and a standard deviation of one. Use this function in place of a |
||
2634 | * table of standard normal curve areas. |
||
2635 | * |
||
2636 | * @param float $value |
||
2637 | * @return float |
||
2638 | */ |
||
2639 | public static function NORMSDIST($value) |
||
2645 | |||
2646 | |||
2647 | /** |
||
2648 | * NORMSINV |
||
2649 | * |
||
2650 | * Returns the inverse of the standard normal cumulative distribution |
||
2651 | * |
||
2652 | * @param float $value |
||
2653 | * @return float |
||
2654 | */ |
||
2655 | public static function NORMSINV($value) |
||
2659 | |||
2660 | |||
2661 | /** |
||
2662 | * PERCENTILE |
||
2663 | * |
||
2664 | * Returns the nth percentile of values in a range.. |
||
2665 | * |
||
2666 | * Excel Function: |
||
2667 | * PERCENTILE(value1[,value2[, ...]],entry) |
||
2668 | * |
||
2669 | * @access public |
||
2670 | * @category Statistical Functions |
||
2671 | * @param mixed $arg,... Data values |
||
2672 | * @param float $entry Percentile value in the range 0..1, inclusive. |
||
2673 | * @return float |
||
2674 | */ |
||
2675 | public static function PERCENTILE() |
||
2710 | |||
2711 | |||
2712 | /** |
||
2713 | * PERCENTRANK |
||
2714 | * |
||
2715 | * Returns the rank of a value in a data set as a percentage of the data set. |
||
2716 | * |
||
2717 | * @param array of number An array of, or a reference to, a list of numbers. |
||
2718 | * @param number The number whose rank you want to find. |
||
2719 | * @param number The number of significant digits for the returned percentage value. |
||
2720 | * @return float |
||
2721 | */ |
||
2722 | public static function PERCENTRANK($valueSet, $value, $significance = 3) |
||
2757 | |||
2758 | |||
2759 | /** |
||
2760 | * PERMUT |
||
2761 | * |
||
2762 | * Returns the number of permutations for a given number of objects that can be |
||
2763 | * selected from number objects. A permutation is any set or subset of objects or |
||
2764 | * events where internal order is significant. Permutations are different from |
||
2765 | * combinations, for which the internal order is not significant. Use this function |
||
2766 | * for lottery-style probability calculations. |
||
2767 | * |
||
2768 | * @param int $numObjs Number of different objects |
||
2769 | * @param int $numInSet Number of objects in each permutation |
||
2770 | * @return int Number of permutations |
||
2771 | */ |
||
2772 | View Code Duplication | public static function PERMUT($numObjs, $numInSet) |
|
2786 | |||
2787 | |||
2788 | /** |
||
2789 | * POISSON |
||
2790 | * |
||
2791 | * Returns the Poisson distribution. A common application of the Poisson distribution |
||
2792 | * is predicting the number of events over a specific time, such as the number of |
||
2793 | * cars arriving at a toll plaza in 1 minute. |
||
2794 | * |
||
2795 | * @param float $value |
||
2796 | * @param float $mean Mean Value |
||
2797 | * @param boolean $cumulative |
||
2798 | * @return float |
||
2799 | * |
||
2800 | */ |
||
2801 | public static function POISSON($value, $mean, $cumulative) |
||
2824 | |||
2825 | |||
2826 | /** |
||
2827 | * QUARTILE |
||
2828 | * |
||
2829 | * Returns the quartile of a data set. |
||
2830 | * |
||
2831 | * Excel Function: |
||
2832 | * QUARTILE(value1[,value2[, ...]],entry) |
||
2833 | * |
||
2834 | * @access public |
||
2835 | * @category Statistical Functions |
||
2836 | * @param mixed $arg,... Data values |
||
2837 | * @param int $entry Quartile value in the range 1..3, inclusive. |
||
2838 | * @return float |
||
2839 | */ |
||
2840 | public static function QUARTILE() |
||
2856 | |||
2857 | |||
2858 | /** |
||
2859 | * RANK |
||
2860 | * |
||
2861 | * Returns the rank of a number in a list of numbers. |
||
2862 | * |
||
2863 | * @param number The number whose rank you want to find. |
||
2864 | * @param array of number An array of, or a reference to, a list of numbers. |
||
2865 | * @param mixed Order to sort the values in the value set |
||
2866 | * @return float |
||
2867 | */ |
||
2868 | public static function RANK($value, $valueSet, $order = 0) |
||
2892 | |||
2893 | |||
2894 | /** |
||
2895 | * RSQ |
||
2896 | * |
||
2897 | * Returns the square of the Pearson product moment correlation coefficient through data points in known_y's and known_x's. |
||
2898 | * |
||
2899 | * @param array of mixed Data Series Y |
||
2900 | * @param array of mixed Data Series X |
||
2901 | * @return float |
||
2902 | */ |
||
2903 | View Code Duplication | public static function RSQ($yValues, $xValues) |
|
2920 | |||
2921 | |||
2922 | /** |
||
2923 | * SKEW |
||
2924 | * |
||
2925 | * Returns the skewness of a distribution. Skewness characterizes the degree of asymmetry |
||
2926 | * of a distribution around its mean. Positive skewness indicates a distribution with an |
||
2927 | * asymmetric tail extending toward more positive values. Negative skewness indicates a |
||
2928 | * distribution with an asymmetric tail extending toward more negative values. |
||
2929 | * |
||
2930 | * @param array Data Series |
||
2931 | * @return float |
||
2932 | */ |
||
2933 | public static function SKEW() |
||
2958 | |||
2959 | |||
2960 | /** |
||
2961 | * SLOPE |
||
2962 | * |
||
2963 | * Returns the slope of the linear regression line through data points in known_y's and known_x's. |
||
2964 | * |
||
2965 | * @param array of mixed Data Series Y |
||
2966 | * @param array of mixed Data Series X |
||
2967 | * @return float |
||
2968 | */ |
||
2969 | View Code Duplication | public static function SLOPE($yValues, $xValues) |
|
2986 | |||
2987 | |||
2988 | /** |
||
2989 | * SMALL |
||
2990 | * |
||
2991 | * Returns the nth smallest value in a data set. You can use this function to |
||
2992 | * select a value based on its relative standing. |
||
2993 | * |
||
2994 | * Excel Function: |
||
2995 | * SMALL(value1[,value2[, ...]],entry) |
||
2996 | * |
||
2997 | * @access public |
||
2998 | * @category Statistical Functions |
||
2999 | * @param mixed $arg,... Data values |
||
3000 | * @param int $entry Position (ordered from the smallest) in the array or range of data to return |
||
3001 | * @return float |
||
3002 | */ |
||
3003 | View Code Duplication | public static function SMALL() |
|
3028 | |||
3029 | |||
3030 | /** |
||
3031 | * STANDARDIZE |
||
3032 | * |
||
3033 | * Returns a normalized value from a distribution characterized by mean and standard_dev. |
||
3034 | * |
||
3035 | * @param float $value Value to normalize |
||
3036 | * @param float $mean Mean Value |
||
3037 | * @param float $stdDev Standard Deviation |
||
3038 | * @return float Standardized value |
||
3039 | */ |
||
3040 | View Code Duplication | public static function STANDARDIZE($value, $mean, $stdDev) |
|
3054 | |||
3055 | |||
3056 | /** |
||
3057 | * STDEV |
||
3058 | * |
||
3059 | * Estimates standard deviation based on a sample. The standard deviation is a measure of how |
||
3060 | * widely values are dispersed from the average value (the mean). |
||
3061 | * |
||
3062 | * Excel Function: |
||
3063 | * STDEV(value1[,value2[, ...]]) |
||
3064 | * |
||
3065 | * @access public |
||
3066 | * @category Statistical Functions |
||
3067 | * @param mixed $arg,... Data values |
||
3068 | * @return float |
||
3069 | */ |
||
3070 | View Code Duplication | public static function STDEV() |
|
3103 | |||
3104 | |||
3105 | /** |
||
3106 | * STDEVA |
||
3107 | * |
||
3108 | * Estimates standard deviation based on a sample, including numbers, text, and logical values |
||
3109 | * |
||
3110 | * Excel Function: |
||
3111 | * STDEVA(value1[,value2[, ...]]) |
||
3112 | * |
||
3113 | * @access public |
||
3114 | * @category Statistical Functions |
||
3115 | * @param mixed $arg,... Data values |
||
3116 | * @return float |
||
3117 | */ |
||
3118 | View Code Duplication | public static function STDEVA() |
|
3154 | |||
3155 | |||
3156 | /** |
||
3157 | * STDEVP |
||
3158 | * |
||
3159 | * Calculates standard deviation based on the entire population |
||
3160 | * |
||
3161 | * Excel Function: |
||
3162 | * STDEVP(value1[,value2[, ...]]) |
||
3163 | * |
||
3164 | * @access public |
||
3165 | * @category Statistical Functions |
||
3166 | * @param mixed $arg,... Data values |
||
3167 | * @return float |
||
3168 | */ |
||
3169 | View Code Duplication | public static function STDEVP() |
|
3200 | |||
3201 | |||
3202 | /** |
||
3203 | * STDEVPA |
||
3204 | * |
||
3205 | * Calculates standard deviation based on the entire population, including numbers, text, and logical values |
||
3206 | * |
||
3207 | * Excel Function: |
||
3208 | * STDEVPA(value1[,value2[, ...]]) |
||
3209 | * |
||
3210 | * @access public |
||
3211 | * @category Statistical Functions |
||
3212 | * @param mixed $arg,... Data values |
||
3213 | * @return float |
||
3214 | */ |
||
3215 | View Code Duplication | public static function STDEVPA() |
|
3251 | |||
3252 | |||
3253 | /** |
||
3254 | * STEYX |
||
3255 | * |
||
3256 | * Returns the standard error of the predicted y-value for each x in the regression. |
||
3257 | * |
||
3258 | * @param array of mixed Data Series Y |
||
3259 | * @param array of mixed Data Series X |
||
3260 | * @return float |
||
3261 | */ |
||
3262 | View Code Duplication | public static function STEYX($yValues, $xValues) |
|
3279 | |||
3280 | |||
3281 | /** |
||
3282 | * TDIST |
||
3283 | * |
||
3284 | * Returns the probability of Student's T distribution. |
||
3285 | * |
||
3286 | * @param float $value Value for the function |
||
3287 | * @param float $degrees degrees of freedom |
||
3288 | * @param float $tails number of tails (1 or 2) |
||
3289 | * @return float |
||
3290 | */ |
||
3291 | public static function TDIST($value, $degrees, $tails) |
||
3343 | |||
3344 | |||
3345 | /** |
||
3346 | * TINV |
||
3347 | * |
||
3348 | * Returns the one-tailed probability of the chi-squared distribution. |
||
3349 | * |
||
3350 | * @param float $probability Probability for the function |
||
3351 | * @param float $degrees degrees of freedom |
||
3352 | * @return float |
||
3353 | */ |
||
3354 | View Code Duplication | public static function TINV($probability, $degrees) |
|
3399 | |||
3400 | |||
3401 | /** |
||
3402 | * TREND |
||
3403 | * |
||
3404 | * Returns values along a linear Trend |
||
3405 | * |
||
3406 | * @param array of mixed Data Series Y |
||
3407 | * @param array of mixed Data Series X |
||
3408 | * @param array of mixed Values of X for which we want to find Y |
||
3409 | * @param boolean A logical value specifying whether to force the intersect to equal 0. |
||
3410 | * @return array of float |
||
3411 | */ |
||
3412 | View Code Duplication | public static function TREND($yValues, $xValues = array(), $newValues = array(), $const = true) |
|
3431 | |||
3432 | |||
3433 | /** |
||
3434 | * TRIMMEAN |
||
3435 | * |
||
3436 | * Returns the mean of the interior of a data set. TRIMMEAN calculates the mean |
||
3437 | * taken by excluding a percentage of data points from the top and bottom tails |
||
3438 | * of a data set. |
||
3439 | * |
||
3440 | * Excel Function: |
||
3441 | * TRIMEAN(value1[,value2[, ...]], $discard) |
||
3442 | * |
||
3443 | * @access public |
||
3444 | * @category Statistical Functions |
||
3445 | * @param mixed $arg,... Data values |
||
3446 | * @param float $discard Percentage to discard |
||
3447 | * @return float |
||
3448 | */ |
||
3449 | public static function TRIMMEAN() |
||
3477 | |||
3478 | |||
3479 | /** |
||
3480 | * VARFunc |
||
3481 | * |
||
3482 | * Estimates variance based on a sample. |
||
3483 | * |
||
3484 | * Excel Function: |
||
3485 | * VAR(value1[,value2[, ...]]) |
||
3486 | * |
||
3487 | * @access public |
||
3488 | * @category Statistical Functions |
||
3489 | * @param mixed $arg,... Data values |
||
3490 | * @return float |
||
3491 | */ |
||
3492 | View Code Duplication | public static function VARFunc() |
|
3520 | |||
3521 | |||
3522 | /** |
||
3523 | * VARA |
||
3524 | * |
||
3525 | * Estimates variance based on a sample, including numbers, text, and logical values |
||
3526 | * |
||
3527 | * Excel Function: |
||
3528 | * VARA(value1[,value2[, ...]]) |
||
3529 | * |
||
3530 | * @access public |
||
3531 | * @category Statistical Functions |
||
3532 | * @param mixed $arg,... Data values |
||
3533 | * @return float |
||
3534 | */ |
||
3535 | View Code Duplication | public static function VARA() |
|
3572 | |||
3573 | |||
3574 | /** |
||
3575 | * VARP |
||
3576 | * |
||
3577 | * Calculates variance based on the entire population |
||
3578 | * |
||
3579 | * Excel Function: |
||
3580 | * VARP(value1[,value2[, ...]]) |
||
3581 | * |
||
3582 | * @access public |
||
3583 | * @category Statistical Functions |
||
3584 | * @param mixed $arg,... Data values |
||
3585 | * @return float |
||
3586 | */ |
||
3587 | View Code Duplication | public static function VARP() |
|
3616 | |||
3617 | |||
3618 | /** |
||
3619 | * VARPA |
||
3620 | * |
||
3621 | * Calculates variance based on the entire population, including numbers, text, and logical values |
||
3622 | * |
||
3623 | * Excel Function: |
||
3624 | * VARPA(value1[,value2[, ...]]) |
||
3625 | * |
||
3626 | * @access public |
||
3627 | * @category Statistical Functions |
||
3628 | * @param mixed $arg,... Data values |
||
3629 | * @return float |
||
3630 | */ |
||
3631 | View Code Duplication | public static function VARPA() |
|
3668 | |||
3669 | |||
3670 | /** |
||
3671 | * WEIBULL |
||
3672 | * |
||
3673 | * Returns the Weibull distribution. Use this distribution in reliability |
||
3674 | * analysis, such as calculating a device's mean time to failure. |
||
3675 | * |
||
3676 | * @param float $value |
||
3677 | * @param float $alpha Alpha Parameter |
||
3678 | * @param float $beta Beta Parameter |
||
3679 | * @param boolean $cumulative |
||
3680 | * @return float |
||
3681 | * |
||
3682 | */ |
||
3683 | public static function WEIBULL($value, $alpha, $beta, $cumulative) |
||
3703 | |||
3704 | |||
3705 | /** |
||
3706 | * ZTEST |
||
3707 | * |
||
3708 | * Returns the Weibull distribution. Use this distribution in reliability |
||
3709 | * analysis, such as calculating a device's mean time to failure. |
||
3710 | * |
||
3711 | * @param float $dataSet |
||
3712 | * @param float $m0 Alpha Parameter |
||
3713 | * @param float $sigma Beta Parameter |
||
3714 | * @param boolean $cumulative |
||
3715 | * @return float |
||
3716 | * |
||
3717 | */ |
||
3718 | public static function ZTEST($dataSet, $m0, $sigma = null) |
||
3731 | } |
||
3732 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.