

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object org.strbio.math.IVector org.strbio.math.Bin
public class Bin
a class which does 1D histogrambins. If you're sampling some (double) 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.3, 10/5/00  added stdevp, zScore Version 1.2, 6/24/99  added main() to sample from a file. Version 1.1, 9/29/98  made extendable by Bin2D; 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 bin it was put into. Version 1.0, 3/31/98  original version.
Bin2D
Field Summary  

protected double 
binsize

protected double 
min_v

protected long 
nsamples

protected double 
sum_x

protected double 
sum_x2

Fields inherited from class org.strbio.math.IVector 

data 
Constructor Summary  

Bin(int nbins,
double minv,
double maxv)
to set up the histogrambin, you need to know the number of bins you want, the minimum possible value, and the maximum possible value of the data. 
Method Summary  

double 
average()
Return the average of all values sampled. 
void 
print(Printf outfile)
print out bins to an open Printf. 
void 
print(java.lang.String filename)
print out bins to a new file. 
int 
sample(double r)
Sample a value. 
long 
samples()
how many values have I sampled? 
double 
stdev()
Return the standard deviation of all values sampled. 
double 
stdevp()
Returns the standard deviation of all values sampled. 
double 
zScore(double x)
Shows how many standard deviations a given double is below the average. 
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 double min_v
protected double binsize
protected double sum_x
protected double sum_x2
protected long nsamples
Constructor Detail 

public Bin(int nbins, double minv, double maxv)
nbins
 the number of bins to sort data into. You don't
need any bins 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(double r)
public final double average()
public final double stdev()
public final double stdevp()
public final double zScore(double x)
public final long 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 