mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-07 21:18:39 +00:00
Regression latex documentation
This commit is contained in:
parent
51a016d228
commit
fed381ba8a
|
|
@ -142,7 +142,9 @@ class Error
|
||||||
/**
|
/**
|
||||||
* Goodness of fit.
|
* Goodness of fit.
|
||||||
*
|
*
|
||||||
* Evaluating how well the observed data fit the linear regression model
|
* Evaluating how well the observed data fit the linear regression model.
|
||||||
|
*
|
||||||
|
* @latex R^{2} = \frac{\sum \left(\hat{y}_{i} - \bar{y}\right)^2}{\sum \left(y_{i} - \bar{y}\right)^2}
|
||||||
*
|
*
|
||||||
* @param array $observed Obersved y values
|
* @param array $observed Obersved y values
|
||||||
* @param array $forecasted Forecasted y values
|
* @param array $forecasted Forecasted y values
|
||||||
|
|
|
||||||
|
|
@ -30,17 +30,7 @@ namespace phpOMS\Math\Statistic\Forecast\Regression;
|
||||||
class LevelLogRegression extends RegressionAbstract
|
class LevelLogRegression extends RegressionAbstract
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get linear regression based on scatter plot.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* y = b0 + b1 * x
|
|
||||||
*
|
|
||||||
* @param array $x Obersved x values
|
|
||||||
* @param array $y Observed y values
|
|
||||||
*
|
|
||||||
* @return array [b0 => ?, b1 => ?]
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
*/
|
||||||
public static function getRegression(array $x, array $y) : array
|
public static function getRegression(array $x, array $y) : array
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -30,17 +30,7 @@ namespace phpOMS\Math\Statistic\Forecast\Regression;
|
||||||
class LogLevelRegression extends RegressionAbstract
|
class LogLevelRegression extends RegressionAbstract
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get linear regression based on scatter plot.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* y = b0 + b1 * x
|
|
||||||
*
|
|
||||||
* @param array $x Obersved x values
|
|
||||||
* @param array $y Observed y values
|
|
||||||
*
|
|
||||||
* @return array [b0 => ?, b1 => ?]
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
*/
|
||||||
public static function getRegression(array $x, array $y) : array
|
public static function getRegression(array $x, array $y) : array
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -30,17 +30,7 @@ namespace phpOMS\Math\Statistic\Forecast\Regression;
|
||||||
class LogLogRegression extends RegressionAbstract
|
class LogLogRegression extends RegressionAbstract
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get linear regression based on scatter plot.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* y = b0 + b1 * x
|
|
||||||
*
|
|
||||||
* @param array $x Obersved x values
|
|
||||||
* @param array $y Observed y values
|
|
||||||
*
|
|
||||||
* @return array [b0 => ?, b1 => ?]
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
*/
|
||||||
public static function getRegression(array $x, array $y) : array
|
public static function getRegression(array $x, array $y) : array
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ namespace phpOMS\Math\Statistic\Forecast\Regression;
|
||||||
|
|
||||||
class MultipleLinearRegression
|
class MultipleLinearRegression
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
public static function getRegression(array $x, array $y) : array
|
public static function getRegression(array $x, array $y) : array
|
||||||
{
|
{
|
||||||
$X = new Matrix(count($x), count($x[0]));
|
$X = new Matrix(count($x), count($x[0]));
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ abstract class RegressionAbstract
|
||||||
/**
|
/**
|
||||||
* Get linear regression based on scatter plot.
|
* Get linear regression based on scatter plot.
|
||||||
*
|
*
|
||||||
* y = b0 + b1 * x
|
* @latex y = b_{0} + b_{1} \cdot x
|
||||||
*
|
*
|
||||||
* @param array $x Obersved x values
|
* @param array $x Obersved x values
|
||||||
* @param array $y Observed y values
|
* @param array $y Observed y values
|
||||||
|
|
@ -37,6 +37,8 @@ abstract class RegressionAbstract
|
||||||
*
|
*
|
||||||
* Used in order to evaluate the performance of the linear regression
|
* Used in order to evaluate the performance of the linear regression
|
||||||
*
|
*
|
||||||
|
* @latex s_{e} = \sqrt{\frac{1}{N - 2}\sum_{i = 1}^{N} e_{i}^{2}}
|
||||||
|
*
|
||||||
* @param array $errors Errors (e = y - y_forecasted)
|
* @param array $errors Errors (e = y - y_forecasted)
|
||||||
*
|
*
|
||||||
* @return float
|
* @return float
|
||||||
|
|
@ -88,6 +90,8 @@ abstract class RegressionAbstract
|
||||||
/**
|
/**
|
||||||
* Get linear regression parameter beta 1.
|
* Get linear regression parameter beta 1.
|
||||||
*
|
*
|
||||||
|
* @latex \beta_{1} = \frac{\sum_{i=1}^{N} \left(y_{i} - \bar{y}\right)\left(x_{i} - \bar{x}\right)}{\sum_{i=1}^{N} \left(x_{i} - \bar{x}\right)^{2}}
|
||||||
|
*
|
||||||
* @param array $x Obersved x values
|
* @param array $x Obersved x values
|
||||||
* @param array $y Observed y values
|
* @param array $y Observed y values
|
||||||
*
|
*
|
||||||
|
|
@ -116,6 +120,8 @@ abstract class RegressionAbstract
|
||||||
/**
|
/**
|
||||||
* Get linear regression parameter beta 0.
|
* Get linear regression parameter beta 0.
|
||||||
*
|
*
|
||||||
|
* @latex \beta_{0} = \bar{x} - b_{1} \cdot \bar{x}
|
||||||
|
*
|
||||||
* @param array $x Obersved x values
|
* @param array $x Obersved x values
|
||||||
* @param array $y Observed y values
|
* @param array $y Observed y values
|
||||||
* @param float $b1 Beta 1
|
* @param float $b1 Beta 1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user