1package umontreal.ssj.stat.density;
3import umontreal.ssj.stat.ScaledHistogram;
4import umontreal.ssj.stat.TallyHistogram;
116 histDensity = scaledHist;
148 return histDensity.getNumBins();
166 return histDensity.getA();
175 return histDensity.getB();
183 return "Histogram estimator with " +
getNumBins() +
" bins.";
191 return histDensity.getHeights()[(int) ((x -
getA()) /
getH())];
203 int k = evalPoints.length;
204 double[]
density =
new double[k];
206 for (
int j = 0; j < k; j++)
207 density[j] = histDensity.getHeights()[(int) ((evalPoints[j] -
getA()) /
getH())];
222 return histDensity.getHeights();
233 int numBins = (int) ((
getB() -
getA()) / h);
253 public static double evalDensity(
double x,
double[]
data,
double a,
double b,
int numBins) {
272 public static double[]
evalDensity(
double[] evalPoints,
double[]
data,
double a,
double b,
int numBins) {
310 public static double[][]
evalDensity(
double[][]
data,
double a,
double b,
int numBins) {
312 double[][] dens =
new double[m][numBins];
314 for (
int r = 0; r < m; r++) {
344 public static double[][]
evalDensity(
double evalPoints[],
double[][]
data,
double a,
double b,
int numBins) {
346 double[][] dens =
new double[m][numBins];
348 for (
int r = 0; r < m; r++) {
382 int k = evalPoints.length;
383 double[]
density =
new double[k];
385 for (
int j = 0; j < k; j++) {
417 int m = tallyHistArray.length;
418 int k = evalPoints.length;
419 double[][]
density =
new double[m][k];
420 for (
int r = 0; r < m; r++)
436 int m = tallyHistArray.length;
437 double[][] dens =
new double[m][];
438 for (
int r = 0; r < m; r++)
454 double h = (scaledHist.
getB() - scaledHist.
getA()) / (double) scaledHist.
getNumBins();
455 return scaledHist.
getHeights()[(int) ((x - scaledHist.
getA()) / h)];
469 int k = evalPoints.length;
470 double[]
density =
new double[k];
471 double h = (scaledHist.
getB() - scaledHist.
getA()) / (double) scaledHist.
getNumBins();
472 for (
int j = 0; j < k; j++)
504 int m = scaledHistArray.length;
505 double[][]
density =
new double[m][];
507 for (
int r = 0; r < m; r++)
524 int m = scaledHistArray.length;
525 double[][]
density =
new double[m][];
526 for (
int r = 0; r < m; r++)
This class provides histograms for which the bin counts (heights of rectangles) are replaced by real-...
double[] getHeights()
return the array counts of the histogram.
double getB()
Returns the right boundary of interval .
int getNumBins()
Returns the number of bins dividing the interval.
double getA()
Returns the left boundary of interval .
This class extends Tally.
double getProportionInBoundaries()
Returns the proportion of the collected observations that lie within the boundaries.
void fillFromArray(double[] obs, int numObs)
Fills this object from the first numObs observations in array obs.
static double[] evalDensity(TallyHistogram tallyHist)
Evaluates a histogram estimator defined by tallyHist once in each bin.
static double[][] evalDensity(TallyHistogram[] tallyHistArray)
Same as evalDensity(double[], TallyHistogram[]) but this method evaluates each histogram only once in...
DEHistogram(double a, double b, int numBins)
Constructs a histogram estimator over the interval with numBins number of bins.
double getH()
Gives the bin width .
static double[] evalDensity(double[] evalPoints, TallyHistogram tallyHist)
Evaluates a histogram estimator defined by tallyHist at the evaluation points evalPoints.
void setData(double[] data)
Takes the observations in data and constructs and redefines the histogram with these observations.
DEHistogram(double[] data, double a, double b, int numBins)
Constructs a histogram over the interval with numBins number of bins from the observations passed in...
static double[][] evalDensity(ScaledHistogram[] scaledHistArray)
Same as evalDensity(double[], ScaledHistogram[]) but the histograms are evaluated once in each bin.
static double evalDensity(double x, TallyHistogram tallyHist)
Evaluates a histogram estimator defined by tallylist at x.
double evalDensity(double x)
Evaluates the density estimator at x.the density estimator evaluated at .
int getNumBins()
Gives the number of bins .
static double[] evalDensity(double[] evalPoints, double[] data, double a, double b, int numBins)
Evaluates the histogram with numBins bins over which is defined by the observations data at each of ...
void setH(double h)
Sets the number of bins according to the provided binwidth via .
DEHistogram(TallyHistogram tallyHist)
Constructs a histogram from a umontreal.ssj.stat.TallyHistogram tallyHist.
double getB()
Gives the right boundary of the histogram.
static double[] evalDensity(double[] evalPoints, ScaledHistogram scaledHist)
Evaluates the histogram defined by the umontreal.ssj.stat.ScaledHistogram at each evaluation point in...
static double[][] evalDensity(double[] evalPoints, ScaledHistogram[] scaledHistArray)
This method considers a histogram for each of the umontreal.ssj.stat.ScaledHistogram from scaledHist...
static double evalDensity(double x, ScaledHistogram scaledHist)
Evaluates the histogram defined by the umontreal.ssj.stat.ScaledHistogram at x.
static double[] evalDensity(double[] data, double a, double b, int numBins)
Evaluates the histogram with numBins bins over which is defined by the observations data once in eac...
static double evalDensity(double x, double[] data, double a, double b, int numBins)
Evaluates the histogram with numBins bins over which is defined by the observations data at the eval...
ScaledHistogram getScaledHistogram()
Returns the underlying ScaledHistogram.
double[] evalDensity()
Evaluates the histogram density estimator at one point in each bin.
static double[][] evalDensity(double[] evalPoints, TallyHistogram[] tallyHistArray)
This method considers a histogram for each of the umontreal.ssj.stat.TallyHistogram from tallyHistAr...
DEHistogram(ScaledHistogram scaledHist)
Constructs a histogram from a umontreal.ssj.stat.ScaledHistogram scaledHist.
static double[][] evalDensity(double evalPoints[], double[][] data, double a, double b, int numBins)
Assume that we have independent realizations of the underlying model.
double getA()
Gives the left boundary of the histogram.
static double[] evalDensity(ScaledHistogram scaledHist)
Same as evalDensity(double[], ScaledHistogram) but evaluation is done once in each bin.
double[] evalDensity(double[] evalPoints)
Evaluates the histogram estimator at the points in evalPoints.
String toString()
Gives a short description of the estimator.a short description.
static double[][] evalDensity(double[][] data, double a, double b, int numBins)
Same as evalDensity(double[], double[][], double, double, int) but here, the density is evaluated onc...
This abstract class represents a univariate density estimator (DE).
double[] data
The data associated with this DensityEstimator object, if any.
Tools for univariate density estimation.