|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.ucla.stat.SOCR.core.SOCRValueSettable edu.ucla.stat.SOCR.core.Distribution
public abstract class Distribution
Distribution: An abstract implmentation of a real probability distribution. All distributions should subclass this class.
It require a no argument constructor, if it need a handler for client to select values, it should create some valueSetters by calling createsValueSetter() . It is better to invoke createsValueSetter() , in the method initialize() . If you invoke them at constructor, then its subclass will creates these valueSetters too. You also must override valueChanged() to do updates corrosponding any changes in valueSetters. It is an Observer of its value changed, and observable for its value changes
Field Summary | |
---|---|
protected javax.swing.JApplet |
applet
|
static int |
CONTINUOUS
|
static int |
DISCRETE
|
static double |
MAXMGFXVAL
|
static double |
MAXMGFYVAL
|
static double |
MINMGFXVAL
|
static int |
MIXED
|
protected java.lang.String |
name
|
Constructor Summary | |
---|---|
Distribution()
|
Method Summary | |
---|---|
void |
addObserver(java.util.Observer observer)
|
static double |
betaCDF(double x,
double a,
double b)
The method computes the beta CDF. |
static double |
comb(double n,
int k)
This method computes the number of combinations of k objects chosen from a population of n objects |
static double |
factorial(int k)
This method computes k!, the number of permutations of k objects. |
protected double |
findGFRoot(int genFun,
double prob,
double guess,
double xLo,
double xHi)
This method approximates the value of X for which P(x<X)=prob. |
protected double |
findRoot(double prob,
double guess,
double xLo,
double xHi)
This method approximates the value of X for which P(x<X)=prob. |
static double |
gamma(double x)
This method computes the gamma function. |
static double |
gammaCDF(double x,
double a)
This method computes the CDF of the gamma distribution with shape parameter a and scale parameter 1 |
double |
getCDF(double x)
This method returns a default approximate cumulative distribution function. |
abstract double |
getDensity(double x)
The getDensity method is abstract and must be overridden for any specific distribuiton |
java.awt.Container |
getDisplayPane()
|
Domain |
getDomain()
This method returns the domain of the distribution. |
double |
getFailureRate(double x)
This method computes the failure rate function |
protected double |
getGFDerivative(int genFun,
double x)
This method approximates a derivative for a Generating Function using Newton's Quotient. |
protected double |
getGFSecondDerivative(int genFun,
double x)
This method approximates the second derivative for a Generating Function using Newton's Quotient. |
static Distribution |
getInstance(java.lang.String classname)
|
java.lang.String |
getLocalHelp()
This method returns a general Distribution usage off-line help. |
double |
getMaxDensity()
This method returns the largest (finite) value of the getDensity function on the finite set of domain values. |
double |
getMean()
This method returns a default approximate mean, based on the finite set of domain values. |
double |
getMean(double[] distData)
This method returns the sample mean of a data series |
double |
getMedian()
This method computes a default approximate median. |
double |
getMGF(double t)
This method returns an approximate moment generating function. |
Domain |
getMgfDomain()
This method returns the domain of the mgf for that particular distribution. |
java.lang.String |
getName()
|
java.lang.String |
getOnlineDescription()
This method returns an online description of this distribution. |
double |
getPGF(double t)
This method should be overriden if the PGF is known in closed form |
Domain |
getPGFDomain()
This method returns the domain of the pgf for that particular distribution. |
double |
getQuantile(double p)
This method computes an approximate getQuantile function. |
double |
getSampleMoment(int _power,
double[] distData)
This method returns the n-th sample moment of a data series |
double |
getSD()
This method returns the standard deviation, as the square root of the variance |
SOCRDistributionFunctors |
getSOCRDistributionFunctors()
|
SOCRDistributions |
getSOCRDistributions()
|
int |
getType()
This method returns the type of the distribution (discrete or continuous) |
double |
getVariance()
This method returns a default approximate variance. |
double |
getVariance(double[] distData)
This method returns the sample variance of a data series |
void |
initialize()
used for some subclass to initialize before being used |
double |
inverseCDF(double probability)
Inverse of the cumulative distribution function (CDF) of the specified distribution. |
static double |
logGamma(double x)
This method computes the log of the gamma function. |
void |
paramEstimate(double[] distData)
|
static double |
perm(double n,
int k)
This method computes the number of permuatations of k objects chosen from a population of n objects. |
double |
sampleMean(double[] array)
|
double |
sampleVar(double[] array,
double mean)
|
void |
setApplet(javax.swing.JApplet applet)
|
protected void |
setDomain(Domain d)
This method sets the domain of the distribution for purposes of data collection and for default computations. |
protected void |
setDomain(double a,
double b,
double w,
int t)
This method sets the domain of the distribution for purposes of data collection and for default computations. |
protected void |
setMGFDomain(Domain d)
This method sets the moment generating function's domain of the distribution for purposes of data collection and for default computations. |
protected void |
setMGFDomain(double a,
double b,
double w)
This method sets the MGF domain of the distribution for purposes of data collection and for default computations. |
void |
setMGFParameters()
This method defines a partition of an interval that acts as a default domain for the moment generating function of the distribution, for purposes of data collection and for default computations. |
void |
setMGFParameters(double xlo,
double xhi)
|
void |
setMGFParameters(double xlo,
double xhi,
double max_slope)
|
void |
setMGFParameters(double xlo,
double xhi,
double max_slope,
double initial_guess)
|
void |
setParameters(double a,
double b,
double w,
int t)
This method defines a partition of an interval that acts as a default domain for the distribution, for purposes of data collection and for default computations. |
protected void |
setPGFDomain(Domain d)
This method sets the moment generating function's domain of the distribution for purposes of data collection and for default computations. |
protected void |
setPGFDomain(double a,
double b,
double w)
This method sets the PGF domain of the distribution for purposes of data collection and for default computations. |
void |
setPGFParameters()
This method defines a partition of an interval that acts as a default domain for the probability generating function of the distribution, for purposes of data collection and for default computations. |
void |
setPGFParameters(double xlo,
double xhi)
|
void |
setPGFParameters(double xlo,
double xhi,
double max_slope)
|
void |
setPGFParameters(double xlo,
double xhi,
double max_slope,
double initial_guess)
|
double |
simulate()
This method computes a default simulation of a value from the distribution, as a random getQuantile. |
void |
update(java.util.Observable o,
java.lang.Object arg)
|
void |
valueChanged()
|
void |
valueChanged(java.util.Observable o,
java.lang.Object arg)
|
Methods inherited from class edu.ucla.stat.SOCR.core.SOCRValueSettable |
---|
createComponentSetter, createValueSetter, createValueSetter, createValueSetter, createValueSetter, getComponentSetter, getComponentSetters, getValueSetter, getValueSetters |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DISCRETE
public static final int CONTINUOUS
public static final int MIXED
public static final double MAXMGFYVAL
public static final double MINMGFXVAL
public static final double MAXMGFXVAL
protected javax.swing.JApplet applet
protected java.lang.String name
Constructor Detail |
---|
public Distribution()
Method Detail |
---|
public static Distribution getInstance(java.lang.String classname) throws java.lang.Exception
java.lang.Exception
public void setApplet(javax.swing.JApplet applet)
setApplet
in interface Pluginable
public SOCRDistributions getSOCRDistributions()
public SOCRDistributionFunctors getSOCRDistributionFunctors()
public void addObserver(java.util.Observer observer)
public void initialize()
public void update(java.util.Observable o, java.lang.Object arg)
update
in interface java.util.Observer
public void valueChanged()
public void valueChanged(java.util.Observable o, java.lang.Object arg)
public java.lang.String getName()
getName
in interface Pluginable
public abstract double getDensity(double x)
public void setParameters(double a, double b, double w, int t)
public void setMGFParameters()
public void setMGFParameters(double xlo, double xhi)
public void setMGFParameters(double xlo, double xhi, double max_slope)
public void setMGFParameters(double xlo, double xhi, double max_slope, double initial_guess)
public void setPGFParameters()
public void setPGFParameters(double xlo, double xhi)
public void setPGFParameters(double xlo, double xhi, double max_slope)
public void setPGFParameters(double xlo, double xhi, double max_slope, double initial_guess)
protected void setDomain(Domain d)
d
- the domainprotected void setMGFDomain(Domain d)
d
- the domainprotected void setPGFDomain(Domain d)
d
- the domainprotected void setDomain(double a, double b, double w, int t)
a
- lower value or bound of the domainb
- the upper value or bound of the domainw
- the width (step size) of the domaint
- the type of domain (DISCRETE or CONTINUOUS)protected void setMGFDomain(double a, double b, double w)
a
- lower value or bound of the MGF domainb
- the upper value or bound of the MGF domainw
- the width (step size) of the MGF domaint
- the type of domain (DISCRETE or CONTINUOUS)protected void setPGFDomain(double a, double b, double w)
a
- lower value or bound of the MGF domainb
- the upper value or bound of the MGF domainw
- the width (step size) of the MGF domaint
- the type of domain (DISCRETE or CONTINUOUS)public Domain getDomain()
public Domain getMgfDomain()
public Domain getPGFDomain()
public final int getType()
public void paramEstimate(double[] distData)
public double getMaxDensity()
public double getMean()
public double getMean(double[] distData)
public double getVariance()
public double getVariance(double[] distData)
public double getSampleMoment(int _power, double[] distData)
public double getSD()
public double getMGF(double t) throws NoMGFException
NoMGFException
public double getPGF(double t)
public double getCDF(double x)
public double getQuantile(double p)
public double simulate()
public double sampleMean(double[] array)
public double sampleVar(double[] array, double mean)
public java.lang.String getOnlineDescription()
public java.lang.String getLocalHelp()
public double getMedian()
public double getFailureRate(double x)
public static double perm(double n, int k)
public static double factorial(int k)
public static double comb(double n, int k)
public static double logGamma(double x)
public static double gamma(double x)
public static double gammaCDF(double x, double a)
public static double betaCDF(double x, double a, double b)
public double inverseCDF(double probability)
probability
- - a probability value in [0, 1]
protected double findRoot(double prob, double guess, double xLo, double xHi)
protected double findGFRoot(int genFun, double prob, double guess, double xLo, double xHi)
protected double getGFDerivative(int genFun, double x)
protected double getGFSecondDerivative(int genFun, double x)
public java.awt.Container getDisplayPane()
getDisplayPane
in interface Pluginable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |