Documentation

Beta
in package
uses ArrayEnabled

Table of Contents

Constants

LOG_GAMMA_X_MAX_VALUE  = 2.55E+305
MAX_ITERATIONS  = 256
XMININ  = 2.23E-308

Properties

$arrayArgumentHelper  : ArrayArgumentHelper
$initializationNeeded  : bool
$logBetaCacheP  : float
$logBetaCacheQ  : float
$logBetaCacheResult  : float

Methods

distribution()  : array<string|int, mixed>|float|string
BETADIST.
incompleteBeta()  : float
Incomplete beta function.
inverse()  : array<string|int, mixed>|float|string
BETAINV.
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.
betaFraction()  : float
Evaluates of continued fraction part of incomplete beta function.
calculateInverse()  : string|float
initialiseHelper()  : void
logBeta()  : float
The natural logarithm of the beta function.
testFalse()  : bool

Constants

LOG_GAMMA_X_MAX_VALUE

private mixed LOG_GAMMA_X_MAX_VALUE = 2.55E+305

MAX_ITERATIONS

private mixed MAX_ITERATIONS = 256

XMININ

private mixed XMININ = 2.23E-308

Properties

$initializationNeeded

private static bool $initializationNeeded = true

$logBetaCacheP

private static float $logBetaCacheP = 0.0

$logBetaCacheQ

private static float $logBetaCacheQ = 0.0

$logBetaCacheResult

private static float $logBetaCacheResult = 0.0

Methods

distribution()

BETADIST.

public static distribution(mixed $value, mixed $alpha, mixed $beta[, mixed $rMin = 0.0 ][, mixed $rMax = 1.0 ]) : array<string|int, mixed>|float|string

Returns the beta distribution.

Parameters
$value : mixed

Float value at which you want to evaluate the distribution Or can be an array of values

$alpha : mixed

Parameter to the distribution as a float Or can be an array of values

$beta : mixed

Parameter to the distribution as a float Or can be an array of values

$rMin : mixed = 0.0

as an float Or can be an array of values

$rMax : mixed = 1.0

as an float 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

incompleteBeta()

Incomplete beta function.

public static incompleteBeta(float $x, float $p, float $q) : float
Parameters
$x : float

require 0<=x<=1

$p : float

require p>0

$q : float

require q>0

Tags
author

Jaco van Kooten

author

Paul Meagher

The computation is based on formulas from Numerical Recipes, Chapter 6.4 (W.H. Press et al, 1992).

Return values
float

0 if x<0, p<=0, q<=0 or p+q>2.55E305 and 1 if x>1 to avoid errors and over/underflow

inverse()

BETAINV.

public static inverse(mixed $probability, mixed $alpha, mixed $beta[, mixed $rMin = 0.0 ][, mixed $rMax = 1.0 ]) : array<string|int, mixed>|float|string

Returns the inverse of the Beta distribution.

Parameters
$probability : mixed

Float probability at which you want to evaluate the distribution Or can be an array of values

$alpha : mixed

Parameter to the distribution as a float Or can be an array of values

$beta : mixed

Parameter to the distribution as a float Or can be an array of values

$rMin : mixed = 0.0

Minimum value as a float Or can be an array of values

$rMax : mixed = 1.0

Maximum value as a float 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

evaluateArrayArguments()

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>

betaFraction()

Evaluates of continued fraction part of incomplete beta function.

private static betaFraction(float $x, float $p, float $q) : float

Based on an idea from Numerical Recipes (W.H. Press et al, 1992).

Parameters
$x : float
$p : float
$q : float
Tags
author

Jaco van Kooten

Return values
float

calculateInverse()

private static calculateInverse(float $probability, float $alpha, float $beta, float $rMin, float $rMax) : string|float
Parameters
$probability : float
$alpha : float
$beta : float
$rMin : float
$rMax : float
Return values
string|float

initialiseHelper()

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+

logBeta()

The natural logarithm of the beta function.

private static logBeta(float $p, float $q) : float
Parameters
$p : float

require p>0

$q : float

require q>0

Tags
author

Jaco van Kooten

Return values
float

0 if p<=0, q<=0 or p+q>2.55E305 to avoid errors and over/underflow

testFalse()

private static testFalse(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

        
On this page

Search results