src/Regression/LogarithmicRegression.php 1 location
|
@@ 51-54 (lines=4) @@
|
48 |
|
|
49 |
|
$A = ($this->sumIndex[2] - $B * $this->sumIndex[0]) / $k; |
50 |
|
|
51 |
|
foreach ($this->sourceSequence as $i => $val) { |
52 |
|
$coordinate = [$val[0], $A + $B * \log($val[0])]; |
53 |
|
$this->resultSequence[] = $coordinate; |
54 |
|
} |
55 |
|
|
56 |
|
$this->equation = 'y = ' . \round($A, 2) . ' + ' . \round($B, 2) . ' ln(x)'; |
57 |
|
|
src/Regression/ExponentialRegression.php 1 location
|
@@ 53-56 (lines=4) @@
|
50 |
|
$A = \exp(($this->sumIndex[2] * $this->sumIndex[3] - $this->sumIndex[5] * $this->sumIndex[4]) / $denominator); |
51 |
|
$B = ($this->sumIndex[1] * $this->sumIndex[4] - $this->sumIndex[5] * $this->sumIndex[3]) / $denominator; |
52 |
|
|
53 |
|
foreach ($this->sourceSequence as $i => $val) { |
54 |
|
$coordinate = [$val[0], $A * \exp($B * $val[0])]; |
55 |
|
$this->resultSequence[] = $coordinate; |
56 |
|
} |
57 |
|
|
58 |
|
$this->equation = 'y = ' . \round($A, 2) . ' + e^(' . \round($B, 2) . 'x)'; |
59 |
|
|
src/Regression/LinearRegression.php 1 location
|
@@ 55-58 (lines=4) @@
|
52 |
|
|
53 |
|
$intercept = $this->sumIndex[1] / $k - $gradient * $this->sumIndex[0] / $k; |
54 |
|
|
55 |
|
foreach ($this->sourceSequence as $i => $val) { |
56 |
|
$coordinate = [$val[0], $val[0] * $gradient + $intercept]; |
57 |
|
$this->resultSequence[] = $coordinate; |
58 |
|
} |
59 |
|
|
60 |
|
$this->equation = 'y = ' . \round($gradient, 1) . 'x + ' . \round($intercept, 1); |
61 |
|
|