\PHPExcel_Calculation_Statistical

PHPExcel_Calculation_Statistical

Copyright (c) 2006 - 2015 PHPExcel

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Summary

Methods
Properties
Constants
AVEDEV()
AVERAGE()
AVERAGEA()
AVERAGEIF()
BETADIST()
BETAINV()
BINOMDIST()
CHIDIST()
CHIINV()
CONFIDENCE()
CORREL()
COUNT()
COUNTA()
COUNTBLANK()
COUNTIF()
COVAR()
CRITBINOM()
DEVSQ()
EXPONDIST()
FISHER()
FISHERINV()
FORECAST()
GAMMADIST()
GAMMAINV()
GAMMALN()
GEOMEAN()
GROWTH()
HARMEAN()
HYPGEOMDIST()
INTERCEPT()
KURT()
LARGE()
LINEST()
LOGEST()
LOGINV()
LOGNORMDIST()
MAX()
MAXA()
MAXIF()
MEDIAN()
MIN()
MINA()
MINIF()
MODE()
NEGBINOMDIST()
NORMDIST()
NORMINV()
NORMSDIST()
NORMSINV()
PERCENTILE()
PERCENTRANK()
PERMUT()
POISSON()
QUARTILE()
RANK()
RSQ()
SKEW()
SLOPE()
SMALL()
STANDARDIZE()
STDEV()
STDEVA()
STDEVP()
STDEVPA()
STEYX()
TDIST()
TINV()
TREND()
TRIMMEAN()
VARFunc()
VARA()
VARP()
VARPA()
WEIBULL()
ZTEST()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
checkTrendArrays()
beta()
incompleteBeta()
logBeta()
betaFraction()
logGamma()
incompleteGamma()
gamma()
inverseNcdf()
inverseNcdf2()
inverseNcdf3()
modeCalc()
$logBetaCacheP
$logBetaCacheQ
$logBetaCacheResult
$logGammaCacheResult
$logGammaCacheX
N/A

Properties

$logBetaCacheP

$logBetaCacheP : 

Type

$logBetaCacheQ

$logBetaCacheQ : 

Type

$logBetaCacheResult

$logBetaCacheResult : 

Type

$logGammaCacheResult

$logGammaCacheResult : 

Type

$logGammaCacheX

$logGammaCacheX : 

Type

Methods

AVEDEV()

AVEDEV() : float

AVEDEV

Returns the average of the absolute deviations of data points from their mean. AVEDEV is a measure of the variability in a data set.

Excel Function: AVEDEV(value1[,value2[, ...]])

Returns

float

AVERAGE()

AVERAGE() : float

AVERAGE

Returns the average (arithmetic mean) of the arguments

Excel Function: AVERAGE(value1[,value2[, ...]])

Returns

float

AVERAGEA()

AVERAGEA() : float

AVERAGEA

Returns the average of its arguments, including numbers, text, and logical values

Excel Function: AVERAGEA(value1[,value2[, ...]])

Returns

float

AVERAGEIF()

AVERAGEIF(  $aArgs, string  $condition, array<mixed,mixed>  $averageArgs = array()) : float

AVERAGEIF

Returns the average value from a range of cells that contain numbers within the list of arguments

Excel Function: AVERAGEIF(value1[,value2[, ...]],condition)

Parameters

$aArgs
string $condition

The criteria that defines which cells will be checked.

array<mixed,mixed> $averageArgs

Data values

Returns

float

BETADIST()

BETADIST(float  $value, float  $alpha, float  $beta,   $rMin,   $rMax = 1) : float

BETADIST

Returns the beta distribution.

Parameters

float $value

Value at which you want to evaluate the distribution

float $alpha

Parameter to the distribution

float $beta

Parameter to the distribution

$rMin
$rMax

Returns

float

BETAINV()

BETAINV(float  $probability, float  $alpha, float  $beta, float  $rMin, float  $rMax = 1) : float

BETAINV

Returns the inverse of the beta distribution.

Parameters

float $probability

Probability at which you want to evaluate the distribution

float $alpha

Parameter to the distribution

float $beta

Parameter to the distribution

float $rMin

Minimum value

float $rMax

Maximum value

Returns

float

BINOMDIST()

BINOMDIST(float  $value, float  $trials, float  $probability, boolean  $cumulative) : float

BINOMDIST

Returns the individual term binomial distribution probability. Use BINOMDIST in problems with a fixed number of tests or trials, when the outcomes of any trial are only success or failure, when trials are independent, and when the probability of success is constant throughout the experiment. For example, BINOMDIST can calculate the probability that two of the next three babies born are male.

Parameters

float $value

Number of successes in trials

float $trials

Number of trials

float $probability

Probability of success on each trial

boolean $cumulative

Returns

float

CHIDIST()

CHIDIST(float  $value, float  $degrees) : float

CHIDIST

Returns the one-tailed probability of the chi-squared distribution.

Parameters

float $value

Value for the function

float $degrees

degrees of freedom

Returns

float

CHIINV()

CHIINV(float  $probability, float  $degrees) : float

CHIINV

Returns the one-tailed probability of the chi-squared distribution.

Parameters

float $probability

Probability for the function

float $degrees

degrees of freedom

Returns

float

CONFIDENCE()

CONFIDENCE(float  $alpha, float  $stdDev, float  $size) : float

CONFIDENCE

Returns the confidence interval for a population mean

Parameters

float $alpha
float $stdDev

Standard Deviation

float $size

Returns

float

CORREL()

CORREL(  $yValues,   $xValues = null) : float

CORREL

Returns covariance, the average of the products of deviations for each data point pair.

Parameters

$yValues
$xValues

Returns

float

COUNT()

COUNT() : integer

COUNT

Counts the number of cells that contain numbers within the list of arguments

Excel Function: COUNT(value1[,value2[, ...]])

Returns

integer

COUNTA()

COUNTA() : integer

COUNTA

Counts the number of cells that are not empty within the list of arguments

Excel Function: COUNTA(value1[,value2[, ...]])

Returns

integer

COUNTBLANK()

COUNTBLANK() : integer

COUNTBLANK

Counts the number of empty cells within the list of arguments

Excel Function: COUNTBLANK(value1[,value2[, ...]])

Returns

integer

COUNTIF()

COUNTIF(  $aArgs, string  $condition) : integer

COUNTIF

Counts the number of cells that contain numbers within the list of arguments

Excel Function: COUNTIF(value1[,value2[, ...]],condition)

Parameters

$aArgs
string $condition

The criteria that defines which cells will be counted.

Returns

integer

COVAR()

COVAR(  $yValues,   $xValues) : float

COVAR

Returns covariance, the average of the products of deviations for each data point pair.

Parameters

$yValues
$xValues

Returns

float

CRITBINOM()

CRITBINOM(float  $trials, float  $probability, float  $alpha) : integer

CRITBINOM

Returns the smallest value for which the cumulative binomial distribution is greater than or equal to a criterion value

See http://support.microsoft.com/kb/828117/ for details of the algorithm used

Parameters

float $trials

number of Bernoulli trials

float $probability

probability of a success on each trial

float $alpha

criterion value

Returns

integer

DEVSQ()

DEVSQ() : float

DEVSQ

Returns the sum of squares of deviations of data points from their sample mean.

Excel Function: DEVSQ(value1[,value2[, ...]])

Returns

float

EXPONDIST()

EXPONDIST(float  $value, float  $lambda, boolean  $cumulative) : float

EXPONDIST

Returns the exponential distribution. Use EXPONDIST to model the time between events, such as how long an automated bank teller takes to deliver cash. For example, you can use EXPONDIST to determine the probability that the process takes at most 1 minute.

Parameters

float $value

Value of the function

float $lambda

The parameter value

boolean $cumulative

Returns

float

FISHER()

FISHER(float  $value) : float

FISHER

Returns the Fisher transformation at x. This transformation produces a function that is normally distributed rather than skewed. Use this function to perform hypothesis testing on the correlation coefficient.

Parameters

float $value

Returns

float

FISHERINV()

FISHERINV(float  $value) : float

FISHERINV

Returns the inverse of the Fisher transformation. Use this transformation when analyzing correlations between ranges or arrays of data. If y = FISHER(x), then FISHERINV(y) = x.

Parameters

float $value

Returns

float

FORECAST()

FORECAST(  $xValue,   $yValues,   $xValues) : float

FORECAST

Calculates, or predicts, a future value by using existing values. The predicted value is a y-value for a given x-value.

Parameters

$xValue
$yValues
$xValues

Returns

float

GAMMADIST()

GAMMADIST(float  $value, float  $a, float  $b, boolean  $cumulative) : float

GAMMADIST

Returns the gamma distribution.

Parameters

float $value

Value at which you want to evaluate the distribution

float $a

Parameter to the distribution

float $b

Parameter to the distribution

boolean $cumulative

Returns

float

GAMMAINV()

GAMMAINV(float  $probability, float  $alpha, float  $beta) : float

GAMMAINV

Returns the inverse of the beta distribution.

Parameters

float $probability

Probability at which you want to evaluate the distribution

float $alpha

Parameter to the distribution

float $beta

Parameter to the distribution

Returns

float

GAMMALN()

GAMMALN(float  $value) : float

GAMMALN

Returns the natural logarithm of the gamma function.

Parameters

float $value

Returns

float

GEOMEAN()

GEOMEAN() : float

GEOMEAN

Returns the geometric mean of an array or range of positive data. For example, you can use GEOMEAN to calculate average growth rate given compound interest with variable rates.

Excel Function: GEOMEAN(value1[,value2[, ...]])

Returns

float

GROWTH()

GROWTH(  $yValues,   $xValues = array(),   $newValues = array(),   $const = true) : array

GROWTH

Returns values along a predicted emponential trend

Parameters

$yValues
$xValues
$newValues
$const

Returns

array —

of float

HARMEAN()

HARMEAN() : float

HARMEAN

Returns the harmonic mean of a data set. The harmonic mean is the reciprocal of the arithmetic mean of reciprocals.

Excel Function: HARMEAN(value1[,value2[, ...]])

Returns

float

HYPGEOMDIST()

HYPGEOMDIST(float  $sampleSuccesses, float  $sampleNumber, float  $populationSuccesses, float  $populationNumber) : float

HYPGEOMDIST

Returns the hypergeometric distribution. HYPGEOMDIST returns the probability of a given number of sample successes, given the sample size, population successes, and population size.

Parameters

float $sampleSuccesses

Number of successes in the sample

float $sampleNumber

Size of the sample

float $populationSuccesses

Number of successes in the population

float $populationNumber

Population size

Returns

float

INTERCEPT()

INTERCEPT(  $yValues,   $xValues) : float

INTERCEPT

Calculates the point at which a line will intersect the y-axis by using existing x-values and y-values.

Parameters

$yValues
$xValues

Returns

float

KURT()

KURT() : float

KURT

Returns the kurtosis of a data set. Kurtosis characterizes the relative peakedness or flatness of a distribution compared with the normal distribution. Positive kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a relatively flat distribution.

Returns

float

LARGE()

LARGE() : float

LARGE

Returns the nth largest value in a data set. You can use this function to select a value based on its relative standing.

Excel Function: LARGE(value1[,value2[, ...]],entry)

Returns

float

LINEST()

LINEST(  $yValues,   $xValues = null,   $const = true,   $stats = false) : array

LINEST

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
$xValues
$const
$stats

Returns

array

LOGEST()

LOGEST(  $yValues,   $xValues = null,   $const = true,   $stats = false) : array

LOGEST

Calculates an exponential curve that best fits the X and Y data series, and then returns an array that describes the line.

Parameters

$yValues
$xValues
$const
$stats

Returns

array

LOGINV()

LOGINV(float  $probability, float  $mean, float  $stdDev) : float

LOGINV

Returns the inverse of the normal cumulative distribution

Parameters

float $probability
float $mean
float $stdDev

Returns

float

LOGNORMDIST()

LOGNORMDIST(float  $value, float  $mean, float  $stdDev) : float

LOGNORMDIST

Returns the cumulative lognormal distribution of x, where ln(x) is normally distributed with parameters mean and standard_dev.

Parameters

float $value
float $mean
float $stdDev

Returns

float

MAX()

MAX() : float

MAX

MAX returns the value of the element of the values passed that has the highest value, with negative numbers considered smaller than positive numbers.

Excel Function: MAX(value1[,value2[, ...]])

Returns

float

MAXA()

MAXA() : float

MAXA

Returns the greatest value in a list of arguments, including numbers, text, and logical values

Excel Function: MAXA(value1[,value2[, ...]])

Returns

float

MAXIF()

MAXIF(  $aArgs, string  $condition,   $sumArgs = array()) : float

MAXIF

Counts the maximum value within a range of cells that contain numbers within the list of arguments

Excel Function: MAXIF(value1[,value2[, ...]],condition)

Parameters

$aArgs
string $condition

The criteria that defines which cells will be checked.

$sumArgs

Returns

float

MEDIAN()

MEDIAN() : float

MEDIAN

Returns the median of the given numbers. The median is the number in the middle of a set of numbers.

Excel Function: MEDIAN(value1[,value2[, ...]])

Returns

float

MIN()

MIN() : float

MIN

MIN returns the value of the element of the values passed that has the smallest value, with negative numbers considered smaller than positive numbers.

Excel Function: MIN(value1[,value2[, ...]])

Returns

float

MINA()

MINA() : float

MINA

Returns the smallest value in a list of arguments, including numbers, text, and logical values

Excel Function: MINA(value1[,value2[, ...]])

Returns

float

MINIF()

MINIF(  $aArgs, string  $condition,   $sumArgs = array()) : float

MINIF

Returns the minimum value within a range of cells that contain numbers within the list of arguments

Excel Function: MINIF(value1[,value2[, ...]],condition)

Parameters

$aArgs
string $condition

The criteria that defines which cells will be checked.

$sumArgs

Returns

float

MODE()

MODE() : float

MODE

Returns the most frequently occurring, or repetitive, value in an array or range of data

Excel Function: MODE(value1[,value2[, ...]])

Returns

float

NEGBINOMDIST()

NEGBINOMDIST(float  $failures, float  $successes, float  $probability) : float

NEGBINOMDIST

Returns the negative binomial distribution. NEGBINOMDIST returns the probability that there will be number_f failures before the number_s-th success, when the constant probability of a success is probability_s. This function is similar to the binomial distribution, except that the number of successes is fixed, and the number of trials is variable. Like the binomial, trials are assumed to be independent.

Parameters

float $failures

Number of Failures

float $successes

Threshold number of Successes

float $probability

Probability of success on each trial

Returns

float

NORMDIST()

NORMDIST(float  $value, float  $mean, float  $stdDev, boolean  $cumulative) : float

NORMDIST

Returns the normal distribution for the specified mean and standard deviation. This function has a very wide range of applications in statistics, including hypothesis testing.

Parameters

float $value
float $mean

Mean Value

float $stdDev

Standard Deviation

boolean $cumulative

Returns

float

NORMINV()

NORMINV(  $probability, float  $mean, float  $stdDev) : float

NORMINV

Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.

Parameters

$probability
float $mean

Mean Value

float $stdDev

Standard Deviation

Returns

float

NORMSDIST()

NORMSDIST(float  $value) : float

NORMSDIST

Returns the standard normal cumulative distribution function. The distribution has a mean of 0 (zero) and a standard deviation of one. Use this function in place of a table of standard normal curve areas.

Parameters

float $value

Returns

float

NORMSINV()

NORMSINV(float  $value) : float

NORMSINV

Returns the inverse of the standard normal cumulative distribution

Parameters

float $value

Returns

float

PERCENTILE()

PERCENTILE() : float

PERCENTILE

Returns the nth percentile of values in a range..

Excel Function: PERCENTILE(value1[,value2[, ...]],entry)

Returns

float

PERCENTRANK()

PERCENTRANK(  $valueSet,   $value,   $significance = 3) : float

PERCENTRANK

Returns the rank of a value in a data set as a percentage of the data set.

Parameters

$valueSet
$value
$significance

Returns

float

PERMUT()

PERMUT(integer  $numObjs, integer  $numInSet) : integer

PERMUT

Returns the number of permutations for a given number of objects that can be selected from number objects. A permutation is any set or subset of objects or events where internal order is significant. Permutations are different from combinations, for which the internal order is not significant. Use this function for lottery-style probability calculations.

Parameters

integer $numObjs

Number of different objects

integer $numInSet

Number of objects in each permutation

Returns

integer —

Number of permutations

POISSON()

POISSON(float  $value, float  $mean, boolean  $cumulative) : float

POISSON

Returns the Poisson distribution. A common application of the Poisson distribution is predicting the number of events over a specific time, such as the number of cars arriving at a toll plaza in 1 minute.

Parameters

float $value
float $mean

Mean Value

boolean $cumulative

Returns

float

QUARTILE()

QUARTILE() : float

QUARTILE

Returns the quartile of a data set.

Excel Function: QUARTILE(value1[,value2[, ...]],entry)

Returns

float

RANK()

RANK(  $value,   $valueSet,   $order) : float

RANK

Returns the rank of a number in a list of numbers.

Parameters

$value
$valueSet
$order

Returns

float

RSQ()

RSQ(  $yValues,   $xValues) : float

RSQ

Returns the square of the Pearson product moment correlation coefficient through data points in known_y's and known_x's.

Parameters

$yValues
$xValues

Returns

float

SKEW()

SKEW() : float

SKEW

Returns the skewness of a distribution. Skewness characterizes the degree of asymmetry of a distribution around its mean. Positive skewness indicates a distribution with an asymmetric tail extending toward more positive values. Negative skewness indicates a distribution with an asymmetric tail extending toward more negative values.

Returns

float

SLOPE()

SLOPE(  $yValues,   $xValues) : float

SLOPE

Returns the slope of the linear regression line through data points in known_y's and known_x's.

Parameters

$yValues
$xValues

Returns

float

SMALL()

SMALL() : float

SMALL

Returns the nth smallest value in a data set. You can use this function to select a value based on its relative standing.

Excel Function: SMALL(value1[,value2[, ...]],entry)

Returns

float

STANDARDIZE()

STANDARDIZE(float  $value, float  $mean, float  $stdDev) : float

STANDARDIZE

Returns a normalized value from a distribution characterized by mean and standard_dev.

Parameters

float $value

Value to normalize

float $mean

Mean Value

float $stdDev

Standard Deviation

Returns

float —

Standardized value

STDEV()

STDEV() : float

STDEV

Estimates standard deviation based on a sample. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).

Excel Function: STDEV(value1[,value2[, ...]])

Returns

float

STDEVA()

STDEVA() : float

STDEVA

Estimates standard deviation based on a sample, including numbers, text, and logical values

Excel Function: STDEVA(value1[,value2[, ...]])

Returns

float

STDEVP()

STDEVP() : float

STDEVP

Calculates standard deviation based on the entire population

Excel Function: STDEVP(value1[,value2[, ...]])

Returns

float

STDEVPA()

STDEVPA() : float

STDEVPA

Calculates standard deviation based on the entire population, including numbers, text, and logical values

Excel Function: STDEVPA(value1[,value2[, ...]])

Returns

float

STEYX()

STEYX(  $yValues,   $xValues) : float

STEYX

Returns the standard error of the predicted y-value for each x in the regression.

Parameters

$yValues
$xValues

Returns

float

TDIST()

TDIST(float  $value, float  $degrees, float  $tails) : float

TDIST

Returns the probability of Student's T distribution.

Parameters

float $value

Value for the function

float $degrees

degrees of freedom

float $tails

number of tails (1 or 2)

Returns

float

TINV()

TINV(float  $probability, float  $degrees) : float

TINV

Returns the one-tailed probability of the chi-squared distribution.

Parameters

float $probability

Probability for the function

float $degrees

degrees of freedom

Returns

float

TREND()

TREND(  $yValues,   $xValues = array(),   $newValues = array(),   $const = true) : array

TREND

Returns values along a linear trend

Parameters

$yValues
$xValues
$newValues
$const

Returns

array —

of float

TRIMMEAN()

TRIMMEAN() : float

TRIMMEAN

Returns the mean of the interior of a data set. TRIMMEAN calculates the mean taken by excluding a percentage of data points from the top and bottom tails of a data set.

Excel Function: TRIMEAN(value1[,value2[, ...]], $discard)

Returns

float

VARFunc()

VARFunc() : float

VARFunc

Estimates variance based on a sample.

Excel Function: VAR(value1[,value2[, ...]])

Returns

float

VARA()

VARA() : float

VARA

Estimates variance based on a sample, including numbers, text, and logical values

Excel Function: VARA(value1[,value2[, ...]])

Returns

float

VARP()

VARP() : float

VARP

Calculates variance based on the entire population

Excel Function: VARP(value1[,value2[, ...]])

Returns

float

VARPA()

VARPA() : float

VARPA

Calculates variance based on the entire population, including numbers, text, and logical values

Excel Function: VARPA(value1[,value2[, ...]])

Returns

float

WEIBULL()

WEIBULL(float  $value, float  $alpha, float  $beta, boolean  $cumulative) : float

WEIBULL

Returns the Weibull distribution. Use this distribution in reliability analysis, such as calculating a device's mean time to failure.

Parameters

float $value
float $alpha

Alpha Parameter

float $beta

Beta Parameter

boolean $cumulative

Returns

float

ZTEST()

ZTEST(float  $dataSet, float  $m0, float  $sigma = null) : float

ZTEST

Returns the Weibull distribution. Use this distribution in reliability analysis, such as calculating a device's mean time to failure.

Parameters

float $dataSet
float $m0

Alpha Parameter

float $sigma

Beta Parameter

Returns

float

checkTrendArrays()

checkTrendArrays(  $array1,   $array2) 

Parameters

$array1
$array2

beta()

beta(  $p,   $q) : 

Beta function.

Parameters

$p
$q

Returns

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

incompleteBeta()

incompleteBeta(  $x,   $p,   $q) : 

Incomplete beta function

Parameters

$x
$p
$q

Returns

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

logBeta()

logBeta(  $p,   $q) : 

The natural logarithm of the beta function.

Parameters

$p
$q

Returns

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

betaFraction()

betaFraction(  $x,   $p,   $q) 

Evaluates of continued fraction part of incomplete beta function.

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

Parameters

$x
$p
$q

logGamma()

logGamma(  $x) 

Parameters

$x

incompleteGamma()

incompleteGamma(  $a,   $x) 

Parameters

$a
$x

gamma()

gamma(  $data) 

Parameters

$data

inverseNcdf()

inverseNcdf(  $p) 

Parameters

$p

inverseNcdf2()

inverseNcdf2(  $prob) 

Parameters

$prob

inverseNcdf3()

inverseNcdf3(  $p) 

Parameters

$p

modeCalc()

modeCalc(  $data) 

Parameters

$data