1package umontreal.ssj.mcqmctools.anova;
3import umontreal.ssj.mcqmctools.MonteCarloModelDouble;
4import umontreal.ssj.stat.Tally;
5import umontreal.ssj.util.Chrono;
7public class MeanVarExperiment {
11 protected double cpuSeconds;
12 protected double average;
13 protected double variance;
14 protected int nObservations;
15 protected String statReport;
20 this.integrator = integrator;
24 this.nObservations = 0;
28 this(
null, model, integrator);
31 public String getName() {
35 public void setName(String name) {
52 this.integrator = integrator;
55 public double getCPUSeconds() {
59 public double getSecondsPerSimulation() {
63 public double getAverage() {
67 public double getVariance() {
77 return variance * integrator.getTotalSimulations() / nObservations;
80 public void simulate() {
81 simulate(
new Tally(model.getClass().getSimpleName()));
89 average =
stat.average();
90 variance =
stat.variance();
91 nObservations =
stat.numberObs();
92 stat.setConfidenceIntervalStudent();
93 statReport =
stat.report(0.95, 4);
96 public String report() {
97 return statReport + String.format(
"Variance: %9.4g\n", getVariance())
99 + String.format(
"CPU time: %9s\n", Chrono.format(cpuSeconds));
102 public String toString() {
103 return "MeanVarExperiment" + (name ==
null ?
"" :
" " + name) +
":\n" +
" Model: " + model +
"\n"
104 +
" Integrator: " + integrator;
double getSeconds()
Returns the CPU time in seconds used by the program since the last call to init for this AbstractChro...
The Chrono class extends the umontreal.ssj.util.AbstractChrono class and computes the CPU time for th...
Tools for Collecting Statistics and computing estimators and confidence intervals.