| EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012) |
|---|
| [all classes][de.uka.ipd.sdq.statistics.estimation] |
| name | class, % | method, % | block, % | line, % |
|---|---|---|---|---|
| SampleVarianceEstimator.java | 0% (0/1) | 0% (0/2) | 0% (0/43) | 0% (0/7) |
| name | class, % | method, % | block, % | line, % |
|---|---|---|---|---|
| class SampleVarianceEstimator | 0% (0/1) | 0% (0/2) | 0% (0/43) | 0% (0/7) |
| SampleVarianceEstimator (): void | 0% (0/1) | 0% (0/3) | 0% (0/1) | |
| estimatePoint (List): double | 0% (0/1) | 0% (0/40) | 0% (0/6) |
| 1 | package de.uka.ipd.sdq.statistics.estimation; |
| 2 | |
| 3 | import java.util.List; |
| 4 | |
| 5 | /** |
| 6 | * Estimator for the sample variance. |
| 7 | * |
| 8 | * @author Philipp Merkle |
| 9 | * |
| 10 | */ |
| 11 | public class SampleVarianceEstimator implements IPointEstimator { |
| 12 | |
| 13 | @Override |
| 14 | public double estimatePoint(List<Double> samples) { |
| 15 | double mean = new SampleMeanEstimator().estimatePoint(samples); |
| 16 | double sum = 0.0; |
| 17 | for (Double s : samples) { |
| 18 | sum += Math.pow(s - mean, 2.0); |
| 19 | } |
| 20 | double sampleVariance = 1.0 / (samples.size() - 1) * sum; |
| 21 | |
| 22 | return sampleVariance; |
| 23 | } |
| 24 | |
| 25 | } |
| [all classes][de.uka.ipd.sdq.statistics.estimation] |
| EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov |