1package umontreal.ssj.mcqmctools.anova;
3import umontreal.ssj.rng.RandomStream;
5import umontreal.ssj.mcqmctools.*;
28 protected double approxMean;
31 protected List<CoordinateSet> coordSets;
36 protected double[] vars;
38 public PartialVarianceEstimator() {
40 this.coordSets =
null;
64 this.approxMean = approxMean;
80 this.coordSets = coordSets;
85 public double getApproximateMean() {
100 if (vars ==
null || vars.length != coordSets.size() + 2)
101 vars =
new double[coordSets.size() + 2];
104 throw new IllegalArgumentException(
"model has not been initialized");
106 if (coordSets ==
null)
107 throw new IllegalArgumentException(
"the coordinate sets have not been initialized");
109 int nSets = coordSets.size();
111 if (vars.length < nSets + 2)
112 throw new IllegalArgumentException(
113 "vars[] must contain one more element than the" +
" number of coordinate sets");
117 s.setCoordinates(allCoordinates);
120 double valAll = model.getPerformance() - approxMean;
122 s.setCoordinates(noCoordinate);
125 double valNone = model.getPerformance() - approxMean;
128 vars[nSets] = valAll;
131 vars[nSets + 1] = valAll * valAll;
133 for (
int j = 0; j < nSets; j++) {
138 s.setCoordinates(coordSets.get(j));
141 double valPartial = model.getPerformance() - approxMean;
143 vars[j] = valAll * (valPartial - valNone);
156 return (model ==
null) ? 0 : 2 * model.getDimension();
165 String s = String.format(
"Partial Variance Estimator" +
" [model=%s]", model.toString());
173 return getModel().getTag();
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...