Macaulay2 » Documentation
Packages » Probability :: quantile
next | previous | forward | backward | up | index | toc

quantile -- quantile function

Synopsis

Description

For continuous probability distributions, the quantile function is the inverse of the cumulative distribution function, i.e., \(x\) for which \(P(X \leq x) = p\).

i1 : Z = normalDistribution()

o1 = N(0,1)

o1 : ContinuousProbabilityDistribution
i2 : quantile_Z 0.95

o2 = 1.64485362695147

o2 : RR (of precision 53)
i3 : probability_Z oo

o3 = .95

o3 : RR (of precision 53)

For discrete probability distributions, it returns the smallest \(x\) for which \(P(X \leq x) \geq p\).

i4 : X = binomialDistribution(10, 0.25)

o4 = B(10,.25)

o4 : DiscreteProbabilityDistribution
i5 : quantile_X 0.75

o5 = 3
i6 : probability_X 2

o6 = .525592803955078

o6 : RR (of precision 53)
i7 : probability_X 3

o7 = .775875091552734

o7 : RR (of precision 53)

If the LowerTail option is false, then it instead finds \(x\) for which \(P(X > x) = p\) in the continuous case.

i8 : quantile_Z(0.95, LowerTail => false)

o8 = -1.64485362695147

o8 : RR (of precision 53)
i9 : probability_Z(oo, LowerTail => false)

o9 = .95

o9 : RR (of precision 53)

In the discrete case, it finds the smallest \(x\) for which \(P(X > x) \leq p\).

i10 : quantile_X(0.75, LowerTail => false)

o10 = 2
i11 : probability_X(2, LowerTail => false)

o11 = .474407196044922

o11 : RR (of precision 53)
i12 : probability_X(1, LowerTail => false)

o12 = .755974769592285

o12 : RR (of precision 53)

Ways to use quantile :

For the programmer

The object quantile is a method function with options.