public class Histogram extends Tally
Histogram
class is providing a statistic analysis about
values. An interval is divided into sections with an under-
and an overflow section. When a value is updated it will be decided to which
section it belongs to and the counter for that section will be updated. In
the end the report will show how many values belong to which section. UNDEFINED
Constructor and Description |
---|
Histogram(Model ownerModel,
java.lang.String name,
double[] range,
boolean showInReport,
boolean showInTrace)
Constructor for a Histogram object with user-defined interval cells that will NOT be connected to a
ValueSupplier . |
Histogram(Model ownerModel,
java.lang.String name,
double lowerEnd,
double upperEnd,
int cells,
boolean showInReport,
boolean showInTrace)
Constructor for a Histogram object with equidistant interval cells that will NOT be connected to a
ValueSupplier . |
Histogram(Model ownerModel,
java.lang.String name,
ValueSupplier valSup,
double[] range,
boolean showInReport,
boolean showInTrace)
Constructor for a Histogram object with user-defined interval cells that will be connected to a
ValueSupplier . |
Histogram(Model ownerModel,
java.lang.String name,
ValueSupplier valSup,
double lowerEnd,
double upperEnd,
int cells,
boolean showInReport,
boolean showInTrace)
Constructor for a Histogram object with equidistant interval cells that will be connected to a
ValueSupplier . |
Modifier and Type | Method and Description |
---|---|
void |
changeParameters(double[] range)
Changes the parameters of the interval and its number of segments.
|
void |
changeParameters(double low,
double up,
int cel)
Changes the parameters of the interval and its number of segments.
|
boolean |
chiSquareTest(long[] values,
double confidence)
Performs Pearson's Chi-square test on given frequencies, a fixed degree of freedom and desired probability.
|
boolean |
chiSquareTest(long[] values,
int degFreedom,
double confidence)
Performs Pearson's Chi-square test on given frequencies, degrees of freedom and desired probability.
|
Reporter |
createDefaultReporter()
Returns a Reporter to produce a report about this Histogram.
|
int |
getCells()
Returns the number of cells the interval is divided into.
|
double |
getCellWidth()
Deprecated.
The same functionality is given by getMeanWidth().
|
double |
getLowerLimit(int cell)
Returns the lower limit of the given cell.
|
double |
getMeanWidth()
Returns the mean width of all cells.
|
int |
getMostFrequentedCell()
Deprecated.
Gives the same result as the first entry of the returned array of getMostFrequentedCells().
|
int[] |
getMostFrequentedCells()
Returns the numbers of the most frequented cells, so far.
|
long |
getObservationsInCell(int cell)
Returns the observations made for the given cell, so far.
|
double |
getUpperLimit()
Returns the upper limit of the whole interval.
|
boolean |
isCondensed()
Returns whether output is condensed, i.e.\ empty cells on the right tail not shown.
|
void |
reset()
Resets this Histogram object by resetting the counters for each cell to
zero.
|
void |
setCondensed(boolean condensed)
Sets whether output should be condensed, i.e.\ empty cells on the right tail not shown.
|
void |
update()
Updates this
Histogram object by fetching the actual value
of the ValueSupplier and processing it. |
void |
update(double val)
Updates this
Histogram object with the double value given
as parameter. |
void |
update(java.util.Observable o,
java.lang.Object arg)
Implementation of the virtual
update(Observable, Object)
method of the Observer interface. |
getLastValue, getMaximum, getMinimum, update
getShowTimeSpansInReport, getUnit, setShowTimeSpansInReport
getUnitText, round, setUnit
getCorrespondingSchedulable, getDescription, getObservations, getReporter, incrementObservations, incrementObservations, reportIsOn, reportOff, reportOn, resetAt, setCorrespondingSchedulable, setDescription, setReporter
current, currentEntity, currentEntityAll, currentEvent, currentModel, currentSimProcess, debugIsOn, debugOff, debugOn, getModel, isExperimentCompatible, isModelCompatible, presentTime, sendDebugNote, sendMessage, sendTraceNote, sendWarning, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOn
getName, getQuotedName, toString
public Histogram(Model ownerModel, java.lang.String name, double lowerEnd, double upperEnd, int cells, boolean showInReport, boolean showInTrace)
ValueSupplier
.ownerModel
- Model : The model this Histogram is associated to.name
- java.lang.String : The name of this Histogram object.lowerEnd
- double : The lower end of the interval.upperEnd
- double : The upper end of the interval.cells
- int : The number of cells (sections) the given interval will
be divided into.showInReport
- boolean : Flag for showing the report about this Histogram.showInTrace
- boolean : Flag for showing the trace output of this Histogram.public Histogram(Model ownerModel, java.lang.String name, ValueSupplier valSup, double lowerEnd, double upperEnd, int cells, boolean showInReport, boolean showInTrace)
ValueSupplier
.ownerModel
- Model : The model this Histogram is associated to.name
- java.lang.String : The name of this Histogram object.valSup
- ValueSupplier : The ValueSupplier providing the value for this
Histogram. The given ValueSupplier will be observed by this
Histogram object.lowerEnd
- double : The lower end of the interval.upperEnd
- double : The upper end of the interval.cells
- int : The number of cells (sections) the given interval will
be divided into.showInReport
- boolean : Flag for showing the report about this Histogram.showInTrace
- boolean : Flag for showing the trace output of this Histogram.public Histogram(Model ownerModel, java.lang.String name, double[] range, boolean showInReport, boolean showInTrace)
ValueSupplier
.ownerModel
- Model : The model this Histogram is associated to.name
- java.lang.String : The name of this Histogram object.range
- double[] : The interval with the lower limit of each cell and the upper limit of the interval as the final value.showInReport
- boolean : Flag for showing the report about this Histogram.showInTrace
- boolean : Flag for showing the trace output of this Histogram.public Histogram(Model ownerModel, java.lang.String name, ValueSupplier valSup, double[] range, boolean showInReport, boolean showInTrace)
ValueSupplier
.ownerModel
- Model : The model this Histogram is associated to.name
- java.lang.String : The name of this Histogram object.valSup
- ValueSupplier : The ValueSupplier providing the value for this
Histogram. The given ValueSupplier will be observed by this
Histogram object.range
- double[] : The interval with the lower limit of each cell and the upper limit of the interval as the final value.showInReport
- boolean : Flag for showing the report about this Histogram.showInTrace
- boolean : Flag for showing the trace output of this Histogram.public boolean isCondensed()
true
) or
printing all cells (false
).public void setCondensed(boolean condensed)
condensed
- boolean: Not displaying unused cells in report view (true
) or
printing all cells (false
).public void changeParameters(double low, double up, int cel)
low
- double : The lower end of the interval.up
- double : The upper end of the interval.cel
- int : The number of cells (sections) the given interval will
be divided into.public void changeParameters(double[] range)
range
- double[] : The array holding the lower limits of the interval sections and the upper limit as the final value.public boolean chiSquareTest(long[] values, double confidence)
true
if the null hypothesis can not be rejected.values
- long[]: Array of assumed frequencies for each cell.confidence
- double: (1-alpha) probability level.true
if the the null hypothesis can not be rejected.
false
on error or if the null hypothesis has to be rejected.public boolean chiSquareTest(long[] values, int degFreedom, double confidence)
values
- long[]: Array of assumed frequencies for each cell.degFreedom
- int: Degrees of freedom of the test.confidence
- double: (1-alpha) probability level.true
if the the null hypothesis can not be rejected.
false
on error or if the null hypothesis has to be rejected.public Reporter createDefaultReporter()
createDefaultReporter
in class Tally
public int getCells()
@Deprecated public double getCellWidth()
public double getMeanWidth()
public double getLowerLimit(int cell)
UNDEFINED
(-1) will be returned.cell
- int : The cell for which we want to know its lower limit.
Should be zero or positive.@Deprecated public int getMostFrequentedCell()
public int[] getMostFrequentedCells()
public long getObservationsInCell(int cell)
cell
- int : The cell of which want to get the number of observations
made for.public double getUpperLimit()
public void reset()
changeParameters
method after the reset.public void update()
Histogram
object by fetching the actual value
of the ValueSupplier
and processing it. The
ValueSupplier
is passed in the constructor of this
Histogram
object. This update()
method
complies with the one described in DESMO, see [Page91].public void update(double val)
Histogram
object with the double value given
as parameter. In some cases it might be more convenient to pass the value
this Histogram
will be updated with directly within the
update(double val)
method instead of going via the
ValueSupplier
.public void update(java.util.Observable o, java.lang.Object arg)
update(Observable, Object)
method of the Observer
interface. This method will be
called automatically from an Observable
object within its
notifyObservers()
method. null
value) is passed as arg, the actual
value of the ValueSupplier will be fetched with the value()
method of the ValueSupplier. Otherwise it is expected that the actual
value is passed in the Object arg.update
in interface java.util.Observer
update
in class Tally
o
- java.util.Observable : The Observable calling this method
within its own notifyObservers()
method.arg
- Object : The Object with which this Tally
is
updated. Normally a double number which is added to the
statistics or null
.