Get the skewness using sample variance.

@return Skewness
169817
public double getSampleSkewness() {
    if(!(m2 > 0) || !(n > 2)) {
      throw new ArithmeticException("Skewness not defined when variance is 0 or weight <= 2.0!");
    }
    return (m3 * n / (n - 1) / (n - 2)) / FastMath.pow(getSampleVariance(), 1.5);
  }
307853
private double sumSquaredDiffs()
    {        
        double mean = getArithmeticMean();
        double squaredDiffs = 0;
        for (int i = 0; i < getSize(); i++)
        {
            double diff = mean - dataSet[i];
            squaredDiffs += (diff * diff);
        }
        return squaredDiffs;
    }
368879
public double getCorrelation() {
    if(!(sumXX > 0. && sumYY > 0.)) {
      return (sumXX == sumYY) ? 1. : 0.;
    }
    return sumXY / FastMath.sqrt(sumXX * sumYY);
  }
734187
private function computeCovariance()
    {
        $factorCallable = $this->coVarianceFactor;
        $this->factor = $factorCallable();

        // Cache covariance and inverse covariance of the data
        if (null === $this->_dataInvCov) {
            // original used the numpy.cov function.
            $this->_dataCovariance = pow(Statistics::stdev($this->dataset, true), 2);

            //$this->_dataInvCov = 1/ linalg.inv($this->_dataCovariance)
            $this->_dataInvCov = 1 / $this->_dataCovariance;
        }

        $this->covariance = $this->_dataCovariance * pow($this->factor, 2);
        $this->invCov = $this->_dataInvCov / pow($this->factor, 2);
        $this->normFactor = sqrt(2 * M_PI * $this->covariance) * count($this->dataset);
    }
1095219
public function guess() : float
    {
        if ($this->percentile === null or $this->mad === null) {
            throw new RuntimeException('Strategy has not been fitted.');
        }

        return $this->percentile
            + $this->blur
            * $this->gaussian()
            * $this->mad;
    }
555974
public double getCovariance() {
		if(covariance == null) {
			Observation o = new Observation();
			for(int i=0; i<observationA.getObservationCount(); i++)
				o.addValue(observationA.getValueAt(i)*observationB.getValueAt(i));
			covariance = o.getExpectation()-observationA.getExpectation()*observationB.getExpectation();
		}
		return covariance;
	}
691154
public double getVariance() {
        if (!DATA_LIST.isEmpty()) {
            double sum = 0;
            double sumOfSquares = 0;
            double average = 0;
            for (DataPoint dataPoint : DATA_LIST) {
                sumOfSquares += (dataPoint.getValue() * dataPoint.getValue());
                sum += dataPoint.getValue();
            }
            average = sum / DATA_LIST.size();
            return (sumOfSquares / DATA_LIST.size()) - average * average;
        }
        return 0;
    }
597166
public double[] getInterleavedSamples() {
        double[] samples = new double[(int) getSampleCount()];
        try {
            getInterleavedSamples(0, getSampleCount(), samples);
        } catch (IllegalArgumentException | IOException e) {
            e.printStackTrace();
        }

        return samples;
    }
1003236
def calculate_clock_skew(self):
        
        n = self.statx_n(self.data_points)

        """
        Required to be able to compute the standard
        deviation.
        """
        if n < 1:
            return Decimal("0")

        avg = self.statx_avg(self.data_points)
        sdev = self.statx_sdev(self.data_points)

        """
        Incrementally remove aberration points.
        """
        for k in range(0, self.clean_steps):
            """
            Remove aberration points: keep only
            the sigma range around the average.
            """
            min_val = avg - sdev
            max_val = avg + sdev

            cleaned_data_points = []
            for i in range(0, n):
                v = self.data_points[i]
                if v < min_val or v > max_val:
                    continue
                cleaned_data_points.append(v)

            self.data_points = cleaned_data_points[:]

            """
            Recompute the new average using the
            "sound" points we kept.
            """
            n = self.statx_n(self.data_points)

            """
            Not enough data to compute standard
            deviation.
            """
            if n < 2:
                break

            avg = self.statx_avg(self.data_points)
            sdev = self.statx_sdev(self.data_points)

            if sdev <= self.max_sdev or n < self.min_data:
                break

        """
        If standard deviation is too large still, we
        cannot update our clock. Collect more points.

        If we don't have a minimum amount of data,
        don't attempt the update yet, continue collecting.
        """
        if sdev > self.max_sdev or n < self.min_data:
            return Decimal("0")

        return avg
854697
private function getQualityFactor()
    {
        $qFactor = 0.0;

        if (2 === count(explode('/', $this->variant))) {
            $qFactor = $this->qFactor;
        }

        return $qFactor;
    }
141043
public function getCoverage() : float
    {
        $processor = new Processor();
        $result    = $processor->run($this->phpUnit . ' --coverage-text|grep Classes|cut -d " " -f 4|cut -d "%" -f 1');
        $output    = $result->getStdOut();
        if (!$result->isSuccessful() || empty($output)) {
            throw new RuntimeException('Error while executing PHPUnit: ' . $result->getStdErr());
        }
        return (float) $output;
    }
1048650
@Override
    public double rand() {
        int mm = m;
        int nn = n;

        if (mm > N / 2) {
            // invert mm
            mm = N - mm;
        }

        if (nn > N / 2) {
            // invert nn
            nn = N - nn;
        }

        if (nn > mm) {
            // swap nn and mm
            int swap = nn;
            nn = mm;
            mm = swap;
        }

        if (rng == null) {
            if ((double) nn * mm >= 20 * N) {
                // use ratio-of-uniforms method
                rng = new Patchwork(N, mm, nn);
            } else {
                // inversion method, using chop-down search from mode
                rng = new Inversion(N, mm, nn);
            }
        }

        return rng.rand();
    }
597114
protected boolean sample() {
        if (curr.increment() >= freq) {
            curr.set(0);
            target.set(rand.nextInt(freq));
        }
        return curr.get() == target.get();
    }
401963
public RandomVariable[]	getParameter() {
		double[] parameterAsDouble = this.getParameterAsDouble();
		RandomVariable[] parameter = new RandomVariable[parameterAsDouble.length];
		for(int i=0; i<parameter.length; i++) {
			parameter[i] = new Scalar(parameterAsDouble[i]);
		}
		return parameter;
	}
1179608
public function stdDev(){
		
		Number::setScale(static::NUMERIC_FUNCTIONS_SCALE);
		
		$mean = $this->average();
		$squares = new static();
		
		foreach($this->_Arr as $num){
			$squares->add(Number::pow(Number::sub(\strval($num), $mean), '2'));
		}
		
		return Number::sqrt($squares->average());
		
	}
1077219
@Override
    public double getStandardDeviation() {
        double stdDev = Double.NaN;
        if (getN() > 0) {
            if (getN() > 1) {
                stdDev = FastMath.sqrt(getVariance());
            } else {
                stdDev = 0.0;
            }
        }
        return stdDev;
    }
1277805
public int sample()
    {
        double val = this.rand.nextDouble() * this.sum;
        int sample = 0;		
        while(sample < this.likelihoods.length){
            val -= this.likelihoods[sample];
            if(val < 0){
                return sample;
            }
            
            sample++;			
        }
        
        return this.rand.nextInt(this.likelihoods.length);
    }