1 Commits

4 changed files with 5 additions and 5 deletions

View File

@@ -144,8 +144,7 @@ public class Plot {
var model = this.statList.getModel(); var model = this.statList.getModel();
var avg = summary.average; var avg = summary.average;
var err = summary.calcError(0.95) var err = summary.calcError(0.95);
.apply(val -> val / 2); // Done to get the error for the mean value
for (int i = 0; i < model.getSize(); i++) { for (int i = 0; i < model.getSize(); i++) {
var entry = model.getElementAt(i); var entry = model.getElementAt(i);

View File

@@ -201,7 +201,7 @@ public class SimulationBuilder {
if (indices == null) if (indices == null)
return this; return this;
for (var index : indices.split(",")) { for (var index : indices.split(";")) {
var parts = index.split("="); var parts = index.split("=");
if (parts.length != 2) if (parts.length != 2)
throw new IllegalArgumentException("Invalid confidence index: " + index); throw new IllegalArgumentException("Invalid confidence index: " + index);

View File

@@ -138,7 +138,7 @@ public class ConfidenceIndices {
for (var stat : statistics) { for (var stat : statistics) {
var err = error.of(stat); var err = error.of(stat);
if (!Double.isFinite(err)) if (!Double.isFinite(err) || err == 0.0d)
continue; continue;
retValues.add("%s:%s=%.3f".formatted(this.nodes[i], stat, err)); retValues.add("%s:%s=%.3f".formatted(this.nodes[i], stat, err));

View File

@@ -298,7 +298,8 @@ public class NodeStats implements Cloneable, Iterable<Double> {
public NodeStats calcError(NodeStats alpha) { public NodeStats calcError(NodeStats alpha) {
var n = this.stats.size(); var n = this.stats.size();
var distr = new TDistribution(null, n - 1); var distr = new TDistribution(null, n - 1);
var tValue = alpha.clone().apply(a -> distr.inverseCumulativeProbability(a)); var prob = alpha.clone().apply(a -> 1 - (1 - a) / 2.0d);
var tValue = prob.apply(p -> distr.inverseCumulativeProbability(p));
return this.stdDev().merge(tValue, (std, t) -> t * (std / Math.sqrt(n))); return this.stdDev().merge(tValue, (std, t) -> t * (std / Math.sqrt(n)));
} }