For the continuous distribution in the question, maps the support monotonically from zero to one. For , strict monotonicity givesThus is uniform on , the probability integral transform.
The order statistics are the sample values sorted increasingly, . Monotonicity of makes the th order statistic of independent uniforms. Its density is , givingThis follows either by beta integrals or by the equal expected lengths of the uniform spacings.
For the stated log-logistic cumulative distribution,Therefore plot vertically against horizontally, with plotting positions . A plausible model gives an approximately straight line, with slope and intercept . This specifies the axes explicitly, since reversing them would invert the slope.
For odd sample size, the sample median is the central order statistic, . Since , its index is and . Substitute these into the expectation and variance formulas from part (i):In fact has the symmetric beta distribution , explaining why its expectation is exactly the centre of the interval.
Continuity and strict increase make the quantile function well-defined on . The endpoints of the uniform distribution occur with probability zero and do not affect the construction. For every real ,Thus each has cumulative distribution function . Applying a fixed measurable function separately to independent random variables preserves their independence; explicitly, joint lower-tail probabilities factor asConsequentlyThis is inverse transform sampling. Since preserves order, it also sends the central order statistic to the central order statistic, justifying .
Sort the observations into order statistics . Choose plotting positions and calculate the standard normal quantiles . The normal Q-Q plot consists of the pairs .
If the normal distribution model is appropriate, the points should lie approximately on a straight line with positive slope, because its population quantile function isThe intercept is approximately and the slope approximately ; neither needs to be known in advance. The reference need not be the identity line. One justification is the probability integral transform: for an independent normal statistical sample, are uniform order statistics, whose typical values are near their plotting positions. The equality is approximate for a finite sample, particularly at the extremes. Systematic curvature, unusually heavy tails, or isolated extreme departures argue against the proposed distributional shape. A straight marginal Q-Q plot does not itself establish independence of observations.
Store the current multiset in an unsorted prefix The loop invariant is , the complete array has its original multiset, every discarded entry on the left is at most every active entry, and every active entry is at most every discarded entry on the right. Thus the desired global order statistic is the local one of rank . The two-way array partition result either identifies it or excludes the pivot and the irrelevant side. The positive loop variant strictly decreases unless the procedure returns.
a[0..len); Add appends exactly as in part (a). The coupling invariant is equality of length and multiset with abstract xs, rather than equality of insertion order. Get applies quickselect:PROCEDURE Get(k: INTEGER): INTEGER;
VAR l, r, m: INTEGER;
BEGIN
ASSERT((0 <= k) & (k < len));
l := 0; r := len;
LOOP
m := Partition(l, r);
IF k = m THEN RETURN a[m]
ELSIF k < m THEN r := m
ELSE l := m+1
END
END
END Get;Balanced pivots give , whose geometric series is . More generally, choosing a uniformly random pivot before each call, by swapping a random active entry into
a[r-1], gives expected running time on distinct keys: with constant probability, the pivot is in the middle half and the retained side has size at most . Expected work over these shrinking stages is a convergent geometric series.The particular last-entry pivot in the displayed code has no unconditional expected guarantee without an input distribution. Its worst case repeatedly discards one entry. Duplicate keys require further care: on an all-equal segment, the strict partition always returns , so selecting the last rank costs even with randomized pivot positions. A three-way array partitioning that groups all keys equal to the pivot restores the usual randomized linear expectation with duplicates; alternatively the stated expectation assumes distinct keys. This is a qualification to the bound, not to the algorithm correctness of the displayed code.Keep the target as an absolute, zero-based array index:
function Find(i; var a; l, r): T
require l <= i < r
Partition(a,l,r,m,n)
if i < m then
return Find(i,a,l,m)
else if i >= n then
return Find(i,a,n,r)
else
return a[i]The order statistic belongs to the lower segment, equality interval or upper segment according to the index comparison. In the middle interval its value is the pivot; otherwise Quickselect recurses only into the relevant outer interval. The nonempty equality interval guarantees a strictly shorter retained segment. The procedure sorts neither discarded segment. Since indices remain absolute, the right recursion does not subtract
n from i.Each recursive call is a tail call: nothing remains to be computed after it returns. Replace it by an update of the retained bounds:
function Select(i; var a; N): T
require 1 <= i <= N
target := i-1
l := 0
r := N
while true do
Partition(a,l,r,m,n)
if target < m then
r := m
else if target >= n then
l := n
else
return a[target]The loop invariant retains the target order statistic in with . Each nonreturning iteration strictly decreases , because is nonempty. This proves termination and replaces recursive stack space by auxiliary space, apart from the pivot routine's own storage.
The displayed reference to index makes the nontrivial case ; at the trees already agree and no further edge exists. Write and . If , its weight is at least the first nonprefix weight and at most that weight by hypothesis. Thus it ties for the next position, and simply ordering this tie with first gives the result.
Otherwise add to . The resulting fundamental cycle contains an edge : if its whole path lay in , then would already contain a cycle. Every edge of , including , has weight at least . Set .
This is a spanning tree and still contains . Its sorted order can begin with the specified prefix and then , because all remaining edges have weight at least and each prefix weight is at most . Replacing one entry of a multiset by a no-larger entry cannot increase any sorted order statistic: for every threshold, the number of entries below or equal to it cannot decrease. Hence for every . Ties may be ordered as needed; the paper prescribes nondecreasing weights, not an immutable global tie-break rule. This is spanning-tree prefix exchange.
For and , independence gives the cumulative distribution functionThe cumulative distribution function is zero below and one above . Differentiating on the interior givesup to irrelevant endpoint values. There are no endpoint atoms. This maximum is an order statistic.
Ranks are relative to the current segment. The pivot's rank is The array partitioning places exactly
p-l, not its absolute index:def select(k: Int, l: Int, r: Int): Int = {
require(0 <= l && l < r && r <= a.length)
require(0 <= k && k < r - l)
if (r - l == 1) a(l)
else {
val p = partition(l, r)
val rank = p - l
if (k == rank) a(p)
else if (k < rank) select(k, l, p)
else select(k - rank - 1, p + 1, r)
}
}rank strictly smaller entries before the pivot, with all later entries at least the pivot. Thus the pivot is the element of sorted rank rank, even when equal values occur later. A requested earlier rank is unchanged in the left segment; a later rank loses the low entries and the pivot, accounting for the subtraction rank+1. The recursive segment is nonempty in either branch that takes it, and its length strictly decreases. Induction on segment length therefore proves the returned value is the requested order statistic, with at most one recursive call. Only the selected segment is permuted; all outside entries remain unchanged. This is Quickselect.Replace the tail call by updates to local bounds and a local rank:The loop invariant says that , , and selecting rank
def selectIterative(k: Int, l: Int, r: Int): Int = {
require(0 <= l && l < r && r <= a.length)
require(0 <= k && k < r - l)
var low = l
var high = r
var rank = k
while (high - low > 1) {
val p = partition(low, high)
val pivotRank = p - low
if (rank == pivotRank) return a(p)
if (rank < pivotRank) high = p
else {
rank -= pivotRank + 1
low = p + 1
}
}
a(low)
}rank in the active segment yields the originally requested order statistic. The original segment's multiset is preserved, and outside it no entries change. The updates are exactly the recursive reductions proved in part (c). The loop variant is ; a non-returning iteration strictly decreases it. A one-entry segment has only rank zero, establishing the final return. Auxiliary space is , rather than a potentially deep call stack.Recursively partition into equal halves by rank, keeping the selected median in the lower half:All elements are distinct, so both halves have exactly elements. Since remains a power of two, every internal split occurs at a rank divisible by .
quantiles(A,k):
if length(A) == k:
return [maximum(A)]
p = select the (length(A)/2)-th smallest element of A
L = all elements of A at most p
R = all elements of A greater than p
return quantiles(L,k) followed by quantiles(R,k)For correctness, the desired ranks in the lower half are . In the upper half they are the same local multiples of , shifted by . These are exactly all desired global ranks. At a leaf of size , its maximum is its sole requested local rank. Induction therefore proves that the output contains every requested order statistic, in increasing order, including the original maximum. There is no separate internal-node output of
p, which would duplicate a rank already supplied by the lower subtree.Use a worst-case linear-time selection algorithm and linear partitioning. The divide-and-conquer algorithm hasThere are internal levels, each with total work , and leaves with total work . Since the source assumes , the running time isThis is multiselection by balanced rank partitioning. In-place selection and partitioning can use the original array; the output has values. The multiselection recursion has depth ; the selection routine contributes its own auxiliary storage.
Plotting position 2026-10-14
A plotting position assigns a probability level to an order statistic for a Q-Q plot. The displayed formula is one convention, not a universal definition. R's
ppoints uses , with by default for , which gives our choice at ; for its default is . NIST's normal probability plot instead describes an approximation to uniform distribution order statistic medians. State the convention when comparing plots, especially their extreme quantiles. [ref]https://stat.ethz.ch/R-manual/R-devel/library/stats/html/ppoints.html. R stats documentation, ppoints
[ref]https://www.itl.nist.gov/div898/handbook/eda/section3/normprpl.htm. NIST/SEMATECH, Normal Probability Plot, definition
Poisson process Created 2026-09-24 Updated 2026-10-14
A Homogeneous Poisson process models arrivals at a constant rate . Its counting process counts arrivals in , with . Its paths are right-continuous nondecreasing functions, take nonnegative integer values, and have unit jumps almost surely. The defining Poisson distribution of each increment isIt has stationary increments: the probability distribution above depends on the duration , not the starting time . It also has independent increments: counts in any finite collection of disjoint time intervals are independent random variables. Together these conditions specify the joint count laws, not merely the Poisson distribution at a single time.[ref]
Poisson Processes (Chapter 2). pp. 78-79: counting-process definition and its equivalence to exponential interarrival times
The rate has units of arrivals per unit time; is dimensionless. The Poisson distribution givesFor a toy rate per minute and a duration of minutes, the expected value and variance of the count are both . The probability of no arrival is , and the probability of exactly three is . In two consecutive one-minute intervals, the probability of exactly two arrivals in the first and exactly one in the second is , using independent increments. These are exact model calculations with rounded decimals, not measured frequencies.
Synthetic arrival times and their right-continuous counting path, compared with the exact mean at two arrivals per minute
. Details. The diagram's nine hand-chosen arrivals illustrate a path; the line is an expected value, not a prescribed trajectory. Constant rate does not imply evenly spaced arrivals. Poisson interarrival times connect the count description to waiting, while Poisson thinning explains how independently routing arrivals produces separate streams. This makes the Poisson process useful as a simple arrival model for a queue, provided constant rate and independent increments are plausible. For a deterministic changing rate, use an Inhomogeneous Poisson process; bunching or history-dependent arrivals need additional assumptions. Conditional on , the arrival times are the order statistics of independent uniform distributions on , as developed in Poisson process conditional arrival times.
Probability plot 2026-10-31
A probability plot compares order statistics with plotting positions or model quantiles to diagnose whether a proposed probability distribution describes data. If the model can be transformed into a linear identity , plot against . Approximate linearity supports that model's shape; systematic curvature suggests a mismatch.
The plotting position comes from the exact mean of the th uniform order statistic, by the probability integral transform. It does not assert equality between the expectation of a nonlinear transformation and that transformation of the expectation. Fitted slope and intercept can estimate model parameters, but the visual plot alone is not a calibrated hypothesis test.
Q-Q plot 2026-10-13
A Q-Q plot is a scatter plot pairing quantiles at the same probability levels. For a statistical sample of size , sort the observations into order statistics . Choose plotting positions and a reference quantile function , then plotHere the horizontal coordinate is a reference value, and the vertical coordinate is an observed value; neither axis is the probability . The displayed plotting positions are our chosen convention, placing every level strictly between zero and one. They are not a claim that the th order statistic equals that population quantile. For two statistical samples, use sample quantiles at matching levels, with a stated interpolation convention when their sizes differ. [ref]
As a computed example, take and the standard normal quantiles , where is the standard normal cumulative distribution function. Construct the ordered values . At ranks , the plotting positions are , the reference quantiles are approximately , and the constructed values are approximately . Every point lies on by construction. These 19 values are deliberately chosen, not random draws or real measurements.
The usefulness of a Q-Q plot is that it turns a comparison of probability distributions into geometry: if a reference random variable is transformed into with , its quantile function satisfies . This follows because a positive scaling preserves ordering. Thus the location-scale family produces a straight population Q-Q plot, and an approximate sample line suggests a compatible shape over the observed range. Its intercept describes location and its slope describes scale. The identity line requires the same location, scale and units on both axes; even then its displayed angle is 45 degrees only with equal axis scales. Curvature is often more informative than a histogram because it shows which quantiles depart from the reference. [ref]
https://www.itl.nist.gov/div898/handbook/eda/section3/qqplot.htm. NIST/SEMATECH, Quantile-Quantile Plot, location and scale comparisons
Quartile 2026-10-14
Quartiles are the quantiles at probability levels ; is a median. For a population we can use its quantile function, for . Finite-sample conventions differ. Our box plot uses linear interpolation between order statistics: for and , setThen . This is R's type-7 convention, described in the documentation authored by Ivan Frohne and Rob J Hyndman. It differs from the generalized-inverse sample quantile defined elsewhere in this wiki: for the twelve toy values, that rule selects ranks and gives , rather than . These are different stated conventions, not arithmetic disagreements. [ref]
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/quantile.html. Frohne and Hyndman, R stats documentation, sample quantile types
Quickselect Created 2026-10-24 Updated 2026-10-31
A selection algorithm that uses array partitioning around a pivot and recursively searches only the side containing the desired order statistic. If there are entries before the placed pivot, an earlier rank is unchanged and a later rank is reduced by . Segment length strictly decreases, proving algorithm termination. The same reduction can update local bounds in a loop, using constant auxiliary space.
Balanced reductions give linear work by a geometric series, while repeatedly discarding only a constant number of entries can give quadratic work. For distinct entries and independent uniform random pivots, a pivot in the middle half has probability at least one half and reduces the retained length to at most three quarters, up to rounding. The expected number of attempts for each such reduction is bounded, so summing expected work over geometric size scales gives expected time. This random-pivot guarantee is not a worst-case guarantee for a deterministic median-of-three heuristic. With duplicates and a strict two-way partition, random pivot choice alone can also fail to shrink an all-equal segment; a three-way partition treats equal keys together.
Rank of an observation 2026-10-14
The rank of an observation records where that observation lies among the order statistics of a statistical sample. When all values are distinct, and . For , the ranks of observations in original order are : the first observation is fourth smallest, while the fourth observation is third smallest.
Ties require a convention. A tied block occupying sorted positions can assign each member the average rank of an observation , the minimum position , or the maximum position ; an explicit rule can also break ties into distinct positions. R's official documentation describes these choices and uses average ranks by default. [ref]
https://stat.ethz.ch/R-manual/R-devel/library/base/html/rank.html. R base documentation: sample ranks and tie methods
.For example, has order statistics . The two observations occupy positions and ; average ranks of observations are , whereas minimum-position ranks are . A fractional average rank is a summary of tied positions, rather than an index of one order statistic. Without omissions, distinct ranks and average ranks sum to , since averaging each tied block preserves its sum; minimum-position ranks need not.
Wilcoxon signed-rank tests rank the absolute nonzero paired differences, while Wilcoxon rank sum tests rank the pooled observations from two samples; these are different rankings.
Sample median Created 2026-09-28 Updated 2026-10-14
The sample median is a central value of an ordered statistical sample. The usual numerical convention selects the middle order statistic for odd sample size and the arithmetic mean of the two central order statistics for even sample size:NIST uses this convention. [ref]
https://www.itl.nist.gov/div898/handbook/eda/section3/eda351.htm. NIST: measures of location, median definition
. For , the sample median is ; for , it is , which need not be an observed value.More generally, every value between the two central order statistics in an even statistical sample is a median of its empirical distribution function. The generalized-inverse sample quantile at selects the lower central order statistic in that case, so it can differ from the midpoint convention. Ties are allowed in all these definitions.
The sample median measures the center using sorted positions. Changing the largest observation from to in the five-value example leaves the sample median at , while the sample mean rises from to . Its sampling distribution still depends on the population probability distribution: the mean found for five observations from a uniform distribution is a special calculation, and a sample median's expected value need not equal the population median in general.
For a concrete counterexample, three independent and identically distributed random variables with rate-one exponential distribution have sample median with expected value , by independent exponential order-statistic spacings. The population median instead solves , giving . Thus even the middle order statistic can have mean different from the population median.

