PHP-Math
PHP math functions: mean(), median(), variance(), covariance(), correlation(), stddev(), pv(), npv(), and more., (*1)
Functions
mean(array $values)
Parameters:
* Array $values - Array of numeric values., (*2)
Returns: String Arithmetic average of the given values., (*3)
Alias: avg(), (*4)
Parameters:
* Array $values - Array of numeric values, (*5)
Returns: String Median value of the given values, or null if it cannot be computed., (*6)
sumxy(array $x_values, array $y_values)
Parameters:
* Array $x_values - Array of numeric values of x.
* Array $y_values - Array of numeric values of y., (*7)
Returns: String Sum of the products of the values., (*8)
sos(array $values, $values2 = null)
Parameters:
* Array $values - Array of numeric values.
* Null|Array|String $values2 - Optional - If null, simply sums the square of each array value. If given a scalar value, sums the squares of the difference between each array value and that given by $values2 (good for explained/regression SS). If given an array, sums the squares of the difference between betweeen each array value and the value in $values2 with matching key (good for residual SS)., (*9)
Returns: String Sum of squares., (*10)
variance(array $values, $is_sample = false)
Returns: String Variance, (*11)
stddev(array $a, $is_sample = false)
Returns: String Standard deviation, (*12)
Alias: stdev(), (*13)
covariance(array $x_values, array $y_values)
Returns: String Covariance, (*14)
Alias: covar(), (*15)
correlation(array $x_values, array $y_values)
Returns: String Correlation, (*16)
Alias: correl(), (*17)
pv($cashflow, $rate, $period = 0)
Returns: String Present value, (*18)
npv(array $cashflows, $rate)
Returns: String Net present value, (*19)
weighted_avg(array $values, array $weights)
Returns: String Weighted average, (*20)
pct($portion, $total)
Returns: String Percent, (*21)
pct_change($current, $previous)
Returns: String Percent change, (*22)
pct_change_array(array $values)
Returns: Array Array values percent change, (*23)