@@ 1290-1305 (lines=16) @@ | ||
1287 | * @param array of mixed Data Series X |
|
1288 | * @return float |
|
1289 | */ |
|
1290 | public static function COVAR($yValues,$xValues) { |
|
1291 | if (!self::_checkTrendArrays($yValues,$xValues)) { |
|
1292 | return PHPExcel_Calculation_Functions::VALUE(); |
|
1293 | } |
|
1294 | $yValueCount = count($yValues); |
|
1295 | $xValueCount = count($xValues); |
|
1296 | ||
1297 | if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { |
|
1298 | return PHPExcel_Calculation_Functions::NA(); |
|
1299 | } elseif ($yValueCount == 1) { |
|
1300 | return PHPExcel_Calculation_Functions::DIV0(); |
|
1301 | } |
|
1302 | ||
1303 | $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); |
|
1304 | return $bestFitLinear->getCovariance(); |
|
1305 | } // function COVAR() |
|
1306 | ||
1307 | ||
1308 | /** |
|
@@ 1845-1860 (lines=16) @@ | ||
1842 | * @param array of mixed Data Series X |
|
1843 | * @return float |
|
1844 | */ |
|
1845 | public static function INTERCEPT($yValues,$xValues) { |
|
1846 | if (!self::_checkTrendArrays($yValues,$xValues)) { |
|
1847 | return PHPExcel_Calculation_Functions::VALUE(); |
|
1848 | } |
|
1849 | $yValueCount = count($yValues); |
|
1850 | $xValueCount = count($xValues); |
|
1851 | ||
1852 | if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { |
|
1853 | return PHPExcel_Calculation_Functions::NA(); |
|
1854 | } elseif ($yValueCount == 1) { |
|
1855 | return PHPExcel_Calculation_Functions::DIV0(); |
|
1856 | } |
|
1857 | ||
1858 | $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); |
|
1859 | return $bestFitLinear->getIntersect(); |
|
1860 | } // function INTERCEPT() |
|
1861 | ||
1862 | ||
1863 | /** |
|
@@ 2827-2842 (lines=16) @@ | ||
2824 | * @param array of mixed Data Series X |
|
2825 | * @return float |
|
2826 | */ |
|
2827 | public static function RSQ($yValues,$xValues) { |
|
2828 | if (!self::_checkTrendArrays($yValues,$xValues)) { |
|
2829 | return PHPExcel_Calculation_Functions::VALUE(); |
|
2830 | } |
|
2831 | $yValueCount = count($yValues); |
|
2832 | $xValueCount = count($xValues); |
|
2833 | ||
2834 | if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { |
|
2835 | return PHPExcel_Calculation_Functions::NA(); |
|
2836 | } elseif ($yValueCount == 1) { |
|
2837 | return PHPExcel_Calculation_Functions::DIV0(); |
|
2838 | } |
|
2839 | ||
2840 | $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); |
|
2841 | return $bestFitLinear->getGoodnessOfFit(); |
|
2842 | } // function RSQ() |
|
2843 | ||
2844 | ||
2845 | /** |
|
@@ 2892-2907 (lines=16) @@ | ||
2889 | * @param array of mixed Data Series X |
|
2890 | * @return float |
|
2891 | */ |
|
2892 | public static function SLOPE($yValues,$xValues) { |
|
2893 | if (!self::_checkTrendArrays($yValues,$xValues)) { |
|
2894 | return PHPExcel_Calculation_Functions::VALUE(); |
|
2895 | } |
|
2896 | $yValueCount = count($yValues); |
|
2897 | $xValueCount = count($xValues); |
|
2898 | ||
2899 | if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { |
|
2900 | return PHPExcel_Calculation_Functions::NA(); |
|
2901 | } elseif ($yValueCount == 1) { |
|
2902 | return PHPExcel_Calculation_Functions::DIV0(); |
|
2903 | } |
|
2904 | ||
2905 | $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); |
|
2906 | return $bestFitLinear->getSlope(); |
|
2907 | } // function SLOPE() |
|
2908 | ||
2909 | ||
2910 | /** |
|
@@ 3184-3199 (lines=16) @@ | ||
3181 | * @param array of mixed Data Series X |
|
3182 | * @return float |
|
3183 | */ |
|
3184 | public static function STEYX($yValues,$xValues) { |
|
3185 | if (!self::_checkTrendArrays($yValues,$xValues)) { |
|
3186 | return PHPExcel_Calculation_Functions::VALUE(); |
|
3187 | } |
|
3188 | $yValueCount = count($yValues); |
|
3189 | $xValueCount = count($xValues); |
|
3190 | ||
3191 | if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { |
|
3192 | return PHPExcel_Calculation_Functions::NA(); |
|
3193 | } elseif ($yValueCount == 1) { |
|
3194 | return PHPExcel_Calculation_Functions::DIV0(); |
|
3195 | } |
|
3196 | ||
3197 | $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); |
|
3198 | return $bestFitLinear->getStdevOfResiduals(); |
|
3199 | } // function STEYX() |
|
3200 | ||
3201 | ||
3202 | /** |