mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
43 lines
871 B
PHP
43 lines
871 B
PHP
<?php
|
|
/**
|
|
* Orange Management
|
|
*
|
|
* PHP Version 7.1
|
|
*
|
|
* @category TBD
|
|
* @package TBD
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link http://orange-management.com
|
|
*/
|
|
declare(strict_types=1);
|
|
namespace phpOMS\Math\Statistic\Forecast\Regression;
|
|
|
|
use phpOMS\Math\Matrix\Matrix;
|
|
|
|
class MultipleLinearRegression
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public static function getRegression(array $x, array $y) : array
|
|
{
|
|
$X = new Matrix(count($x), count($x[0]));
|
|
$X->setMatrix($x);
|
|
$XT = $X->transpose();
|
|
|
|
$Y = new Matrix(count($y));
|
|
$Y->setMatrix($y);
|
|
|
|
return $XT->mult($X)->inverse()->mult($XT)->mult($Y)->getMatrix();
|
|
}
|
|
|
|
public static function getVariance() : float
|
|
{
|
|
}
|
|
|
|
public static function getPredictionInterval() : array
|
|
{
|
|
}
|
|
} |