Documentation

PolynomialBestFit extends BestFit
in package

Table of Contents

Properties

$adjustToZero  : bool
Flag indicating whether values should be adjusted to Y=0.
$bestFitType  : string
Algorithm type to use for best-fit (Name of this Trend class).
$correlation  : float
$covariance  : float
$DFResiduals  : float
$error  : bool
Indicator flag for a calculation error.
$f  : float
$goodnessOfFit  : float
$intersect  : float
$intersectSE  : float
$order  : int
Polynomial order.
$slope  : float
$slopeSE  : float
$SSRegression  : float
$SSResiduals  : float
$stdevOfResiduals  : float
$valueCount  : int
Number of entries in the sets of x- and y-value arrays.
$xOffset  : float
$xValues  : array<string|int, float>
X-value dataseries of values.
$yBestFitValues  : array<string|int, float>
Y-value series of best-fit values.
$yOffset  : float
$yValues  : array<string|int, float>
Y-value dataseries of values.

Methods

__construct()  : mixed
Define the regression and calculate the goodness of fit for a set of X and Y data values.
getBestFitType()  : string
getCoefficients()  : array<string|int, mixed>
getCorrelation()  : float
getCovariance()  : float
getDFResiduals()  : float
getEquation()  : string
Return the Equation of the best-fit line.
getError()  : bool
getF()  : float
getGoodnessOfFit()  : float
Return the goodness of fit for this regression.
getGoodnessOfFitPercent()  : float
Return the goodness of fit for this regression.
getIntersect()  : float
Return the Value of X where it intersects Y = 0.
getIntersectSE()  : float
Return the standard error of the Intersect.
getOrder()  : int
Return the order of this polynomial.
getSlope()  : float
Return the Slope of the line.
getSlopeSE()  : float
Return the standard error of the Slope.
getSSRegression()  : float
getSSResiduals()  : float
getStdevOfResiduals()  : float
Return the standard deviation of the residuals for this regression.
getValueOfXForY()  : float
Return the X-Value for a specified value of Y.
getValueOfYForX()  : float
Return the Y-Value for a specified value of X.
getXValues()  : array<string|int, float>
Return the original set of X-Values.
getYBestFitValues()  : array<string|int, float>
calculateGoodnessOfFit()  : void
leastSquareFit()  : void
polynomialRegression()  : void
Execute the regression and calculate the goodness of fit for a set of X and Y data values.
sumSquares()  : float|int

Properties

$adjustToZero

Flag indicating whether values should be adjusted to Y=0.

protected bool $adjustToZero = false

$bestFitType

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

protected string $bestFitType = 'polynomial'

$correlation

protected float $correlation = 0

$covariance

protected float $covariance = 0

$DFResiduals

protected float $DFResiduals = 0

$error

Indicator flag for a calculation error.

protected bool $error = false

$goodnessOfFit

protected float $goodnessOfFit = 1

$intersect

protected float $intersect = 0

$intersectSE

protected float $intersectSE = 0

$slopeSE

protected float $slopeSE = 0

$SSRegression

protected float $SSRegression = 0

$SSResiduals

protected float $SSResiduals = 0

$stdevOfResiduals

protected float $stdevOfResiduals = 0

$valueCount

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

protected int $valueCount

$xOffset

protected float $xOffset = 0

$xValues

X-value dataseries of values.

protected array<string|int, float> $xValues = []

$yBestFitValues

Y-value series of best-fit values.

protected array<string|int, float> $yBestFitValues = []

$yOffset

protected float $yOffset = 0

$yValues

Y-value dataseries of values.

protected array<string|int, float> $yValues = []

Methods

__construct()

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

public __construct(int $order, array<string|int, float> $yValues[, array<string|int, float> $xValues = [] ]) : mixed
Parameters
$order : int

Order of Polynomial for this regression

$yValues : array<string|int, float>

The set of Y-values for this regression

$xValues : array<string|int, float> = []

The set of X-values for this regression

getBestFitType()

public getBestFitType() : string
Return values
string

getCoefficients()

public getCoefficients([int $dp = 0 ]) : array<string|int, mixed>
Parameters
$dp : int = 0
Return values
array<string|int, mixed>

getCorrelation()

public getCorrelation([int $dp = 0 ]) : float
Parameters
$dp : int = 0

Number of places of decimal precision to return

Return values
float

getCovariance()

public getCovariance([int $dp = 0 ]) : float
Parameters
$dp : int = 0

Number of places of decimal precision to return

Return values
float

getDFResiduals()

public getDFResiduals([int $dp = 0 ]) : float
Parameters
$dp : int = 0

Number of places of decimal precision to return

Return values
float

getEquation()

Return the Equation of the best-fit line.

public getEquation([int $dp = 0 ]) : string
Parameters
$dp : int = 0

Number of places of decimal precision to display

Return values
string

getError()

public getError() : bool
Return values
bool

getF()

public getF([int $dp = 0 ]) : float
Parameters
$dp : int = 0

Number of places of decimal precision to return

Return values
float

getGoodnessOfFit()

Return the goodness of fit for this regression.

public getGoodnessOfFit([int $dp = 0 ]) : float
Parameters
$dp : int = 0

Number of places of decimal precision to return

Return values
float

getGoodnessOfFitPercent()

Return the goodness of fit for this regression.

public getGoodnessOfFitPercent([int $dp = 0 ]) : float
Parameters
$dp : int = 0

Number of places of decimal precision to return

Return values
float

getIntersect()

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

public getIntersect([int $dp = 0 ]) : float
Parameters
$dp : int = 0

Number of places of decimal precision to display

Return values
float

getIntersectSE()

Return the standard error of the Intersect.

public getIntersectSE([int $dp = 0 ]) : float
Parameters
$dp : int = 0

Number of places of decimal precision to display

Return values
float

getOrder()

Return the order of this polynomial.

public getOrder() : int
Return values
int

getSlope()

Return the Slope of the line.

public getSlope([int $dp = 0 ]) : float
Parameters
$dp : int = 0

Number of places of decimal precision to display

Return values
float

getSlopeSE()

Return the standard error of the Slope.

public getSlopeSE([int $dp = 0 ]) : float
Parameters
$dp : int = 0

Number of places of decimal precision to display

Return values
float

getSSRegression()

public getSSRegression([int $dp = 0 ]) : float
Parameters
$dp : int = 0

Number of places of decimal precision to return

Return values
float

getSSResiduals()

public getSSResiduals([int $dp = 0 ]) : float
Parameters
$dp : int = 0

Number of places of decimal precision to return

Return values
float

getStdevOfResiduals()

Return the standard deviation of the residuals for this regression.

public getStdevOfResiduals([int $dp = 0 ]) : float
Parameters
$dp : int = 0

Number of places of decimal precision to return

Return values
float

getValueOfXForY()

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

public getValueOfXForY(float $yValue) : float
Parameters
$yValue : float

Y-Value

Return values
float

X-Value

getValueOfYForX()

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

public getValueOfYForX(float $xValue) : float
Parameters
$xValue : float

X-Value

Return values
float

Y-Value

getXValues()

Return the original set of X-Values.

public getXValues() : array<string|int, float>
Return values
array<string|int, float>

X-Values

getYBestFitValues()

public getYBestFitValues() : array<string|int, float>
Return values
array<string|int, float>

calculateGoodnessOfFit()

protected calculateGoodnessOfFit(float $sumX, float $sumY, float $sumX2, float $sumY2, float $sumXY, float $meanX, float $meanY, bool|int $const) : void
Parameters
$sumX : float
$sumY : float
$sumX2 : float
$sumY2 : float
$sumXY : float
$meanX : float
$meanY : float
$const : bool|int

leastSquareFit()

protected leastSquareFit(array<string|int, float> $yValues, array<string|int, float> $xValues, bool $const) : void
Parameters
$yValues : array<string|int, float>
$xValues : array<string|int, float>
$const : bool

polynomialRegression()

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

private polynomialRegression(int $order, array<string|int, float> $yValues, array<string|int, float> $xValues) : void
Parameters
$order : int

Order of Polynomial for this regression

$yValues : array<string|int, float>

The set of Y-values for this regression

$xValues : array<string|int, float>

The set of X-values for this regression

sumSquares()

private sumSquares(array<string|int, mixed> $values) : float|int
Parameters
$values : array<string|int, mixed>
Return values
float|int

        
On this page

Search results