// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
//
// Contact: phylosoft @ gmail . com
-// WWW: www.phylosoft.org/forester
+// WWW: https://sites.google.com/site/cmzmasek/home/software/forester
package org.forester.util;
public double sampleVariance() {
validate();
if ( getN() < 2 ) {
- throw new ArithmeticException( "attempt to calculate sample variance for less then two values" );
+ return 0;
}
return ( sumDeviations() / ( getN() - 1 ) );
}
* Computes the sample standard unit (z-score). Used to compute 'value' in
* terms of standard units. Note that 'value', 'mean' and 'sd' must be all
* from the same sample data.
- *
+ *
* @param value
* a double in the sample for which
* @param mean