/** * Returns the moments of the distribution * * @param string $moments Which moments to compute. m for mean, v for variance, s for skew, k for kurtosis. Default 'mv' * @return type array A dictionary containing the first four moments of the distribution */ public function stats($moments = 'mv') { return $this->calculator->getStats($moments, $this->mu, $this->variance); }
/** * Returns a random float between $minimum and $minimum plus $maximum * * @param float $df The degrees of freedeom. Default 1 * @return float The random variate. */ public function getRvs($df = 1) { $Z = parent::getRvs(0, 1); $V = $this->chi->getRvs($df); return $Z / sqrt($V / $df); }
/** * Returns a Cauchy-distributed random float * * @param float $mu The location parameter * @param float $gamma The scale parameter * @return float The random variate. */ public function getRvs($mu = 0.0, $gamma = 1.0) { $u = $this->normal->getRvs(0, 1); $v = $this->normal->getRvs(0, 1); return $gamma * ($u / $v) + $mu; }