Package org.djutils.stats.summarizers
Class WeightedTally
- java.lang.Object
-
- org.djutils.stats.summarizers.WeightedTally
-
- All Implemented Interfaces:
Serializable
,BasicTallyInterface
,WeightedTallyInterface
public class WeightedTally extends Object implements WeightedTallyInterface
The WeightedTally class defines a statistical tally. A WeightedTally is a time-weighted tally. The WeightedTally used to extend the Tally, but because the calculation method and method signatures are different, the WeightedTally has been made self-contained.Copyright (c) 2002-2021 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://simulation.tudelft.nl/dsol/3.0/license.html.
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description WeightedTally(String description)
Construct a new WeightedTally with a description.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getDescription()
returns the description of this tally.double
getMax()
Returns the max.double
getMin()
Returns the min.long
getN()
Returns the number of observations.double
getWeightedPopulationStDev()
Retrieve the current weighted standard deviation of the observations.double
getWeightedPopulationVariance()
Retrieve the current weighted variance of the observations.double
getWeightedSampleMean()
Retrieve the current weighted sample mean of all observations since the initialization.double
getWeightedSampleStDev()
Retrieve the current weighted sample standard deviation of the observations.double
getWeightedSampleVariance()
Retrieve the current weighted sample variance of the observations.double
getWeightedSum()
Retrieve the current weighted sum of the values of the observations.double
ingest(double weight, double value)
Process one observed weighted value.void
initialize()
initializes the Tally.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.djutils.stats.summarizers.WeightedTallyInterface
getWeightedPopulationMean
-
-
-
-
Field Detail
-
semaphore
protected Object semaphore
The synchronization lock.
-
-
Constructor Detail
-
WeightedTally
public WeightedTally(String description)
Construct a new WeightedTally with a description.- Parameters:
description
- String; the description of this WeightedTally
-
-
Method Detail
-
getDescription
public final String getDescription()
returns the description of this tally.- Specified by:
getDescription
in interfaceBasicTallyInterface
- Returns:
- Sting description
-
getMax
public final double getMax()
Returns the max.- Specified by:
getMax
in interfaceBasicTallyInterface
- Returns:
- double
-
getMin
public final double getMin()
Returns the min.- Specified by:
getMin
in interfaceBasicTallyInterface
- Returns:
- double
-
getN
public final long getN()
Returns the number of observations.- Specified by:
getN
in interfaceBasicTallyInterface
- Returns:
- long n
-
getWeightedSampleMean
public final double getWeightedSampleMean()
Retrieve the current weighted sample mean of all observations since the initialization.- Specified by:
getWeightedSampleMean
in interfaceWeightedTallyInterface
- Returns:
- double; the current weighted sample mean
-
getWeightedSampleStDev
public final double getWeightedSampleStDev()
Retrieve the current weighted sample standard deviation of the observations.- Specified by:
getWeightedSampleStDev
in interfaceWeightedTallyInterface
- Returns:
- double; the current weighted sample standard deviation
-
getWeightedPopulationStDev
public final double getWeightedPopulationStDev()
Retrieve the current weighted standard deviation of the observations.- Specified by:
getWeightedPopulationStDev
in interfaceWeightedTallyInterface
- Returns:
- double; the current weighted standard deviation
-
getWeightedSampleVariance
public final double getWeightedSampleVariance()
Retrieve the current weighted sample variance of the observations.- Specified by:
getWeightedSampleVariance
in interfaceWeightedTallyInterface
- Returns:
- double; the current weighted sample variance of the observations
-
getWeightedPopulationVariance
public final double getWeightedPopulationVariance()
Retrieve the current weighted variance of the observations.- Specified by:
getWeightedPopulationVariance
in interfaceWeightedTallyInterface
- Returns:
- double; the current weighted variance of the observations
-
getWeightedSum
public final double getWeightedSum()
Retrieve the current weighted sum of the values of the observations.- Specified by:
getWeightedSum
in interfaceWeightedTallyInterface
- Returns:
- double; the current weighted sum of the values of the observations
-
initialize
public void initialize()
initializes the Tally. This methods sets the max, min, n, sum and variance values to their initial values.- Specified by:
initialize
in interfaceBasicTallyInterface
-
ingest
public double ingest(double weight, double value)
Process one observed weighted value.- Parameters:
weight
- double; the weight of the value to processvalue
- double; the value to process- Returns:
- double; the value
-
-