/** * Return true if a value can be considered for mixture estimatino separately from the data * indexed between i0 and i1 * * @param data the data supposedly generated from the mixture * @param i0 the index of the first element in the group * @param i1 the index of the last element in the group * @param x the value * @return true if the value can be considered */ public boolean separable(DoubleVector data, int i0, int i1, double x) { double p = 0; for (int i = i0; i <= i1; i++) { p += Maths.pnorm(-Math.abs(x - data.get(i))); } if (p < separatingThreshold) return true; else return false; }
/** * Contructs the probability matrix for mixture estimation, given a set of support points and a * set of intervals. * * @param s the set of support points * @param intervals the intervals * @return the probability matrix */ public PaceMatrix probabilityMatrix(DoubleVector s, PaceMatrix intervals) { int ns = s.size(); int nr = intervals.getRowDimension(); PaceMatrix p = new PaceMatrix(nr, ns); for (int i = 0; i < nr; i++) { for (int j = 0; j < ns; j++) { p.set( i, j, Maths.pnorm(intervals.get(i, 1), s.get(j), 1) - Maths.pnorm(intervals.get(i, 0), s.get(j), 1)); } } return p; }