mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
173 lines
3.4 KiB
PHP
173 lines
3.4 KiB
PHP
<?php
|
|
/**
|
|
* Orange Management
|
|
*
|
|
* PHP Version 7.0
|
|
*
|
|
* @category TBD
|
|
* @package TBD
|
|
* @author OMS Development Team <dev@oms.com>
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
* @copyright 2013 Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link http://orange-management.com
|
|
*/
|
|
|
|
namespace phpOMS\Math\Stochastic\Distribution;
|
|
|
|
/**
|
|
* Normal distribution.
|
|
*
|
|
* @category Framework
|
|
* @package phpOMS\DataStorage\Database
|
|
* @author OMS Development Team <dev@oms.com>
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
* @license OMS License 1.0
|
|
* @link http://orange-management.com
|
|
* @since 1.0.0
|
|
*/
|
|
class NormalDistribution
|
|
{
|
|
|
|
/**
|
|
* Get probability density function.
|
|
*
|
|
* @param float $x
|
|
* @param float $mu
|
|
* @param float $sig
|
|
*
|
|
* @return float
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public static function getPdf(float $x, float $mu, float $sig) : float
|
|
{
|
|
return 1 / ($sig * sqrt(2 * pi())) * exp(-($x - $mu) ** 2 / (2 * $sig ** 2));
|
|
}
|
|
|
|
/**
|
|
* Get mode.
|
|
*
|
|
* @param float $mu
|
|
*
|
|
* @return float
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public static function getMode(float $mu) : float
|
|
{
|
|
return $mu;
|
|
}
|
|
|
|
/**
|
|
* Get expected value.
|
|
*
|
|
* @param float $mu
|
|
*
|
|
* @return float
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public static function getMean(float $mu) : float
|
|
{
|
|
return $mu;
|
|
}
|
|
|
|
/**
|
|
* Get expected value.
|
|
*
|
|
* @param float $mu
|
|
*
|
|
* @return float
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public static function getMedian(float $mu) : float
|
|
{
|
|
return $mu;
|
|
}
|
|
|
|
/**
|
|
* Get variance.
|
|
*
|
|
* @param float $sig
|
|
*
|
|
* @return float
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public static function getVariance(float $sig) : float
|
|
{
|
|
return $sig ** 2;
|
|
}
|
|
|
|
/**
|
|
* Get moment generating function.
|
|
*
|
|
* @param float $t
|
|
* @param float $mu
|
|
* @param float $sig
|
|
*
|
|
* @return float
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public static function getMgf(float $t, float $mu, float $sig) : float
|
|
{
|
|
return exp($mu * $t + ($sig ** 2 * $t ** 2) / 2);
|
|
}
|
|
|
|
/**
|
|
* Get skewness.
|
|
*
|
|
* @return float
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public static function getSkewness() : float
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* Get Fisher information.
|
|
*
|
|
* @param float $sig
|
|
*
|
|
* @return float
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public static function getFisherInformation(float $sig) : float
|
|
{
|
|
return [[1 / $sig ** 2, 0], [0, 1 / (2 * $sig ** 4)]];
|
|
}
|
|
|
|
/**
|
|
* Get Ex. kurtosis.
|
|
*
|
|
* @return float
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public static function getExKurtosis() : float
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
public static function getRandom()
|
|
{
|
|
|
|
}
|
|
}
|