public class WalkPositionDistribution extends Distribution implements java.io.Serializable
CONTINUOUS, DISCRETE, MIXED
Constructor and Description |
---|
WalkPositionDistribution()
This default constructor creates a new WalkPositionDistribution with time
parameter 10 and probability p = 0.5.
|
WalkPositionDistribution(int n,
double p)
This general constructor creates a new distribution with specified time and
probability parameters.
|
Modifier and Type | Method and Description |
---|---|
double |
getDensity(double x)
This method computes the density function.
|
double |
getMaxDensity()
This method returns the maximum value of the density function.
|
double |
getMean()
This method computes the mean.
|
double |
getProbability()
This method returns the probability parameter.
|
double |
getSteps()
This method returns the number of steps in the random walk.
|
double |
getVariance()
This method computes the variance.
|
void |
setParameters(int n,
double p)
This method sets the time and probability parameters.
|
void |
setProbability(double p)
This method sets the probability parameter.
|
void |
setSteps(int n)
This method sets the number of steps.
|
double |
simulate()
This method simulates a value from the distribution.
|
java.lang.String |
toString()
This method returns a string that gives the name of the distribution and the values of
the parameters.
|
getCDF, getDomain, getFailureRate, getMedian, getMGF, getMoment, getMoment, getPGF, getQuantile, getSD, getType, setDomain, setDomain
public WalkPositionDistribution(int n, double p)
n
- the number of stepsp
- the probabiltiy of a step in the positive directionpublic WalkPositionDistribution()
public void setParameters(int n, double p)
n
- the number of stepsp
- the probability of a step in the positive directionpublic double getDensity(double x)
getDensity
in class Distribution
x
- a number in the domain of the distributionpublic double getMaxDensity()
getMaxDensity
in class Distribution
public double getMean()
getMean
in class Distribution
public double getVariance()
getVariance
in class Distribution
public void setSteps(int n)
n
- the number of stepspublic double getSteps()
public void setProbability(double p)
p
- the probability of a step in the positve direcitonpublic double getProbability()
public double simulate()
simulate
in class Distribution
public java.lang.String toString()
toString
in class Distribution