/** * The within-bin kernel of the bin that x belongs to. * * @param x the value to locate within a bin * @return the within-bin kernel of the bin containing x */ private RealDistribution k(double x) { final int binIndex = findBin(x); return getKernel(binStats.get(binIndex)); }
/** * Mass of bin i under the within-bin kernel of the bin. * * @param i index of the bin * @return the difference in the within-bin kernel cdf between the * upper and lower endpoints of bin i */ @SuppressWarnings("deprecation") private double kB(int i) { final double[] binBounds = getUpperBounds(); final RealDistribution kernel = getKernel(binStats.get(i)); return i == 0 ? kernel.cumulativeProbability(min, binBounds[0]) : kernel.cumulativeProbability(binBounds[i - 1], binBounds[i]); }
/** * {@inheritDoc} * * <p>Returns the kernel density normalized so that its integral over each bin * equals the bin mass.</p> * * <p>Algorithm description: <ol> * <li>Find the bin B that x belongs to.</li> * <li>Compute K(B) = the mass of B with respect to the within-bin kernel (i.e., the * integral of the kernel density over B).</li> * <li>Return k(x) * P(B) / K(B), where k is the within-bin kernel density * and P(B) is the mass of B.</li></ol></p> * @since 3.1 */ public double density(double x) { if (x < min || x > max) { return 0d; } final int binIndex = findBin(x); final RealDistribution kernel = getKernel(binStats.get(binIndex)); return kernel.density(x) * pB(binIndex) / kB(binIndex); }
final RealDistribution kernel = getKernel(binStats.get(i)); final double kB = kB(i); final double[] binBounds = getUpperBounds();
/** * The within-bin kernel of the bin that x belongs to. * * @param x the value to locate within a bin * @return the within-bin kernel of the bin containing x */ private RealDistribution k(double x) { final int binIndex = findBin(x); return getKernel(binStats.get(binIndex)); }
/** * The within-bin kernel of the bin that x belongs to. * * @param x the value to locate within a bin * @return the within-bin kernel of the bin containing x */ private RealDistribution k(double x) { final int binIndex = findBin(x); return getKernel(binStats.get(binIndex)); }
/** * Mass of bin i under the within-bin kernel of the bin. * * @param i index of the bin * @return the difference in the within-bin kernel cdf between the * upper and lower endpoints of bin i */ @SuppressWarnings("deprecation") private double kB(int i) { final double[] binBounds = getUpperBounds(); final RealDistribution kernel = getKernel(binStats.get(i)); return i == 0 ? kernel.cumulativeProbability(min, binBounds[0]) : kernel.cumulativeProbability(binBounds[i - 1], binBounds[i]); }
/** * Mass of bin i under the within-bin kernel of the bin. * * @param i index of the bin * @return the difference in the within-bin kernel cdf between the * upper and lower endpoints of bin i */ @SuppressWarnings("deprecation") private double kB(int i) { final double[] binBounds = getUpperBounds(); final RealDistribution kernel = getKernel(binStats.get(i)); return i == 0 ? kernel.cumulativeProbability(min, binBounds[0]) : kernel.cumulativeProbability(binBounds[i - 1], binBounds[i]); }
/** * {@inheritDoc} * * <p>Returns the kernel density normalized so that its integral over each bin * equals the bin mass.</p> * * <p>Algorithm description: <ol> * <li>Find the bin B that x belongs to.</li> * <li>Compute K(B) = the mass of B with respect to the within-bin kernel (i.e., the * integral of the kernel density over B).</li> * <li>Return k(x) * P(B) / K(B), where k is the within-bin kernel density * and P(B) is the mass of B.</li></ol></p> * @since 3.1 */ public double density(double x) { if (x < min || x > max) { return 0d; } final int binIndex = findBin(x); final RealDistribution kernel = getKernel(binStats.get(binIndex)); return kernel.density(x) * pB(binIndex) / kB(binIndex); }
/** * {@inheritDoc} * * <p>Returns the kernel density normalized so that its integral over each bin * equals the bin mass.</p> * * <p>Algorithm description: <ol> * <li>Find the bin B that x belongs to.</li> * <li>Compute K(B) = the mass of B with respect to the within-bin kernel (i.e., the * integral of the kernel density over B).</li> * <li>Return k(x) * P(B) / K(B), where k is the within-bin kernel density * and P(B) is the mass of B.</li></ol></p> * @since 3.1 */ public double density(double x) { if (x < min || x > max) { return 0d; } final int binIndex = findBin(x); final RealDistribution kernel = getKernel(binStats.get(binIndex)); return kernel.density(x) * pB(binIndex) / kB(binIndex); }
final RealDistribution kernel = getKernel(binStats.get(i)); final double kB = kB(i); final double[] binBounds = getUpperBounds();
final RealDistribution kernel = getKernel(binStats.get(i)); final double kB = kB(i); final double[] binBounds = getUpperBounds();