Cleanup code

This commit is contained in:
Dennis Eichhorn 2023-11-11 22:29:00 +00:00
parent 5433e64d8e
commit 047d96a776
31 changed files with 370 additions and 22 deletions

View File

@ -27,27 +27,69 @@ use phpOMS\Math\Matrix\Exception\InvalidDimensionException;
*/
final class Average
{
public const MA3 = [1 / 3, 1 / 3];
/**
* Moving average weights
*
* @var float[]
* @since 1.0.0
*/
public const MA3 = [1 / 3, 1 / 3, 1 / 3];
public const MA5 = [0.2, 0.2, 0.2];
/**
* Moving average weights
*
* @var float[]
* @since 1.0.0
*/
public const MA5 = [0.2, 0.2, 0.2, 0.2, 0.2];
public const MA2X12 = [5 / 6, 5 / 6, 5 / 6, 5 / 6, 5 / 6, 5 / 6, 0.42];
/**
* Moving average weights
*
* @var float[]
* @since 1.0.0
*/
public const MAS15 = [-0.009, -0.019, -0.016, 0.009, 2 / 3, 0.144, 0.209, 0.231, 0.209, 0.144, 2 / 3, 0.009, -0.016, -0.019, -0.009];
public const MA3X3 = [1 / 3, 2 / 9, 1 / 9];
/**
* Moving average weights
*
* @var float[]
* @since 1.0.0
*/
public const MAS21 = [-0.003, -0.009, -0.014, -0.014, -0.006, 0.017, 0.51, 0.37, 0.134, 0.163, 0.171, 0.163, 0.134, 0.37, 0.51, 0.017, -0.006, -0.014, -0.014, -0.009, -0.003];
public const MA3X5 = [0.2, 0.2, 2 / 15, 4 / 6];
/**
* Moving average weights
*
* @var float[]
* @since 1.0.0
*/
public const MAH5 = [-0.73, 0.294, 0.558, 0.294, -0.73];
public const MAS15 = [0.231, 0.209, 0.144, 2 / 3, 0.009, -0.016, -0.019, -0.009];
/**
* Moving average weights
*
* @var float[]
* @since 1.0.0
*/
public const MAH9 = [-0.041, -0.01, 0.119, 0.267, 0.330, 0.267, 0.119, -0.010, -0.041];
public const MAS21 = [0.171, 0.163, 0.134, 0.37, 0.51, 0.017, -0.006, -0.014, -0.014, -0.009, -0.003];
/**
* Moving average weights
*
* @var float[]
* @since 1.0.0
*/
public const MAH13 = [-0.019, -0.028, 0, 0.66, 0.147, 0.214, 0.240, 0.214, 0.147, 0.66, 0, -0.028, -0.019];
public const MAH5 = [0.558, 0.294, -0.73];
public const MAH9 = [0.330, 0.267, 0.119, -0.010, -0.041];
public const MAH13 = [0.240, 0.214, 0.147, 0.66, 0, -0.028, -0.019];
public const MAH23 = [0.148, 0.138, 0.122, 0.097, 0.068, 0.039, 0.013, -0.005, -0.015, -0.016, -0.011, -0.004];
/**
* Moving average weights
*
* @var float[]
* @since 1.0.0
*/
public const MAH23 = [-0.004, -0.011, -0.016, -0.015, -0.005, 0.013, 0.039, 0.068, 0.097, 0.122, 0.138, 0.148, 0.138, 0.122, 0.097, 0.068, 0.039, 0.013, -0.005, -0.015, -0.016, -0.011, -0.004];
/**
* Constructor.

View File

@ -24,6 +24,16 @@ namespace phpOMS\Math\Statistic\Forecast;
*/
final class Forecasts
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get forecast/prediction interval.
*

View File

@ -24,6 +24,16 @@ namespace phpOMS\Math\Statistic\Forecast\Regression;
*/
final class LevelLevelRegression extends RegressionAbstract
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* {@inheritdoc}
*/

View File

@ -26,6 +26,16 @@ use phpOMS\Math\Matrix\Exception\InvalidDimensionException;
*/
final class LevelLogRegression extends RegressionAbstract
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* {@inheritdoc}
*

View File

@ -26,6 +26,16 @@ use phpOMS\Math\Matrix\Exception\InvalidDimensionException;
*/
final class LogLevelRegression extends RegressionAbstract
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* {@inheritdoc}
*

View File

@ -26,6 +26,16 @@ use phpOMS\Math\Matrix\Exception\InvalidDimensionException;
*/
final class LogLogRegression extends RegressionAbstract
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* {@inheritdoc}
*

View File

@ -26,6 +26,16 @@ use phpOMS\Math\Matrix\Matrix;
*/
final class MultipleLinearRegression extends RegressionAbstract
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get linear regression based on scatter plot.
*

View File

@ -27,6 +27,16 @@ use phpOMS\Math\Statistic\Average;
*/
final class PolynomialRegression
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get linear regression based on scatter plot.
*

View File

@ -27,6 +27,16 @@ use phpOMS\Math\Statistic\Average;
*/
abstract class RegressionAbstract
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get linear regression based on scatter plot.
*

View File

@ -24,6 +24,16 @@ namespace phpOMS\Math\Stochastic\Distribution;
*/
final class BernoulliDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get probability mass function.
*

View File

@ -27,6 +27,16 @@ use phpOMS\Math\Functions\Functions;
*/
final class BetaDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get expected value.
*

View File

@ -26,6 +26,16 @@ use phpOMS\Math\Functions\Functions;
*/
final class BinomialDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get mode.
*

View File

@ -24,6 +24,16 @@ namespace phpOMS\Math\Stochastic\Distribution;
*/
final class CauchyDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get probability density function.
*

View File

@ -74,6 +74,16 @@ final class ChiSquaredDistribution
100 => ['0.995' => 67.328, '0.99' => 70.065, '0.975' => 74.222, '0.95' => 77.929, '0.90' => 82.358, '0.10' => 118.498, '0.05' => 124.342, '0.025' => 129.561, '0.01' => 135.807, '0.005' => 140.169],
];
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Test hypthesis.
*

View File

@ -24,6 +24,16 @@ namespace phpOMS\Math\Stochastic\Distribution;
*/
final class ExponentialDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get probability density function.
*

View File

@ -26,6 +26,16 @@ use phpOMS\Math\Functions\Beta;
*/
final class FDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get probability density function.
*

View File

@ -26,6 +26,16 @@ use phpOMS\Math\Functions\Gamma;
*/
final class GammaDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get probability density function for shape and scale.
*

View File

@ -24,6 +24,16 @@ namespace phpOMS\Math\Stochastic\Distribution;
*/
final class GeometricDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get probability mass function.
*

View File

@ -26,6 +26,16 @@ use phpOMS\Math\Functions\Functions;
*/
final class HypergeometricDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get probability mass function.
*

View File

@ -24,6 +24,16 @@ namespace phpOMS\Math\Stochastic\Distribution;
*/
final class LaplaceDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get probability density function.
*

View File

@ -34,6 +34,16 @@ final class LogDistribution
*/
public const EPSILON = 4.88e-04;
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get probability mass function.
*

View File

@ -26,6 +26,16 @@ use phpOMS\Math\Functions\Functions;
*/
final class LogNormalDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get probability density function.
*

View File

@ -24,6 +24,16 @@ namespace phpOMS\Math\Stochastic\Distribution;
*/
final class LogisticDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get probability density function.
*

View File

@ -39,6 +39,16 @@ final class NormalDistribution
'0.85' => 1.44, '0.90' => 1.64, '0.95' => 1.96, '0.96' => 2.05, '0.97' => 2.17, '0.98' => 2.33, '0.99' => 2.58,
];
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Calculate the sample size
*

View File

@ -24,6 +24,16 @@ namespace phpOMS\Math\Stochastic\Distribution;
*/
final class ParetoDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get probability density function.
*

View File

@ -27,6 +27,16 @@ use phpOMS\Math\Functions\Gamma;
*/
final class PoissonDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get density.
*

View File

@ -72,6 +72,16 @@ final class TDistribution
1000 => ['0' => 0.000, '0.5' => 0.675, '0.6' => 0.842, '0.7' => 1.037, '0.8' => 1.282, '0.9' => 1.646, '0.95' => 1.962, '0.98' => 2.330, '0.99' => 2.581, '0.998' => 3.098, '0.999' => 3.300,],
];
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get expected value.
*

View File

@ -24,6 +24,16 @@ namespace phpOMS\Math\Stochastic\Distribution;
*/
final class UniformDistributionContinuous
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get mode.
*

View File

@ -24,6 +24,16 @@ namespace phpOMS\Math\Stochastic\Distribution;
*/
final class UniformDistributionDiscrete
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get probability mass function.
*

View File

@ -26,6 +26,16 @@ use phpOMS\Math\Functions\Gamma;
*/
final class WeibullDistribution
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Get probability density function.
*

View File

@ -31,15 +31,31 @@ use phpOMS\Math\Statistic\MeasureOfDispersion;
*/
final class ZTesting
{
/**
* Percentile table
*
* @var array<string, float>
* @since 1.0.0
*/
public const TABLE = [
'2.58' => 0.99,
'2.33' => 0.98,
'1.96' => 0.95,
'1.64' => 0.90,
'1.44' => 0.85,
'1.28' => 0.80,
'0.99' => 2.58,
'0.98' => 2.33,
'0.95' => 1.96,
'0.90' => 1.64,
'0.85' => 1.44,
'0.80' => 1.28,
];
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* Test hypthesis.
*
@ -58,8 +74,8 @@ final class ZTesting
$zSignificance = 0.0;
foreach (self::TABLE as $key => $value) {
if ($significance === $value) {
$zSignificance = (float) $key;
if ($significance === (float) $key) {
$zSignificance = $value;
}
}