Difference between revisions of "Uniform distribution"

Line 7: Line 7:
  
 
If you want a discrete uniform distribution over each value of an index '''I''', use [[ChanceDist]] instead:
 
If you want a discrete uniform distribution over each value of an index '''I''', use [[ChanceDist]] instead:
ChanceDist(1/Size(I), I)
+
:<code>ChanceDist(1/Size(I), I)</code>
  
 
==Examples==
 
==Examples==
Uniform(5, 10)
+
:<code>Uniform(5, 10) &rarr;</code>
[[File:UniformExample1.png]]
+
 
 +
:[[File:UniformExample1.png]]
  
 
==Optional Parameters==
 
==Optional Parameters==
 
===Integer===
 
===Integer===
 
The [[Uniform]] distribution with the optional «integer» parameter set to True returns discrete distribution over the integers with all integers between and including «min» and «max» having equal probability:
 
The [[Uniform]] distribution with the optional «integer» parameter set to True returns discrete distribution over the integers with all integers between and including «min» and «max» having equal probability:
Uniform(5, 14, Integer: True)
+
:<code>Uniform(5, 14, Integer: True) &rarr;</code>
[[File:UniformExample2.png]]
+
 
 +
:[[File:UniformExample2.png]]
  
 
===Over===
 
===Over===
 
Like most distributions, you may use the «over» parameter to generate an array of independent distributions for each combination of indexes. For example:
 
Like most distributions, you may use the «over» parameter to generate an array of independent distributions for each combination of indexes. For example:
Uniform(over: I, J)
+
:<code>Uniform(over: I, J)</code>
 
returns an independent <code>Uniform(0, 1)</code> distribution for each combination of values in indexes '''I''' and '''J'''.
 
returns an independent <code>Uniform(0, 1)</code> distribution for each combination of values in indexes '''I''' and '''J'''.
  
 
== Parameter Estimation ==
 
== Parameter Estimation ==
 
Suppose you have real-valued historic data in '''X''', indexed by '''I''', and you wish to estimate the bounds of the continuous uniform distribution. This is really just a matter of estimating the lower and upper bounds for the data, since the use of this distribution assumes a uniform distribution between those bounds. You can estimate the bounds as:
 
Suppose you have real-valued historic data in '''X''', indexed by '''I''', and you wish to estimate the bounds of the continuous uniform distribution. This is really just a matter of estimating the lower and upper bounds for the data, since the use of this distribution assumes a uniform distribution between those bounds. You can estimate the bounds as:
Xmin := Min(X, I) - 0.5*(Max(X, I) - Min(X, I))/Size(I);
+
:<code>Xmin := Min(X, I) - 0.5*(Max(X, I) - Min(X, I))/Size(I);</code>
Xmax := Max(X, I) + 0.5*(Max(X, I)- Min(X, I))/Size(I);
+
:<code>Xmax := Max(X, I) + 0.5*(Max(X, I)- Min(X, I))/Size(I);</code>
  
 
If you have discrete integer data in '''D''' indexed by '''I''', you can estimate the parameters for the integer uniform distribution <code>Uniform(Xmin, Xmax, integer: True)</code> as:
 
If you have discrete integer data in '''D''' indexed by '''I''', you can estimate the parameters for the integer uniform distribution <code>Uniform(Xmin, Xmax, integer: True)</code> as:
Xmin := Floor(Min(D, I) - 0.5*(Max(D, I) - Min(D, I))/Size(I);
+
:<code>Xmin := Floor(Min(D, I) - 0.5*(Max(D, I) - Min(D, I))/Size(I);</code>
Xmax  := Ceil(Max(D, I) + 0.5*(Max(D, I) - Min(D, I))/Size(I);
+
:<code>Xmax  := Ceil(Max(D, I) + 0.5*(Max(D, I) - Min(D, I))/Size(I);</code>
  
 
== See Also ==
 
== See Also ==

Revision as of 20:10, 11 January 2016

Uniform(min, max)

Creates a uniform distribution between values «min» and «max» in which all numbers between «min» and «max» are equally probable. If omitted, «min» and «max» default to 0 and 1, respectively.

If you know nothing about the uncertain quantity other than its bounds, a uniform distribution the bounds is appealing. However, situations in which this is truly appropriate are rare. Usually, you know that one end or the middle of the range is more likely than the rest — that is, the quantity has a mode. In such cases, a beta or triangular distribution is a better choice.

If you want a discrete uniform distribution over each value of an index I, use ChanceDist instead:

ChanceDist(1/Size(I), I)

Examples

Uniform(5, 10) →
UniformExample1.png

Optional Parameters

Integer

The Uniform distribution with the optional «integer» parameter set to True returns discrete distribution over the integers with all integers between and including «min» and «max» having equal probability:

Uniform(5, 14, Integer: True) →
UniformExample2.png

Over

Like most distributions, you may use the «over» parameter to generate an array of independent distributions for each combination of indexes. For example:

Uniform(over: I, J)

returns an independent Uniform(0, 1) distribution for each combination of values in indexes I and J.

Parameter Estimation

Suppose you have real-valued historic data in X, indexed by I, and you wish to estimate the bounds of the continuous uniform distribution. This is really just a matter of estimating the lower and upper bounds for the data, since the use of this distribution assumes a uniform distribution between those bounds. You can estimate the bounds as:

Xmin := Min(X, I) - 0.5*(Max(X, I) - Min(X, I))/Size(I);
Xmax := Max(X, I) + 0.5*(Max(X, I)- Min(X, I))/Size(I);

If you have discrete integer data in D indexed by I, you can estimate the parameters for the integer uniform distribution Uniform(Xmin, Xmax, integer: True) as:

Xmin := Floor(Min(D, I) - 0.5*(Max(D, I) - Min(D, I))/Size(I);
Xmax := Ceil(Max(D, I) + 0.5*(Max(D, I) - Min(D, I))/Size(I);

See Also

Comments


You are not allowed to post comments.