1package umontreal.ssj.mcqmctools.anova;
3import umontreal.ssj.stat.list.ListOfTallies;
4import umontreal.ssj.stat.Tally;
14 protected List<AnovaObserver> observers;
15 protected Tally meanCorrection;
16 protected Tally totalVar;
17 protected boolean sorted;
26 totalVar =
new Tally(
"Total variance");
27 meanCorrection =
new Tally(
"Correction to the mean");
32 observers =
new ArrayList<AnovaObserver>();
41 observers.add(observer);
51 meanCorrection.init();
62 public void add(
double[] vars) {
64 throw new IllegalStateException(
"AnovaVarianceCollector cannot collect data once sorted");
65 for (
int i = 0; i < size(); i++)
67 meanCorrection.add(vars[size()]);
68 totalVar.add(vars[size() + 1]);
72 obs.anovaUpdated(
this);
82 Collections.sort(
this, Collections.reverseOrder());
91 return meanCorrection;
168 String s =
"ANOVA Collector";
169 s += String.format(
" [maxOrder=%d]",
getMaxOrder());
184 report += String.format(
" ± %.2g", dvar);
187 report += umontreal.ssj.util.PrintfFormat.NEWLINE;
191 report += String.format(
" ± %.2g", dvar);
194 report += umontreal.ssj.util.PrintfFormat.NEWLINE;
196 report += umontreal.ssj.util.PrintfFormat.NEWLINE;
199 report += c + umontreal.ssj.util.PrintfFormat.NEWLINE;
202 report += umontreal.ssj.util.PrintfFormat.NEWLINE + String.format(
"%30s: %9.4g (%.4g %%)",
double average()
Returns the average value of the observations since the last initialization.
void average(double[] r)
Computes the average for each tally in this list, and stores the averages in the array r.
void variance(double[] v)
For each tally in this list, computes the sample variance, and stores the variances into the array v.
int numberObs()
Assuming that each tally in this list contains the same number of observations, returns the number of...
ListOfTallies()
Constructs a new empty list of tallies.