Group Abstract Group Abstract

Message Boards Message Boards

0
|
5.4K Views
|
5 Replies
|
3 Total Likes
View groups...
Share
Share this post:

[?] Min and Max value (range) of a variate

Posted 8 years ago

Hi,

If I have a distribution, e.g.:

p := DiscreteUniformDistribution[{1,6}]

is there any way to find out range of values of related variate? (e.g. [1,6] in my example) Thank you

POSTED BY: Michael Kilburn
5 Replies

Some slightly hacky workarounds, which work since p1 is discrete:

Quantile[p1, {$MinMachineNumber, 1}]
Quantile[p1, {$MachineEpsilon, 1}]
Quantile[p1, {1/10^1000, 1}]

One can see the problem by evaluating InverseCDF[p1, x]. And you can use InverseCDF[p1, {low, high}], where low is greater than zero but small enough yield the lowest value in the range (similarly for high):

InverseCDF[p1, {$MachineEpsilon, 1}]
POSTED BY: Michael Rogers
POSTED BY: Sander Huisman

Doesn't work very well with TransformedDistribution unfortunately:

p := DiscreteUniformDistribution[{1,6}]
p1 := TransformedDistribution[a + b, {a\[Distributed]p, b\[Distributed]p}]
Quantile[p1, {0, 1}]

result:

Out[3]={-?,12}
POSTED BY: Michael Kilburn

Thank you! I would have never found it on my own. I was using this:

max = Maximize[{x, Probability[v ==x, v\[Distributed]w] > 0}, x, Integers]
min = Minimize[{x, Probability[v ==x, v\[Distributed]w] > 0}, x, Integers]

I noticed interesting thing, though -- Quantile[p, {0, 1}] can return wider range than min/max above if distribution p was defined via EmpiricalDistribution with some zero entries. E.g. this:

p := DiscreteUniformDistribution[{1,6}]

fixd[dist_] := Module[{x,k}, 
  EmpiricalDistribution[ Table[Probability[x==k, x\[Distributed]dist], {k,2,40}]->Table[k, {k, 2, 40}] ]
]

y := fixd[ TransformedDistribution[a + b, {a\[Distributed]p, b\[Distributed]p}] ]

max = Maximize[{x, Probability[v ==x, v\[Distributed]y] > 0}, x, Integers]
min = Minimize[{x, Probability[v ==x, v\[Distributed]y] > 0}, x, Integers]
Quantile[w, {0, 1}]

results:

Out[5]={12,{x->12}}
Out[6]={2,{x->2}}
Out[8]={2,40}

Is it normal?

POSTED BY: Michael Kilburn

Use Quantile for that:

Quantile[p, {0, 1}]
POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard