class LinearBestFit extends BestFit (View source)

Properties

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

Methods

getError()

No description

from BestFit
getBestFitType()

No description

from BestFit
bool
getValueOfYForX(float $xValue)

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

bool
getValueOfXForY(float $yValue)

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

float[]
getXValues()

Return the original set of X-Values.

from BestFit
bool
getEquation(int $dp = 0)

Return the Equation of the best-fit line.

float
getSlope(int $dp = 0)

Return the Slope of the line.

from BestFit
float
getSlopeSE(int $dp = 0)

Return the standard error of the Slope.

from BestFit
float
getIntersect(int $dp = 0)

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

from BestFit
float
getIntersectSE(int $dp = 0)

Return the standard error of the Intersect.

from BestFit
float
getGoodnessOfFit(int $dp = 0)

Return the goodness of fit for this regression.

from BestFit
float
getGoodnessOfFitPercent(int $dp = 0)

Return the goodness of fit for this regression.

from BestFit
float
getStdevOfResiduals(int $dp = 0)

Return the standard deviation of the residuals for this regression.

from BestFit
float
getSSRegression(int $dp = 0)

No description

from BestFit
float
getSSResiduals(int $dp = 0)

No description

from BestFit
float
getDFResiduals(int $dp = 0)

No description

from BestFit
float
getF(int $dp = 0)

No description

from BestFit
float
getCovariance(int $dp = 0)

No description

from BestFit
float
getCorrelation(int $dp = 0)

No description

from BestFit
float[]
getYBestFitValues()

No description

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

No description

from BestFit
leastSquareFit(array $yValues, array $xValues, bool $const)

No description

from BestFit
__construct(float[] $yValues, float[] $xValues = [], bool $const = true)

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

Details

getError()

getBestFitType()

bool getValueOfYForX(float $xValue)

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

Parameters

float $xValue X-Value

Return Value

bool Y-Value

bool getValueOfXForY(float $yValue)

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

Parameters

float $yValue Y-Value

Return Value

bool X-Value

float[] getXValues()

Return the original set of X-Values.

Return Value

float[] X-Values

bool getEquation(int $dp = 0)

Return the Equation of the best-fit line.

Parameters

int $dp Number of places of decimal precision to display

Return Value

bool

float getSlope(int $dp = 0)

Return the Slope of the line.

Parameters

int $dp Number of places of decimal precision to display

Return Value

float

float getSlopeSE(int $dp = 0)

Return the standard error of the Slope.

Parameters

int $dp Number of places of decimal precision to display

Return Value

float

float getIntersect(int $dp = 0)

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

Parameters

int $dp Number of places of decimal precision to display

Return Value

float

float getIntersectSE(int $dp = 0)

Return the standard error of the Intersect.

Parameters

int $dp Number of places of decimal precision to display

Return Value

float

float getGoodnessOfFit(int $dp = 0)

Return the goodness of fit for this regression.

Parameters

int $dp Number of places of decimal precision to return

Return Value

float

float getGoodnessOfFitPercent(int $dp = 0)

Return the goodness of fit for this regression.

Parameters

int $dp Number of places of decimal precision to return

Return Value

float

float getStdevOfResiduals(int $dp = 0)

Return the standard deviation of the residuals for this regression.

Parameters

int $dp Number of places of decimal precision to return

Return Value

float

float getSSRegression(int $dp = 0)

Parameters

int $dp Number of places of decimal precision to return

Return Value

float

float getSSResiduals(int $dp = 0)

Parameters

int $dp Number of places of decimal precision to return

Return Value

float

float getDFResiduals(int $dp = 0)

Parameters

int $dp Number of places of decimal precision to return

Return Value

float

float getF(int $dp = 0)

Parameters

int $dp Number of places of decimal precision to return

Return Value

float

float getCovariance(int $dp = 0)

Parameters

int $dp Number of places of decimal precision to return

Return Value

float

float getCorrelation(int $dp = 0)

Parameters

int $dp Number of places of decimal precision to return

Return Value

float

float[] getYBestFitValues()

Return Value

float[]

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

Parameters

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

protected leastSquareFit(array $yValues, array $xValues, bool $const)

Parameters

array $yValues
array $xValues
bool $const

__construct(float[] $yValues, float[] $xValues = [], bool $const = true)

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

Parameters

float[] $yValues The set of Y-values for this regression
float[] $xValues The set of X-values for this regression
bool $const