DiscreteUniformDistribution

DiscreteUniformDistribution[{imin,imax}]
represents a discrete uniform distribution over the integers from to .

DiscreteUniformDistribution[{{imin,imax},{jmin,jmax},}]
represents a multivariate discrete uniform distribution over integers within the box .

DetailsDetails

Background
Background

  • DiscreteUniformDistribution[{imin,imax}] represents a discrete statistical distribution (sometimes also known as the discrete rectangular distribution) in which a random variate is equally likely to take any of the integer values . Consequently, the uniform distribution is parametrized entirely by the endpoints and of its domain, and its probability distribution function is constant on the integers within the interval . The discrete uniform distribution is the discretized version of UniformDistribution, and like the latter, the discrete uniform distribution also generalizes to multiple variates, each of which is equally likely on some domain.
  • The likelihood of rolling any single value k from a fair die is precisely modeled by PDF[DiscreteUniformDistribution[{1,6}],k]. Given a key ring containing a unique correct key together with n incorrect ones, a modification of the inverse transform method using a discrete random variable on values 1,,n can be used to model the number of incorrect distinct selections expected before finding the correct key. This problem is related to the so-called estimation of maximum problem. An example of this known as the German tank problem was important in World War II and involved estimating the maximum needed in order for DiscreteUniformDistribution[{1,N}] to yield k observations for some integer k, .
  • RandomVariate can be used to give one or more machine- or arbitrary-precision (the latter via the WorkingPrecision option) pseudorandom variates from a discrete uniform distribution. Distributed[x,DiscreteUniformDistribution[{imin,imax}]], written more concisely as , can be used to assert that a random variable x is distributed according to a discrete uniform distribution. Such an assertion can then be used in functions such as Probability, NProbability, Expectation, and NExpectation.
  • The probability distribution and cumulative density functions may be given using PDF[DiscreteUniformDistribution[{imin,imax}],x] and CDF[DiscreteUniformDistribution[{imin,imax}],x]. The mean, median, variance, raw moments, and central moments may be computed using Mean, Median, Variance, Moment, and CentralMoment, respectively. These quantities can be visualized using DiscretePlot.
  • DistributionFitTest can be used to test if a given dataset is consistent with a discrete uniform distribution, EstimatedDistribution to estimate a discrete uniform parametric distribution from given data, and FindDistributionParameters to fit data to a discrete uniform distribution. ProbabilityPlot can be used to generate a plot of the CDF of given data against the CDF of a symbolic discrete uniform distribution and QuantilePlot to generate a plot of the quantiles of given data against the quantiles of a symbolic discrete uniform distribution.
  • TransformedDistribution can be used to represent a transformed discrete uniform distribution. Additionally, CopulaDistribution can be used to build higher-dimensional distributions that contain a discrete uniform distribution, and ProductDistribution can be used to compute a joint distribution with independent component distributions involving discrete uniform distributions.
  • The discrete uniform distribution is related to a number of other distributions. For example, DiscreteUniformDistribution[{a,b}] is the discretized version of UniformDistribution[{a,b}] under the assumption that both a and b are integers. DiscreteUniformDistribution is also related to PoissonDistribution in the sense that the sum of n independent discrete uniformly distributed random variables where nPoissonDistribution is itself a transformed Poisson distribution. The discrete uniform distribution is related to GeometricDistribution, due to the fact that if , then xiGeometricDistribution for and 2. DiscreteUniformDistribution is also related to BetaBinomialDistribution and tangentially to distributions such as CompoundPoissonDistribution.

ExamplesExamplesopen allclose all

Basic Examples  (8)Basic Examples  (8)

Probability density function of a univariate discrete uniform distribution:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Cumulative distribution function of a univariate discrete uniform distribution:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Mean and variance of a univariate discrete uniform distribution:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Median of a univariate discrete uniform distribution:

In[1]:=
Click for copyable input
Out[1]=

Probability density function of a bivariate discrete uniform distribution:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Cumulative distribution function of a bivariate discrete uniform distribution:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Mean and variance of a bivariate case:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Covariance:

In[1]:=
Click for copyable input
Out[1]//MatrixForm=
Introduced in 2007
(6.0)
| Updated in 2010
(8.0)