PHPExcel_Linear_Best_Fit

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

### Methods

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

    __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()

Inherited

inherited_from | \PHPExcel_Best_Fit::getBestFitType()

## getCorrelation()

    getCorrelation($dp)

Inherited

inherited_from | \PHPExcel_Best_Fit::getCorrelation()

### Parameters

#### $dp

## getCovariance()

    getCovariance($dp)

Inherited

inherited_from | \PHPExcel_Best_Fit::getCovariance()

### Parameters

#### $dp

## getDFResiduals()

    getDFResiduals($dp)

Inherited

inherited_from | \PHPExcel_Best_Fit::getDFResiduals()

### 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()

Inherited

inherited_from | \PHPExcel_Best_Fit::getError()

## getF()

    getF($dp)

Inherited

inherited_from | \PHPExcel_Best_Fit::getF()

### Parameters

#### $dp

## Return the goodness of fit for this regression

    getGoodnessOfFit(int $dp) : float

Inherited

inherited_from | \PHPExcel_Best_Fit::getGoodnessOfFit()

### Parameters

#### $dp

`int`

Number of places of decimal precision to return

### Returns

`float`

## getGoodnessOfFitPercent()

    getGoodnessOfFitPercent($dp)

Inherited

inherited_from | \PHPExcel_Best_Fit::getGoodnessOfFitPercent()

### Parameters

#### $dp

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

    getIntersect(int $dp) : string

Inherited

inherited_from | \PHPExcel_Best_Fit::getIntersect()

### Parameters

#### $dp

`int`

Number of places of decimal precision to display

### Returns

`string`

## Return the standard error of the Intersect

    getIntersectSE(int $dp) : string

Inherited

inherited_from | \PHPExcel_Best_Fit::getIntersectSE()

### Parameters

#### $dp

`int`

Number of places of decimal precision to display

### Returns

`string`

## getSSRegression()

    getSSRegression($dp)

Inherited

inherited_from | \PHPExcel_Best_Fit::getSSRegression()

### Parameters

#### $dp

## getSSResiduals()

    getSSResiduals($dp)

Inherited

inherited_from | \PHPExcel_Best_Fit::getSSResiduals()

### Parameters

#### $dp

## Return the Slope of the line

    getSlope(int $dp) : string

Inherited

inherited_from | \PHPExcel_Best_Fit::getSlope()

### Parameters

#### $dp

`int`

Number of places of decimal precision to display

### Returns

`string`

## Return the standard error of the Slope

    getSlopeSE(int $dp) : string

Inherited

inherited_from | \PHPExcel_Best_Fit::getSlopeSE()

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

Inherited

inherited_from | \PHPExcel_Best_Fit::getStdevOfResiduals()

### 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[]

Inherited

inherited_from | \PHPExcel_Best_Fit::getXValues()

### Returns

`float[]`X-Values

## getYBestFitValues()

    getYBestFitValues()

Inherited

inherited_from | \PHPExcel_Best_Fit::getYBestFitValues()

## _calculateGoodnessOfFit()

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

Inherited

inherited_from | \PHPExcel_Best_Fit::_calculateGoodnessOfFit()

### Parameters

#### $sumX

#### $sumY

#### $sumX2

#### $sumY2

#### $sumXY

#### $meanX

#### $meanY

#### $const

## _leastSquareFit()

    _leastSquareFit($yValues, $xValues, $const)

Inherited

inherited_from | \PHPExcel_Best_Fit::_leastSquareFit()

### Parameters

#### $yValues

#### $xValues

#### $const

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

    _linear_regression(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`

### Properties

##

    $_DFResiduals

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_DFResiduals

##

    $_F

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_F

##

    $_SSRegression

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_SSRegression

##

    $_SSResiduals

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_SSResiduals

##

    $_Xoffset

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_Xoffset

##

    $_Yoffset

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_Yoffset

##

    $_adjustToZero : boolean

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_adjustToZero

##

    $_bestFitType : string

##

    $_correlation

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_correlation

##

    $_covariance

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_covariance

##

    $_error : boolean

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_error

##

    $_goodnessOfFit

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_goodnessOfFit

##

    $_intersect

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_intersect

##

    $_intersectSE

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_intersectSE

##

    $_slope

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_slope

##

    $_slopeSE

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_slopeSE

##

    $_stdevOfResiduals

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_stdevOfResiduals

##

    $_valueCount : int

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_valueCount

##

    $_xValues : float[]

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_xValues

##

    $_yBestFitValues : float[]

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_yBestFitValues

##

    $_yValues : float[]

Inherited

inherited_from | \PHPExcel_Best_Fit::$$_yValues