class BestFit (View source)

Properties

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

Methods

getError()

No description

getBestFitType()

No description

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.

bool
getEquation(int $dp = 0)

Return the Equation of the best-fit line.

float
getSlope(int $dp = 0)

Return the Slope of the line.

float
getSlopeSE(int $dp = 0)

Return the standard error of the Slope.

float
getIntersect(int $dp = 0)

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

float
getIntersectSE(int $dp = 0)

Return the standard error of the Intersect.

float
getGoodnessOfFit(int $dp = 0)

Return the goodness of fit for this regression.

float
getGoodnessOfFitPercent(int $dp = 0)

Return the goodness of fit for this regression.

float
getStdevOfResiduals(int $dp = 0)

Return the standard deviation of the residuals for this regression.

float
getSSRegression(int $dp = 0)

No description

float
getSSResiduals(int $dp = 0)

No description

float
getDFResiduals(int $dp = 0)

No description

float
getF(int $dp = 0)

No description

float
getCovariance(int $dp = 0)

No description

float
getCorrelation(int $dp = 0)

No description

float[]
getYBestFitValues()

No description

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

No description

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

No description

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

Define the regression.

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.

Parameters

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