\PHPExcel_Linear_Best_Fit

PHPExcel_Linear_Best_Fit

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
getError()
getBestFitType()
getValueOfYForX()
getValueOfXForY()
getXValues()
getEquation()
getSlope()
getSlopeSE()
getIntersect()
getIntersectSE()
getGoodnessOfFit()
getGoodnessOfFitPercent()
getStdevOfResiduals()
getSSRegression()
getSSResiduals()
getDFResiduals()
getF()
getCovariance()
getCorrelation()
getYBestFitValues()
__construct()
No public properties found
No constants found
calculateGoodnessOfFit()
leastSquareFit()
$error
$bestFitType
$valueCount
$xValues
$yValues
$adjustToZero
$yBestFitValues
$goodnessOfFit
$stdevOfResiduals
$covariance
$correlation
$SSRegression
$SSResiduals
$DFResiduals
$f
$slope
$slopeSE
$intersect
$intersectSE
$xOffset
$yOffset
N/A
linearRegression()
No private properties found
N/A

Properties

$error

$error : boolean

Indicator flag for a calculation error

Type

boolean

$bestFitType

$bestFitType : string

Algorithm type to use for best-fit (Name of this trend class)

Type

string

$valueCount

$valueCount : integer

Number of entries in the sets of x- and y-value arrays

Type

integer

$xValues

$xValues : array<mixed,float>

X-value dataseries of values

Type

array<mixed,float>

$yValues

$yValues : array<mixed,float>

Y-value dataseries of values

Type

array<mixed,float>

$adjustToZero

$adjustToZero : boolean

Flag indicating whether values should be adjusted to Y=0

Type

boolean

$yBestFitValues

$yBestFitValues : array<mixed,float>

Y-value series of best-fit values

Type

array<mixed,float>

$goodnessOfFit

$goodnessOfFit : 

Type

$stdevOfResiduals

$stdevOfResiduals : 

Type

$covariance

$covariance : 

Type

$correlation

$correlation : 

Type

$SSRegression

$SSRegression : 

Type

$SSResiduals

$SSResiduals : 

Type

$DFResiduals

$DFResiduals : 

Type

$f

$f : 

Type

$slope

$slope : 

Type

$slopeSE

$slopeSE : 

Type

$intersect

$intersect : 

Type

$intersectSE

$intersectSE : 

Type

$xOffset

$xOffset : 

Type

$yOffset

$yOffset : 

Type

Methods

getError()

getError() 

getBestFitType()

getBestFitType() 

getValueOfYForX()

getValueOfYForX(float  $xValue) : float

Return the Y-Value for a specified value of X

Parameters

float $xValue

X-Value

Returns

float —

Y-Value

getValueOfXForY()

getValueOfXForY(float  $yValue) : float

Return the X-Value for a specified value of Y

Parameters

float $yValue

Y-Value

Returns

float —

X-Value

getXValues()

getXValues() : array<mixed,float>

Return the original set of X-Values

Returns

array<mixed,float> —

X-Values

getEquation()

getEquation(integer  $dp) : string

Return the Equation of the best-fit line

Parameters

integer $dp

Number of places of decimal precision to display

Returns

string

getSlope()

getSlope(integer  $dp) : string

Return the Slope of the line

Parameters

integer $dp

Number of places of decimal precision to display

Returns

string

getSlopeSE()

getSlopeSE(integer  $dp) : string

Return the standard error of the Slope

Parameters

integer $dp

Number of places of decimal precision to display

Returns

string

getIntersect()

getIntersect(integer  $dp) : string

Return the Value of X where it intersects Y = 0

Parameters

integer $dp

Number of places of decimal precision to display

Returns

string

getIntersectSE()

getIntersectSE(integer  $dp) : string

Return the standard error of the Intersect

Parameters

integer $dp

Number of places of decimal precision to display

Returns

string

getGoodnessOfFit()

getGoodnessOfFit(integer  $dp) : float

Return the goodness of fit for this regression

Parameters

integer $dp

Number of places of decimal precision to return

Returns

float

getGoodnessOfFitPercent()

getGoodnessOfFitPercent(  $dp) 

Parameters

$dp

getStdevOfResiduals()

getStdevOfResiduals(integer  $dp) : float

Return the standard deviation of the residuals for this regression

Parameters

integer $dp

Number of places of decimal precision to return

Returns

float

getSSRegression()

getSSRegression(  $dp) 

Parameters

$dp

getSSResiduals()

getSSResiduals(  $dp) 

Parameters

$dp

getDFResiduals()

getDFResiduals(  $dp) 

Parameters

$dp

getF()

getF(  $dp) 

Parameters

$dp

getCovariance()

getCovariance(  $dp) 

Parameters

$dp

getCorrelation()

getCorrelation(  $dp) 

Parameters

$dp

getYBestFitValues()

getYBestFitValues() 

__construct()

__construct(array<mixed,float>  $yValues, array<mixed,float>  $xValues = array(), boolean  $const = true) 

Define the regression and calculate the goodness of fit for a set of X and Y data values

Parameters

array<mixed,float> $yValues

The set of Y-values for this regression

array<mixed,float> $xValues

The set of X-values for this regression

boolean $const

calculateGoodnessOfFit()

calculateGoodnessOfFit(  $sumX,   $sumY,   $sumX2,   $sumY2,   $sumXY,   $meanX,   $meanY,   $const) 

Parameters

$sumX
$sumY
$sumX2
$sumY2
$sumXY
$meanX
$meanY
$const

leastSquareFit()

leastSquareFit(  $yValues,   $xValues,   $const) 

Parameters

$yValues
$xValues
$const

linearRegression()

linearRegression(array<mixed,float>  $yValues, array<mixed,float>  $xValues, boolean  $const) 

Execute the regression and calculate the goodness of fit for a set of X and Y data values

Parameters

array<mixed,float> $yValues

The set of Y-values for this regression

array<mixed,float> $xValues

The set of X-values for this regression

boolean $const