Package xal.tools.statistics
Class RunningWeightedStatistics
java.lang.Object
xal.tools.statistics.UnivariateStatistics
xal.tools.statistics.RunningWeightedStatistics
Calculate running statistics using weighted averaging
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intpopulation beyond which we should use the asymptotic weightprotected final doubleweight for new samplesFields inherited from class xal.tools.statistics.UnivariateStatistics
mean, meanSquare, population -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSample(double value) Add a new sample measurement.voidclear()Clear the samplesprotected final doubleGet the current weight.protected final doublegetWeight(double population) Get the weight to apply to the next new sample given the specified population.doubleGet the variance of the mean from the actual value assuming the supporting data is a random subset of all the data.doubleGet the variance of the mean from the actual value.Methods inherited from class xal.tools.statistics.UnivariateStatistics
mean, meanSquare, population, sampleStandardDeviation, sampleStandardDeviationOfMean, sampleVariance, standardDeviation, standardDeviationOfMean, variance
-
Field Details
-
asymptoticWeight
protected final double asymptoticWeightweight for new samples -
asymptoticPopulation
protected final int asymptoticPopulationpopulation beyond which we should use the asymptotic weight
-
-
Constructor Details
-
RunningWeightedStatistics
public RunningWeightedStatistics(double weight) Constructor- Parameters:
weight- asymptotic weight to apply to new samples in large populations
-
-
Method Details
-
clear
public void clear()Clear the samples -
getWeight
protected final double getWeight()Get the current weight.- Returns:
- the current weight
-
getWeight
protected final double getWeight(double population) Get the weight to apply to the next new sample given the specified population. When we first start adding samples, we must trust the newest samples most and gradually shift trust to the older samples. Ultimately we will trust new samples at least at the asymptotic weight. -
addSample
public void addSample(double value) Add a new sample measurement.- Parameters:
value- The new sample measurement
-
varianceOfMean
public double varianceOfMean()Get the variance of the mean from the actual value.- Overrides:
varianceOfMeanin classUnivariateStatistics- Returns:
- the variance of the mean from the actual value
-
sampleVarianceOfMean
public double sampleVarianceOfMean()Get the variance of the mean from the actual value assuming the supporting data is a random subset of all the data.- Overrides:
sampleVarianceOfMeanin classUnivariateStatistics- Returns:
- the sample variance of the mean
-