ChiSquared
in package
uses
ArrayEnabled
Table of Contents
Constants
- EPS = 2.22E-16
Properties
Methods
- distributionLeftTail() : array<string|int, mixed>|float|int|string
- CHIDIST.
- distributionRightTail() : array<string|int, mixed>|float|int|string
- CHIDIST.
- inverseLeftTail() : array<string|int, mixed>|float|string
- CHIINV.
- inverseRightTail() : array<string|int, mixed>|float|string
- CHIINV.
- test() : float|string
- CHITEST.
- degrees() : int
- evaluateArrayArguments() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
- evaluateArrayArgumentsIgnore() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
- evaluateArrayArgumentsSubset() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
- evaluateArrayArgumentsSubsetFrom() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
- evaluateSingleArgumentArray() : array<string|int, mixed>
- Handles array argument processing when the function accepts a single argument that can be an array argument.
- gammp() : float
- gcf() : float
- gser() : float
- initialiseHelper() : void
- inverseLeftTailCalculation() : float
- pchisq() : float
- testFalse() : bool
Constants
EPS
private
mixed
EPS
= 2.22E-16
Properties
$arrayArgumentHelper
private
static ArrayArgumentHelper
$arrayArgumentHelper
$initializationNeeded
private
static bool
$initializationNeeded
= true
Methods
distributionLeftTail()
CHIDIST.
public
static distributionLeftTail(mixed $value, mixed $degrees, mixed $cumulative) : array<string|int, mixed>|float|int|string
Returns the one-tailed probability of the chi-squared distribution.
Parameters
- $value : mixed
-
Float value for which we want the probability Or can be an array of values
- $degrees : mixed
-
Integer degrees of freedom Or can be an array of values
- $cumulative : mixed
-
Boolean value indicating if we want the cdf (true) or the pdf (false) Or can be an array of values
Return values
array<string|int, mixed>|float|int|string —If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions
distributionRightTail()
CHIDIST.
public
static distributionRightTail(mixed $value, mixed $degrees) : array<string|int, mixed>|float|int|string
Returns the one-tailed probability of the chi-squared distribution.
Parameters
- $value : mixed
-
Float value for which we want the probability Or can be an array of values
- $degrees : mixed
-
Integer degrees of freedom Or can be an array of values
Return values
array<string|int, mixed>|float|int|string —If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions
inverseLeftTail()
CHIINV.
public
static inverseLeftTail(mixed $probability, mixed $degrees) : array<string|int, mixed>|float|string
Returns the inverse of the left-tailed probability of the chi-squared distribution.
Parameters
- $probability : mixed
-
Float probability at which you want to evaluate the distribution Or can be an array of values
- $degrees : mixed
-
Integer degrees of freedom Or can be an array of values
Return values
array<string|int, mixed>|float|string —If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions
inverseRightTail()
CHIINV.
public
static inverseRightTail(mixed $probability, mixed $degrees) : array<string|int, mixed>|float|string
Returns the inverse of the right-tailed probability of the chi-squared distribution.
Parameters
- $probability : mixed
-
Float probability at which you want to evaluate the distribution Or can be an array of values
- $degrees : mixed
-
Integer degrees of freedom Or can be an array of values
Return values
array<string|int, mixed>|float|string —If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions
test()
CHITEST.
public
static test(mixed $actual, mixed $expected) : float|string
Uses the chi-square test to calculate the probability that the differences between two supplied data sets (of observed and expected frequencies), are likely to be simply due to sampling error, or if they are likely to be real.
Parameters
- $actual : mixed
-
an array of observed frequencies
- $expected : mixed
-
an array of expected frequencies
Return values
float|stringdegrees()
protected
static degrees(int $rows, int $columns) : int
Parameters
- $rows : int
- $columns : int
Return values
intevaluateArrayArguments()
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
protected
static evaluateArrayArguments(callable $method, mixed ...$arguments) : array<string|int, mixed>
Example use for: ROUND() or DATE().
Parameters
- $method : callable
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsIgnore()
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
protected
static evaluateArrayArgumentsIgnore(callable $method, int $ignore, mixed ...$arguments) : array<string|int, mixed>
Example use for: HLOOKUP() and VLOOKUP(), where argument 1 is a matrix that needs to be treated as a database rather than as an array argument.
Parameters
- $method : callable
- $ignore : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsSubset()
Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
protected
static evaluateArrayArgumentsSubset(callable $method, int $limit, mixed ...$arguments) : array<string|int, mixed>
Example use for: NETWORKDAYS() or CONCATENATE(), where the last argument is a matrix (or a series of values) that need to be treated as a such rather than as an array arguments.
Parameters
- $method : callable
- $limit : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsSubsetFrom()
Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
protected
static evaluateArrayArgumentsSubsetFrom(callable $method, int $start, mixed ...$arguments) : array<string|int, mixed>
Example use for: Z.TEST() or INDEX(), where the first argument 1 is a matrix that needs to be treated as a dataset rather than as an array argument.
Parameters
- $method : callable
- $start : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateSingleArgumentArray()
Handles array argument processing when the function accepts a single argument that can be an array argument.
protected
static evaluateSingleArgumentArray(callable $method, array<string|int, mixed> $values) : array<string|int, mixed>
Example use for: DAYOFMONTH() or FACT().
Parameters
- $method : callable
- $values : array<string|int, mixed>
Return values
array<string|int, mixed>gammp()
private
static gammp(int $n, float $x) : float
Parameters
- $n : int
- $x : float
Return values
floatgcf()
private
static gcf(int $n, float $x) : float
Parameters
- $n : int
- $x : float
Return values
floatgser()
private
static gser(int $n, float $x) : float
Parameters
- $n : int
- $x : float
Return values
floatinitialiseHelper()
private
static initialiseHelper(array<string|int, mixed>|false $arguments) : void
Parameters
- $arguments : array<string|int, mixed>|false
-
Can be changed to array for Php8.1+
inverseLeftTailCalculation()
private
static inverseLeftTailCalculation(float $probability, int $degrees) : float
Parameters
- $probability : float
- $degrees : int
Return values
floatpchisq()
private
static pchisq(float $chi2, int $degrees) : float
Parameters
- $chi2 : float
- $degrees : int
Return values
floattestFalse()
private
static testFalse(mixed $value) : bool
Parameters
- $value : mixed