|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.strbio.math.IVector
org.strbio.math.FBin
public class FBin
a class which does 1-D histogram-FBins. If you're sampling some (float) data and want stats like average, stdev on the ensemble, but don't want to bother keeping track of every point, this should be useful. If you do want to keep track of every point, try using a DVector or DMatrix, which have similar stats functions.
Version 1.2, 6/24/99 - added main() to sample from a file. Version 1.1, 9/29/98 - sample() is no longer final, and PrintfStream changed to Printf. Fixed average and stdev to return NaN when not enough samples. Sample() now returns an int, indicating the FBin it was put into. Version 1.0, 3/31/98 - original version.
Field Summary | |
---|---|
protected float |
FBinsize
|
protected float |
min_v
|
protected int |
nsamples
|
protected float |
sum_x
|
protected float |
sum_x2
|
Fields inherited from class org.strbio.math.IVector |
---|
data |
Constructor Summary | |
---|---|
FBin(int nFBins,
float minv,
float maxv)
to set up the histogram-FBin, you need to know the number of FBins you want, the minimum possible value, and the maximum possible value of the data. |
Method Summary | |
---|---|
float |
average()
Return the average of all values sampled. |
void |
print(Printf outfile)
print out FBins to an open Printf. |
void |
print(java.lang.String filename)
print out FBins to a new file. |
int |
sample(float r)
Sample a value. |
int |
samples()
how many values have I sampled? |
float |
stdev()
Return the standard deviation of all values sampled. |
Methods inherited from class org.strbio.math.IVector |
---|
add, add, cross, cross, dimension, dot, dot, eliminate, equals, length, load, load, max, min, multiply, multiply, multiply, reverse, reverse, save, save, setValue, setValueAt, sort, subtract, subtract, valueAt |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected float min_v
protected float FBinsize
protected float sum_x
protected float sum_x2
protected int nsamples
Constructor Detail |
---|
public FBin(int nFBins, float minv, float maxv)
nFBins
- the number of FBins to sort data into. You don't
need any FBins at all if you just want stats like average, stdev.minv
- the minimum data you might samplemaxv
- the maximum data you might sampleMethod Detail |
---|
public int sample(float r)
public final float average()
public final float stdev()
public final int samples()
public void print(Printf outfile) throws java.io.IOException
print
in class IVector
java.io.IOException
IVector.save(org.strbio.io.Printf)
public final void print(java.lang.String filename) throws java.io.IOException
filename
- the file name. Overwrites existing files.
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |