PHP Class MathPHP\Statistics\Regression\Regression

Show file Open project: markrogoyski/math-php

Protected Properties

Property Type Description
$n integer Number of points
$points array .. ]
$xs array X values of the original points
$ys [type] Y values of the original points

Public Methods

Method Description
__construct ( array $points ) Constructor - Prepares the data arrays for regression analysis
evaluate ( number $x ) : number Evaluate the regression equation at x Uses the instance model's evaluateModel method.
getPoints ( ) : array Get points
getSampleSize ( ) : integer Get sample size (number of points)
getXs ( ) : array Get Xs (x values of each point)
getYs ( ) : array Get Ys (y values of each point)
yHat ( ) : array Ŷ (yhat) A list of the predicted values of Y given the regression.

Method Details

__construct() public method

Constructor - Prepares the data arrays for regression analysis
public __construct ( array $points )
$points array [ [x, y], [x, y], ... ]

evaluate() public method

Evaluate the regression equation at x Uses the instance model's evaluateModel method.
public evaluate ( number $x ) : number
$x number
return number

getPoints() public method

Get points
public getPoints ( ) : array
return array

getSampleSize() public method

Get sample size (number of points)
public getSampleSize ( ) : integer
return integer

getXs() public method

Get Xs (x values of each point)
public getXs ( ) : array
return array of x values

getYs() public method

Get Ys (y values of each point)
public getYs ( ) : array
return array of y values

yHat() public method

Ŷ (yhat) A list of the predicted values of Y given the regression.
public yHat ( ) : array
return array

Property Details

$n protected property

Number of points
protected int $n
return integer

$points protected property

.. ]
protected array $points
return array

$xs protected property

X values of the original points
protected array $xs
return array

$ys protected property

Y values of the original points
protected [type] $ys
return [type]