edu.uah.math.distributions
Class MatchDistribution

java.lang.Object
  extended by edu.uah.math.distributions.Distribution
      extended by edu.uah.math.distributions.MatchDistribution
All Implemented Interfaces:
java.io.Serializable

public class MatchDistribution
extends Distribution
implements java.io.Serializable

This class models the distribution of the number of matches in a random permutation. A match occurs whenever an element is in its natural order.

Version:
August, 2003
Author:
Kyle Siegrist, Dawn Duehring
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.uah.math.distributions.Distribution
CONTINUOUS, DISCRETE, MIXED
 
Constructor Summary
MatchDistribution()
          This default constructor creates a new mathcing distribuiton with parameter 5.
MatchDistribution(int n)
          This general constructor creates a new matching distribution with a specified parameter.
 
Method Summary
 double getDensity(double x)
          This method computes the probability density function.
 double getMaxDensity()
          This method gives the maximum value of the probability density function.
 double getMean()
          This method returns the mean, which is 1, regardless of the parameter value.
 int getParameter()
          This method gets the parameter.
 double getVariance()
          This method returns the variance, which is 1 regardless of the parameter value.
 void setParameter(int n)
          This method sets the parameter of the distribution.
 double simulate()
          This method simulates a value from the distribution, by generating a random permutation and computing the number of matches.
 java.lang.String toString()
          This method returns a string that gives the name of the distribution and the values of the parameters.
 
Methods inherited from class edu.uah.math.distributions.Distribution
getCDF, getDomain, getFailureRate, getMedian, getMGF, getMoment, getMoment, getPGF, getQuantile, getSD, getType, setDomain, setDomain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MatchDistribution

public MatchDistribution(int n)
This general constructor creates a new matching distribution with a specified parameter.

Parameters:
n - the number of elements

MatchDistribution

public MatchDistribution()
This default constructor creates a new mathcing distribuiton with parameter 5.

Method Detail

setParameter

public void setParameter(int n)
This method sets the parameter of the distribution.

Parameters:
n - the size of the random permutation

getDensity

public double getDensity(double x)
This method computes the probability density function.

Specified by:
getDensity in class Distribution
Parameters:
x - a number in the domain {0, 1, 2, ...}
Returns:
the probability density at x

getMaxDensity

public double getMaxDensity()
This method gives the maximum value of the probability density function.

Overrides:
getMaxDensity in class Distribution
Returns:
the maximum value of the probability density function

getMean

public double getMean()
This method returns the mean, which is 1, regardless of the parameter value.

Overrides:
getMean in class Distribution
Returns:
the mean of the distribution

getVariance

public double getVariance()
This method returns the variance, which is 1 regardless of the parameter value.

Overrides:
getVariance in class Distribution
Returns:
the variance of the distribution

getParameter

public int getParameter()
This method gets the parameter.

Returns:
the size of the random permutation

simulate

public double simulate()
This method simulates a value from the distribution, by generating a random permutation and computing the number of matches.

Overrides:
simulate in class Distribution
Returns:
a simulated value from the distribution

toString

public java.lang.String toString()
This method returns a string that gives the name of the distribution and the values of the parameters.

Overrides:
toString in class Distribution
Returns:
a string giving the name of the distribution and the values of the parameters