@@ 1344-1361 (lines=18) @@ | ||
1341 | * |
|
1342 | * @return float |
|
1343 | */ |
|
1344 | public static function COVAR($yValues, $xValues) |
|
1345 | { |
|
1346 | if (!self::checkTrendArrays($yValues, $xValues)) { |
|
1347 | return Functions::VALUE(); |
|
1348 | } |
|
1349 | $yValueCount = count($yValues); |
|
1350 | $xValueCount = count($xValues); |
|
1351 | ||
1352 | if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { |
|
1353 | return Functions::NA(); |
|
1354 | } elseif ($yValueCount == 1) { |
|
1355 | return Functions::DIV0(); |
|
1356 | } |
|
1357 | ||
1358 | $bestFitLinear = \PhpOffice\PhpSpreadsheet\Shared\trend\trend::calculate(\PhpOffice\PhpSpreadsheet\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues); |
|
1359 | ||
1360 | return $bestFitLinear->getCovariance(); |
|
1361 | } |
|
1362 | ||
1363 | /** |
|
1364 | * CRITBINOM. |
|
@@ 1945-1962 (lines=18) @@ | ||
1942 | * |
|
1943 | * @return float |
|
1944 | */ |
|
1945 | public static function INTERCEPT($yValues, $xValues) |
|
1946 | { |
|
1947 | if (!self::checkTrendArrays($yValues, $xValues)) { |
|
1948 | return Functions::VALUE(); |
|
1949 | } |
|
1950 | $yValueCount = count($yValues); |
|
1951 | $xValueCount = count($xValues); |
|
1952 | ||
1953 | if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { |
|
1954 | return Functions::NA(); |
|
1955 | } elseif ($yValueCount == 1) { |
|
1956 | return Functions::DIV0(); |
|
1957 | } |
|
1958 | ||
1959 | $bestFitLinear = \PhpOffice\PhpSpreadsheet\Shared\trend\trend::calculate(\PhpOffice\PhpSpreadsheet\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues); |
|
1960 | ||
1961 | return $bestFitLinear->getIntersect(); |
|
1962 | } |
|
1963 | ||
1964 | /** |
|
1965 | * KURT. |
|
@@ 2994-3011 (lines=18) @@ | ||
2991 | * |
|
2992 | * @return float |
|
2993 | */ |
|
2994 | public static function RSQ($yValues, $xValues) |
|
2995 | { |
|
2996 | if (!self::checkTrendArrays($yValues, $xValues)) { |
|
2997 | return Functions::VALUE(); |
|
2998 | } |
|
2999 | $yValueCount = count($yValues); |
|
3000 | $xValueCount = count($xValues); |
|
3001 | ||
3002 | if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { |
|
3003 | return Functions::NA(); |
|
3004 | } elseif ($yValueCount == 1) { |
|
3005 | return Functions::DIV0(); |
|
3006 | } |
|
3007 | ||
3008 | $bestFitLinear = \PhpOffice\PhpSpreadsheet\Shared\trend\trend::calculate(\PhpOffice\PhpSpreadsheet\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues); |
|
3009 | ||
3010 | return $bestFitLinear->getGoodnessOfFit(); |
|
3011 | } |
|
3012 | ||
3013 | /** |
|
3014 | * SKEW. |
|
@@ 3064-3081 (lines=18) @@ | ||
3061 | * |
|
3062 | * @return float |
|
3063 | */ |
|
3064 | public static function SLOPE($yValues, $xValues) |
|
3065 | { |
|
3066 | if (!self::checkTrendArrays($yValues, $xValues)) { |
|
3067 | return Functions::VALUE(); |
|
3068 | } |
|
3069 | $yValueCount = count($yValues); |
|
3070 | $xValueCount = count($xValues); |
|
3071 | ||
3072 | if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { |
|
3073 | return Functions::NA(); |
|
3074 | } elseif ($yValueCount == 1) { |
|
3075 | return Functions::DIV0(); |
|
3076 | } |
|
3077 | ||
3078 | $bestFitLinear = \PhpOffice\PhpSpreadsheet\Shared\trend\trend::calculate(\PhpOffice\PhpSpreadsheet\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues); |
|
3079 | ||
3080 | return $bestFitLinear->getSlope(); |
|
3081 | } |
|
3082 | ||
3083 | /** |
|
3084 | * SMALL. |
|
@@ 3368-3385 (lines=18) @@ | ||
3365 | * |
|
3366 | * @return float |
|
3367 | */ |
|
3368 | public static function STEYX($yValues, $xValues) |
|
3369 | { |
|
3370 | if (!self::checkTrendArrays($yValues, $xValues)) { |
|
3371 | return Functions::VALUE(); |
|
3372 | } |
|
3373 | $yValueCount = count($yValues); |
|
3374 | $xValueCount = count($xValues); |
|
3375 | ||
3376 | if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { |
|
3377 | return Functions::NA(); |
|
3378 | } elseif ($yValueCount == 1) { |
|
3379 | return Functions::DIV0(); |
|
3380 | } |
|
3381 | ||
3382 | $bestFitLinear = \PhpOffice\PhpSpreadsheet\Shared\trend\trend::calculate(\PhpOffice\PhpSpreadsheet\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues); |
|
3383 | ||
3384 | return $bestFitLinear->getStdevOfResiduals(); |
|
3385 | } |
|
3386 | ||
3387 | /** |
|
3388 | * TDIST. |