congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
SecondMoment
Code IndexAdd Tabnine to your IDE (free)

How to use
SecondMoment
in
org.apache.commons.math.stat.descriptive.moment

Best Java code snippets using org.apache.commons.math.stat.descriptive.moment.SecondMoment (Showing top 20 results out of 315)

origin: org.apache.commons/commons-math

/**
 * Constructs a Variance with default (true) <code>isBiasCorrected</code>
 * property.
 */
public Variance() {
  moment = new SecondMoment();
}
origin: org.apache.commons/commons-math

/**
 * {@inheritDoc}
 */
@Override
public void clear() {
  if (incMoment) {
    moment.clear();
  }
}
origin: org.apache.commons/commons-math

/**
 * {@inheritDoc}
 */
public long getN() {
  return moment.getN();
}
origin: org.apache.commons/commons-math

/**
 * {@inheritDoc}
 */
@Override
public SecondMoment copy() {
  SecondMoment result = new SecondMoment();
  copy(this, result);
  return result;
}
origin: org.apache.commons/commons-math

/**
 * <p>Returns the sum of squared deviations of Y from its mean.</p>
 *
 * <p>If the model has no intercept term, <code>0</code> is used for the
 * mean of Y - i.e., what is returned is the sum of the squared Y values.</p>
 *
 * <p>The value returned by this method is the SSTO value used in
 * the {@link #calculateRSquared() R-squared} computation.</p>
 *
 * @return SSTO - the total sum of squares
 * @see #isNoIntercept()
 * @since 2.2
 */
public double calculateTotalSumOfSquares() {
  if (isNoIntercept()) {
    return StatUtils.sumSq(Y.getData());
  } else {
    return new SecondMoment().evaluate(Y.getData());
  }
}
origin: org.apache.commons/commons-math

/**
 * {@inheritDoc}
 */
@Override
public void increment(final double d) {
  if (n < 1) {
    m3 = m2 = m1 = 0.0;
  }
  double prevM2 = m2;
  super.increment(d);
  nDevSq = nDev * nDev;
  double n0 = n;
  m3 = m3 - 3.0 * nDev * prevM2 + (n0 - 1) * (n0 - 2) * nDevSq * dev;
}
origin: org.apache.commons/math

/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source Variance to copy
 * @param dest Variance to copy to
 * @throws NullPointerException if either source or dest is null
 */
public static void copy(Variance source, Variance dest) {
  dest.moment = source.moment.copy();
  dest.isBiasCorrected = source.isBiasCorrected;
  dest.incMoment = source.incMoment;
}
origin: org.apache.commons/math

/**
 * Returns a statistic related to the Second Central Moment.  Specifically,
 * what is returned is the sum of squared deviations from the sample mean
 * among the values that have been added.
 * <p>
 * Returns <code>Double.NaN</code> if no data values have been added and
 * returns <code>0</code> if there is just one value in the data set.</p>
 * <p>
 * @return second central moment statistic
 * @since 2.0
 */
public double getSecondMoment() {
  return secondMoment.getResult();
}
origin: datacleaner/DataCleaner

  geometricMean = descriptiveStats.getGeometricMean();
  sumOfSquares = descriptiveStats.getSumsq();
  secondMoment = new SecondMoment().evaluate(descriptiveStats.getValues());
} else {
  final SummaryStatistics summaryStats = (SummaryStatistics) s;
origin: org.apache.commons/math

/**
 * {@inheritDoc}
 */
@Override
public SecondMoment copy() {
  SecondMoment result = new SecondMoment();
  copy(this, result);
  return result;
}
origin: org.apache.commons/commons-math

/**
 * {@inheritDoc}
 * <p>If all values are available, it is more accurate to use
 * {@link #evaluate(double[])} rather than adding values one at a time
 * using this method and then executing {@link #getResult}, since
 * <code>evaluate</code> leverages the fact that is has the full
 * list of values together to execute a two-pass algorithm.
 * See {@link Variance}.</p>
 */
@Override
public void increment(final double d) {
  if (incMoment) {
    moment.increment(d);
  }
}
origin: org.apache.commons/commons-math

/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source ThirdMoment to copy
 * @param dest ThirdMoment to copy to
 * @throws NullPointerException if either source or dest is null
 */
public static void copy(ThirdMoment source, ThirdMoment dest) {
  SecondMoment.copy(source, dest);
  dest.m3 = source.m3;
  dest.nDevSq = source.nDevSq;
}
origin: org.apache.commons/commons-math

/**
 * Returns a statistic related to the Second Central Moment.  Specifically,
 * what is returned is the sum of squared deviations from the sample mean
 * among the values that have been added.
 * <p>
 * Returns <code>Double.NaN</code> if no data values have been added and
 * returns <code>0</code> if there is just one value in the data set.</p>
 * <p>
 * @return second central moment statistic
 * @since 2.0
 */
public double getSecondMoment() {
  return secondMoment.getResult();
}
origin: org.eobjects.analyzerbeans/AnalyzerBeans-basic-analyzers

  geometricMean = descriptiveStats.getGeometricMean();
  sumOfSquares = descriptiveStats.getSumsq();
  secondMoment = new SecondMoment().evaluate(descriptiveStats.getValues());
} else {
  final SummaryStatistics summaryStats = (SummaryStatistics) s;
origin: commons-math/commons-math

/**
 * Constructs a Variance with default (true) <code>isBiasCorrected</code>
 * property.
 */
public Variance() {
  moment = new SecondMoment();
}
origin: org.apache.commons/commons-math

/**
 * {@inheritDoc}
 */
@Override
public void clear() {
  super.clear();
  m3 = Double.NaN;
  nDevSq = Double.NaN;
}
origin: commons-math/commons-math

/**
 * @see org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic#increment(double)
 */
public void increment(final double d) {
  if (n < 1) {
    m3 = m2 = m1 = 0.0;
  }  
    double prevM2 = m2;
  super.increment(d);
  nDevSq = nDev * nDev;
  double n0 = (double) n;
  m3 = m3 - 3.0 * nDev * prevM2 + (n0 - 1) * (n0 - 2) * nDevSq * dev;
}
origin: commons-math/commons-math

/**
 * @see org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic#getN()
 */
public long getN() {
  return moment.getN();
}

origin: org.apache.commons/math

/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source ThirdMoment to copy
 * @param dest ThirdMoment to copy to
 * @throws NullPointerException if either source or dest is null
 */
public static void copy(ThirdMoment source, ThirdMoment dest) {
  SecondMoment.copy(source, dest);
  dest.m3 = source.m3;
  dest.nDevSq = source.nDevSq;
}
origin: org.apache.commons/commons-math

/**
 * Constructs a Variance with the specified <code>isBiasCorrected</code>
 * property
 *
 * @param isBiasCorrected  setting for bias correction - true means
 * bias will be corrected and is equivalent to using the argumentless
 * constructor
 */
public Variance(boolean isBiasCorrected) {
  moment = new SecondMoment();
  this.isBiasCorrected = isBiasCorrected;
}
org.apache.commons.math.stat.descriptive.momentSecondMoment

Javadoc

Computes a statistic related to the Second Central Moment. Specifically, what is computed is the sum of squared deviations from the sample mean.

The following recursive updating formula is used:

Let

  • dev = (current obs - previous mean)
  • n = number of observations (including current obs)
Then

new value = old value + dev^2 * (n -1) / n.

Returns Double.NaN if no data values have been added and returns 0 if there is just one value in the data set.

Note that this implementation is not synchronized. If multiple threads access an instance of this class concurrently, and at least one of the threads invokes the increment() or clear() method, it must be synchronized externally.

Most used methods

  • <init>
    Copy constructor, creates a new SecondMoment identical to the original
  • clear
  • evaluate
  • getN
  • increment
  • copy
    Copies source to dest.Neither source nor dest can be null.
  • getResult

Popular in Java

  • Finding current android device location
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • startActivity (Activity)
  • scheduleAtFixedRate (Timer)
  • Permission (java.security)
    Legacy security code; do not use.
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Join (org.hibernate.mapping)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now