|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| NormalProbabilityComputer.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
package baseCode.math.distribution;
|
|
| 2 |
|
|
| 3 |
import cern.jet.stat.Probability;
|
|
| 4 |
|
|
| 5 |
/**
|
|
| 6 |
* <hr>
|
|
| 7 |
* <p>
|
|
| 8 |
* Copyright (c) 2004 Columbia University
|
|
| 9 |
*
|
|
| 10 |
* @author pavlidis
|
|
| 11 |
* @version $Id: NormalProbabilityComputer.java,v 1.1 2004/12/31 01:14:48 pavlidis Exp $
|
|
| 12 |
*/
|
|
| 13 |
public class NormalProbabilityComputer implements ProbabilityComputer { |
|
| 14 |
|
|
| 15 |
double variance;
|
|
| 16 |
double mean;
|
|
| 17 |
|
|
| 18 |
/**
|
|
| 19 |
* @param variance
|
|
| 20 |
* @param mean
|
|
| 21 |
*/
|
|
| 22 | 0 |
public NormalProbabilityComputer( double variance, double mean ) { |
| 23 | 0 |
super();
|
| 24 | 0 |
this.variance = variance;
|
| 25 |
|
|
| 26 | 0 |
if (variance < 0) {
|
| 27 | 0 |
throw new IllegalArgumentException("Variance must be non-negative"); |
| 28 |
} |
|
| 29 |
|
|
| 30 | 0 |
this.mean = mean;
|
| 31 |
} |
|
| 32 |
|
|
| 33 |
/*
|
|
| 34 |
* (non-Javadoc)
|
|
| 35 |
*
|
|
| 36 |
* @see baseCode.math.ProbabilityComputer#probability(double)
|
|
| 37 |
*/
|
|
| 38 | 0 |
public double probability( double value ) { |
| 39 | 0 |
return 1.0 - Probability.normal( mean, variance, value );
|
| 40 |
} |
|
| 41 |
|
|
| 42 | 0 |
public double probability( double value, boolean upperTail ) { |
| 43 | 0 |
if ( upperTail ) {
|
| 44 | 0 |
return probability( value );
|
| 45 |
} |
|
| 46 |
|
|
| 47 | 0 |
return Probability.normal( mean, variance, value );
|
| 48 |
|
|
| 49 |
} |
|
| 50 |
|
|
| 51 |
} |
|
||||||||||