MCPcopy Create free account
hub / github.com/antlr/codebuff / variance

Method variance

src/org/antlr/codebuff/misc/BuffUtils.java:70–78  ·  view source on GitHub ↗
(List<Integer> data)

Source from the content-addressed store, hash-verified

68 }
69
70 public static double variance(List<Integer> data) {
71 int n = data.size();
72 double sum = 0;
73 double avg = sum(data)/((double) n);
74 for (int d : data) {
75 sum += (d-avg)*(d-avg);
76 }
77 return sum/n;
78 }
79
80 public static double varianceFloats(List<Float> data) {
81 int n = data.size();

Callers 1

getListStatsMethod · 0.95

Calls 2

sumMethod · 0.95
sizeMethod · 0.65

Tested by

no test coverage detected