Class pmr.stat.Univariate
All Packages Class Hierarchy This Package Previous Next Index
Class pmr.stat.Univariate
java.lang.Object
|
+----pmr.stat.Stat
|
+----pmr.stat.DrawableStat
|
+----pmr.stat.Univariate
- public class Univariate
- extends DrawableStat
Univariate - Univariate class
Univariate statistics on a 1-dimensional array. Most of the usual stuff
can be found in the member functions. the drawing routines (e.g. for
Histogram) are not yet developed. (Note, if you want to display a RealArray
as a graph, use Bivariate.)
Default has zero elements and default values of RealRange, etc; Some routines
producing Gaussian variates are better done using Java
For zero or one elements, some routines throw ArrayTooSmallException
- Author:
- (C) P. Murray-Rust, 1996
-
CUMULATIVE
-
-
GRAPH
-
-
HISTOGRAM
- display switches
-
LOG
-
-
ORIGINAL
-
-
ZSCORE
-
-
Univariate()
- default Univariate has zero elements and default components
-
Univariate(RealArray)
- create from RealArray BY VALUE
-
addElement(double)
-
-
debug()
-
-
display()
- Kicks off a ScrollableTopLevel which contains the object.
-
display(Graphics)
- used by the ScrollableTopLevel to paint the object, or can be used to
draw the object to somewhere else.
-
display(Graphics, Component)
- this may encapsulate the above routine, as we often need the component, e.g.
-
elementAt(int)
-
-
getGaussianVariate()
- a random Gaussian variate normalised to mean = 0.0, sdev = 1.0
-
getGaussianVariate(double, double)
- a random Gaussian variate from distribution with given mean and sdev
-
getMean()
-
-
getMedian()
-
-
getRandom(double, double)
- random variate in range low-high
-
getRange()
-
-
getRealArray()
- get the original data as RealArray
-
getStandardDeviation()
-
-
getTitle()
-
-
getTransformedArray(String)
- get transformed data; unknown type returns null.
-
getVariance()
-
-
main(String[])
-
-
process()
- the calculation routine;
-
setVariateType(String)
- create transformation of values (e.g.
-
size()
-
-
toString()
-
HISTOGRAM
public final static int HISTOGRAM
- display switches
GRAPH
public final static int GRAPH
ORIGINAL
public final static String ORIGINAL
LOG
public final static String LOG
CUMULATIVE
public final static String CUMULATIVE
ZSCORE
public final static String ZSCORE
Univariate
public Univariate()
- default Univariate has zero elements and default components
Univariate
public Univariate(RealArray f)
- create from RealArray BY VALUE
process
public void process() throws ArrayTooSmallException
- the calculation routine;
- Throws: ArrayTooSmallException
- several routines require a minimum number of points
- Overrides:
- process in class Stat
getTitle
public String getTitle()
- Overrides:
- getTitle in class Stat
addElement
public void addElement(double x)
size
public int size()
elementAt
public double elementAt(int i)
getMean
public double getMean() throws ArrayTooSmallException
- Throws: ArrayTooSmallException
- no data points
getVariance
public double getVariance() throws ArrayTooSmallException
- Throws: ArrayTooSmallException
- less than 2 data points
getStandardDeviation
public double getStandardDeviation() throws ArrayTooSmallException
- Throws: ArrayTooSmallException
- less than 2 data points
getRange
public RealRange getRange() throws ArrayTooSmallException
- Throws: ArrayTooSmallException
- less than 2 data points
getMedian
public double getMedian() throws ArrayTooSmallException
- Throws: ArrayTooSmallException
- less than 2 data points
getRealArray
public RealArray getRealArray() throws ArrayTooSmallException
- get the original data as RealArray
- Throws: ArrayTooSmallException
- shouldn't happen, but might with less than 2 data points
getTransformedArray
public RealArray getTransformedArray(String key) throws ArrayTooSmallException
- get transformed data; unknown type returns null. Keys are:
- "ORIGINAL": return original data
- "LOG": takes logarithms. If you have negative or zero data it will crash
- "CUMULATIVE": gets the cumulative sum.
- "ZSCORE": normalises to zero mean, unit variance
- Throws: ArrayTooSmallException
- shouldn't happen, but might with less than 2 data points
getRandom
public static double getRandom(double low,
double high)
- random variate in range low-high
getGaussianVariate
public static double getGaussianVariate()
- a random Gaussian variate normalised to mean = 0.0, sdev = 1.0
getGaussianVariate
public static double getGaussianVariate(double mean,
double stdev)
- a random Gaussian variate from distribution with given mean and sdev
toString
public String toString()
- Overrides:
- toString in class Object
setVariateType
public void setVariateType(String key) throws ArrayTooSmallException
- create transformation of values (e.g. log, cumulative)
- Throws: ArrayTooSmallException
- several routines require a minimum number of points
display
public void display()
- Kicks off a ScrollableTopLevel which contains the object.
- Overrides:
- display in class DrawableStat
display
public void display(Graphics g)
- used by the ScrollableTopLevel to paint the object, or can be used to
draw the object to somewhere else.
- Overrides:
- display in class DrawableStat
display
public void display(Graphics g,
Component comp)
- this may encapsulate the above routine, as we often need the component, e.g.
- Overrides:
- display in class DrawableStat
debug
public void debug()
- Overrides:
- debug in class DrawableStat
main
public static void main(String args[])
All Packages Class Hierarchy This Package Previous Next Index