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

com.expleague.commons.math.stat.StatTools Maven / Gradle / Ivy

Go to download

Utilities including math, charsequence based text processing, sequences etc.

There is a newer version: 1.4.9
Show newest version
package com.expleague.commons.math.stat;

import com.expleague.commons.math.MathTools;
import com.expleague.commons.math.vectors.Vec;
import com.expleague.commons.math.vectors.VecTools;

import static com.expleague.commons.math.MathTools.sqr;

/**
 * Created by noxoomo on 01/06/15.
 */
public class StatTools {

  public static double variance(Vec x) {
    final double sum = VecTools.sum(x);
    final double sum2 = VecTools.sum2(x);
    final double weight = x.dim();
    return sum2 / weight - MathTools.sqr(sum / weight);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy