PHPExcel_Best_Fit

category | PHPExcel
package | PHPExcel_Shared_Trend
copyright | Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)

### Methods

## Define the regression

    __construct(float[] $yValues, float[] $xValues, boolean $const)

### Parameters

#### $yValues

`float[]`

The set of Y-values for this regression

#### $xValues

`float[]`

The set of X-values for this regression

#### $const

`boolean`

## getBestFitType()

    getBestFitType()

## getCorrelation()

    getCorrelation($dp)

### Parameters

#### $dp

## getCovariance()

    getCovariance($dp)

### Parameters

#### $dp

## getDFResiduals()

    getDFResiduals($dp)

### Parameters

#### $dp

## Return the Equation of the best-fit line

    getEquation(int $dp) : string

### Parameters

#### $dp

`int`

Number of places of decimal precision to display

### Returns

`string`

## getError()

    getError()

## getF()

    getF($dp)

### Parameters

#### $dp

## Return the goodness of fit for this regression

    getGoodnessOfFit(int $dp) : float

### Parameters

#### $dp

`int`

Number of places of decimal precision to return

### Returns

`float`

## getGoodnessOfFitPercent()

    getGoodnessOfFitPercent($dp)

### Parameters

#### $dp

## Return the Value of X where it intersects Y = 0

    getIntersect(int $dp) : string

### Parameters

#### $dp

`int`

Number of places of decimal precision to display

### Returns

`string`

## Return the standard error of the Intersect

    getIntersectSE(int $dp) : string

### Parameters

#### $dp

`int`

Number of places of decimal precision to display

### Returns

`string`

## getSSRegression()

    getSSRegression($dp)

### Parameters

#### $dp

## getSSResiduals()

    getSSResiduals($dp)

### Parameters

#### $dp

## Return the Slope of the line

    getSlope(int $dp) : string

### Parameters

#### $dp

`int`

Number of places of decimal precision to display

### Returns

`string`

## Return the standard error of the Slope

    getSlopeSE(int $dp) : string

### Parameters

#### $dp

`int`

Number of places of decimal precision to display

### Returns

`string`

## Return the standard deviation of the residuals for this regression

    getStdevOfResiduals(int $dp) : float

### Parameters

#### $dp

`int`

Number of places of decimal precision to return

### Returns

`float`

## Return the X-Value for a specified value of Y

    getValueOfXForY(float $yValue) : float

### Parameters

#### $yValue

`float`

Y-Value

### Returns

`float`X-Value

## Return the Y-Value for a specified value of X

    getValueOfYForX(float $xValue) : float

### Parameters

#### $xValue

`float`

X-Value

### Returns

`float`Y-Value

## Return the original set of X-Values

    getXValues() : float[]

### Returns

`float[]`X-Values

## getYBestFitValues()

    getYBestFitValues()

## _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

### Properties

##

    $_DFResiduals

##

    $_F

##

    $_SSRegression

##

    $_SSResiduals

##

    $_Xoffset

##

    $_Yoffset

##

    $_adjustToZero : boolean

##

    $_bestFitType : string

##

    $_correlation

##

    $_covariance

##

    $_error : boolean

##

    $_goodnessOfFit

##

    $_intersect

##

    $_intersectSE

##

    $_slope

##

    $_slopeSE

##

    $_stdevOfResiduals

##

    $_valueCount : int

##

    $_xValues : float[]

##

    $_yBestFitValues : float[]

##

    $_yValues : float[]