Trends
in package
uses
ArrayEnabled
Table of Contents
Properties
Methods
- CORREL() : float|string
- CORREL.
- COVAR() : float|string
- COVAR.
- FORECAST() : array<string|int, mixed>|bool|float|string
- FORECAST.
- GROWTH() : array<int, array<int, array<int, float>>>
- GROWTH.
- INTERCEPT() : float|string
- INTERCEPT.
- LINEST() : array<string|int, mixed>|string
- LINEST.
- LOGEST() : array<string|int, mixed>|string
- LOGEST.
- RSQ() : float|string
- RSQ.
- SLOPE() : float|string
- SLOPE.
- STEYX() : float|string
- STEYX.
- TREND() : array<int, array<int, array<int, float>>>
- TREND.
- 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.
- validateTrendArrays() : void
- checkTrendArrays() : void
- filterTrendValues() : void
- initialiseHelper() : void
- testFalse() : bool
Properties
$arrayArgumentHelper
private
static ArrayArgumentHelper
$arrayArgumentHelper
$initializationNeeded
private
static bool
$initializationNeeded
= true
Methods
CORREL()
CORREL.
public
static CORREL(mixed $yValues[, null|mixed $xValues = null ]) : float|string
Returns covariance, the average of the products of deviations for each data point pair.
Parameters
- $yValues : mixed
-
array of mixed Data Series Y
- $xValues : null|mixed = null
-
array of mixed Data Series X
Return values
float|stringCOVAR()
COVAR.
public
static COVAR(array<string|int, mixed> $yValues, array<string|int, mixed> $xValues) : float|string
Returns covariance, the average of the products of deviations for each data point pair.
Parameters
- $yValues : array<string|int, mixed>
-
array of mixed Data Series Y
- $xValues : array<string|int, mixed>
-
array of mixed Data Series X
Return values
float|stringFORECAST()
FORECAST.
public
static FORECAST(mixed $xValue, array<string|int, mixed> $yValues, array<string|int, mixed> $xValues) : array<string|int, mixed>|bool|float|string
Calculates, or predicts, a future value by using existing values. The predicted value is a y-value for a given x-value.
Parameters
- $xValue : mixed
-
Float value of X for which we want to find Y Or can be an array of values
- $yValues : array<string|int, mixed>
-
array of mixed Data Series Y
- $xValues : array<string|int, mixed>
-
array of mixed Data Series X
Return values
array<string|int, mixed>|bool|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
GROWTH()
GROWTH.
public
static GROWTH(array<string|int, mixed> $yValues[, array<string|int, mixed> $xValues = [] ][, array<string|int, mixed> $newValues = [] ][, mixed $const = true ]) : array<int, array<int, array<int, float>>>
Returns values along a predicted exponential Trend
Parameters
- $yValues : array<string|int, mixed>
-
Data Series Y
- $xValues : array<string|int, mixed> = []
-
Data Series X
- $newValues : array<string|int, mixed> = []
-
Values of X for which we want to find Y
- $const : mixed = true
-
A logical (boolean) value specifying whether to force the intersect to equal 0 or not
Return values
array<int, array<int, array<int, float>>>INTERCEPT()
INTERCEPT.
public
static INTERCEPT(array<string|int, mixed> $yValues, array<string|int, mixed> $xValues) : float|string
Calculates the point at which a line will intersect the y-axis by using existing x-values and y-values.
Parameters
- $yValues : array<string|int, mixed>
-
Data Series Y
- $xValues : array<string|int, mixed>
-
Data Series X
Return values
float|stringLINEST()
LINEST.
public
static LINEST(array<string|int, mixed> $yValues[, null|array<string|int, mixed> $xValues = null ][, mixed $const = true ][, mixed $stats = false ]) : array<string|int, mixed>|string
Calculates the statistics for a line by using the "least squares" method to calculate a straight line that best fits your data, and then returns an array that describes the line.
Parameters
- $yValues : array<string|int, mixed>
-
Data Series Y
- $xValues : null|array<string|int, mixed> = null
-
Data Series X
- $const : mixed = true
-
A logical (boolean) value specifying whether to force the intersect to equal 0 or not
- $stats : mixed = false
-
A logical (boolean) value specifying whether to return additional regression statistics
Return values
array<string|int, mixed>|string —The result, or a string containing an error
LOGEST()
LOGEST.
public
static LOGEST(array<string|int, mixed> $yValues[, null|array<string|int, mixed> $xValues = null ][, mixed $const = true ][, mixed $stats = false ]) : array<string|int, mixed>|string
Calculates an exponential curve that best fits the X and Y data series, and then returns an array that describes the line.
Parameters
- $yValues : array<string|int, mixed>
-
Data Series Y
- $xValues : null|array<string|int, mixed> = null
-
Data Series X
- $const : mixed = true
-
A logical (boolean) value specifying whether to force the intersect to equal 0 or not
- $stats : mixed = false
-
A logical (boolean) value specifying whether to return additional regression statistics
Return values
array<string|int, mixed>|string —The result, or a string containing an error
RSQ()
RSQ.
public
static RSQ(array<string|int, mixed> $yValues, array<string|int, mixed> $xValues) : float|string
Returns the square of the Pearson product moment correlation coefficient through data points in known_y's and known_x's.
Parameters
- $yValues : array<string|int, mixed>
-
Data Series Y
- $xValues : array<string|int, mixed>
-
Data Series X
Return values
float|string —The result, or a string containing an error
SLOPE()
SLOPE.
public
static SLOPE(array<string|int, mixed> $yValues, array<string|int, mixed> $xValues) : float|string
Returns the slope of the linear regression line through data points in known_y's and known_x's.
Parameters
- $yValues : array<string|int, mixed>
-
Data Series Y
- $xValues : array<string|int, mixed>
-
Data Series X
Return values
float|string —The result, or a string containing an error
STEYX()
STEYX.
public
static STEYX(array<string|int, mixed> $yValues, array<string|int, mixed> $xValues) : float|string
Returns the standard error of the predicted y-value for each x in the regression.
Parameters
- $yValues : array<string|int, mixed>
-
Data Series Y
- $xValues : array<string|int, mixed>
-
Data Series X
Return values
float|stringTREND()
TREND.
public
static TREND(array<string|int, mixed> $yValues[, array<string|int, mixed> $xValues = [] ][, array<string|int, mixed> $newValues = [] ][, mixed $const = true ]) : array<int, array<int, array<int, float>>>
Returns values along a linear Trend
Parameters
- $yValues : array<string|int, mixed>
-
Data Series Y
- $xValues : array<string|int, mixed> = []
-
Data Series X
- $newValues : array<string|int, mixed> = []
-
Values of X for which we want to find Y
- $const : mixed = true
-
A logical (boolean) value specifying whether to force the intersect to equal 0 or not
Return values
array<int, array<int, array<int, float>>>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>validateTrendArrays()
protected
static validateTrendArrays(array<string|int, mixed> $yValues, array<string|int, mixed> $xValues) : void
Parameters
- $yValues : array<string|int, mixed>
- $xValues : array<string|int, mixed>
checkTrendArrays()
private
static checkTrendArrays(mixed &$array1, mixed &$array2) : void
Parameters
- $array1 : mixed
-
should be array, but scalar is made into one
- $array2 : mixed
-
should be array, but scalar is made into one
filterTrendValues()
private
static filterTrendValues(array<string|int, mixed> &$array1, array<string|int, mixed> &$array2) : void
Parameters
- $array1 : array<string|int, mixed>
- $array2 : array<string|int, mixed>
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+
testFalse()
private
static testFalse(mixed $value) : bool
Parameters
- $value : mixed