All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.quantarray.anaheim.numerics.Variance.scala Maven / Gradle / Ivy

package com.quantarray.anaheim.numerics

object Variance {

  /**
   * Computes variance of the entire population.
   */
  def forPopulationOf(xs: Seq[Double]): Double = {
    val mean = Mean.of(xs)
    xs.map(x => (x - mean) * (x - mean)).sum / xs.size
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy