Write for the standard normal distribution function. Integrating out the twenty independent past durations gives the threshold-censored normal likelihood
The frequencies are those in part (a). For a future day, the conditional late-arrival probability is . Conditional independence of the five future durations gives .
Exactly three primitive random coordinates suffice. Draw from the same priors and one independent . Reject if ; otherwise return whether . Conditional on acceptance and the parameters, is uniform on an interval of length ; the true-answer subinterval has length . Reusing this same uniform value is therefore intentional, not an independence mistake.
Indeed the two output contributions at each parameter value are
These are exactly the contributions obtained by integrating the original twenty-five duration noises. Multiplication by the common prior density and normalization therefore give the same joint posterior distribution of . The revised program preserves the query and parameter posterior, but does not retain individual latent durations. This is uniform-interval encoding of conditioning and a binary query.
Here is an executable version, reusing the definitions from part (a). Logarithms avoid multiplying many small probabilities.
def normal_logcdf(z):
    value = 0.5 * math.erfc(-z / math.sqrt(2.0))
    return math.log(value) if value > 0.0 else -math.inf

def journey_loglik(mu, sigma):
    return (sum(n * normal_logcdf((mu - c) / sigma)
                for c, n in LATE.items())
            + sum(n * normal_logcdf((c - mu) / sigma)
                  for c, n in EARLY.items()))

def collapsed_trace(rng):
    mu = rng.uniform(0.0, 60.0)
    sigma = rng.uniform(1.0, 20.0)
    log_likelihood = journey_loglik(mu, sigma)
    # This uniform lies in (0, 1], avoiding log(0).
    log_u = math.log(1.0 - rng.random())
    if log_u >= log_likelihood:
        return None
    log_h = 5.0 * normal_logcdf((mu - 30.0) / sigma)
    return log_u < log_likelihood + log_h
accepted_average(collapsed_trace, n, rng) consequently has the same target as the original program. The ideal three-dimensional sample space is with product uniform probability measure, conditioned on the displayed acceptance event. Finite-precision normal tails can underflow to zero in this simple implementation; the mathematical equivalence concerns exact probabilities, and the numerical check in part (d) independently integrates the likelihood in the region carrying appreciable posterior mass.
This numbered item specifies the model used below. A convenient sample space is the collection of ordered pairs , each with probability . The corresponding random variables are determined by the sum and difference. Inverting the two equations gives
Thus a candidate pair is possible exactly when and are both integers between and . In particular, and must have the same parity. This inverse description will determine the joint probability mass function.
Since the form a partition of a set of the sample space, the events are pairwise disjoint and their set union is . By countable additivity of probability, followed by the definition of conditional probability,
Every ratio is legitimate because each . This proves the countable law of total probability.
Because the partition the sample space, the events are disjoint and their union is . Finite additivity and the definition of conditional probability give the law of total probability
The assumption ensures that each conditional probability is defined.
The finite-partition form of the law of total expectation states
Because the events form a partition of a sample space of the sample space, pointwise. Multiply by and use linearity of expectation to obtain
An event of zero probability contributes zero to the middle expression and is omitted from the final expression, so no undefined conditional expectation is multiplied by zero.
Let be a finite or countable partition of a set of the sample space into disjoint events, with . For any event , the law of total probability is
To prove it, the intersections are disjoint and have union . Countable additivity and the definition of conditional probability therefore give
It is enough that the union of the partition events has probability one. Parts of probability zero contribute zero in the intersection formula and can be omitted before writing conditional probabilities; conditioning by division on a zero-probability part would be undefined.
A partition of a sample space is a finite or countable family of pairwise disjoint events whose union is the whole sample space. For an integrable random variable, the partition form of the law of total expectation is
Zero-probability cells contribute zero and are omitted because elementary event-conditioning on them is undefined. The formula also holds with extended nonnegative values when . Integrability makes the signed series legitimate in the finite-expectation case.
Probability Created 2026-10-03 Updated 2026-10-14
The probability of an event is its value under a probability measure, a real number between zero and one. It compares the mass assigned to that event with the unit mass of the whole sample space. For a finite sample space with equally likely outcomes, . For unequal outcome masses, add their individual probabilities instead.
For example, selecting a coin with head probability with chance , or a coin with head probability with chance , gives head probability . This is the law of total probability: averaging over the hidden selection is part of calculating the outcome's probability.
Probability measure Created 2026-09-24 Updated 2026-10-14
A probability measure is a nonnegative, countably additive measure with total mass one. Thus , and for pairwise disjoint events ,
The complement of an event has probability . The probability of a union of overlapping events needs a correction: . Counting the overlap once is the simplest instance of the inclusion-exclusion principle.
A zero-probability event need not be impossible as a member of the sample space. Under the continuous uniform distribution on , every individual point has probability zero, while the whole interval has probability one. Countable additivity applies to countable unions, not arbitrary uncountable ones; there is no contradiction.
Probability space Created 2026-09-24 Updated 2026-10-14
A probability space is a measure space whose total measure is one. The sample space contains the elementary outcomes; the sigma-algebra contains the events to which the model assigns probabilities; the probability measure supplies those values. The sigma-algebra lets us combine observable questions using complements and countable unions while remaining within the model.
For two independent uniform dice, take , , and give each ordered pair mass . A random variable might record the sum, the larger result, or whether both results are even integers. These are different functions on the same sample space, rather than different elementary experiments. A probability distribution records the mass of the values of one such random variable and can forget information retained by the full probability space.
Probability theory Created 2026-09-24 Updated 2026-10-18
Probability theory describes uncertainty through a probability space: possible outcomes form a sample space, observable questions are events, and a probability measure assigns them numbers between zero and one. The Kolmogorov axioms make those assignments consistent. They let us combine information about several events, update it through conditional probability, and study random variables without listing every possible outcome separately.
For example, roll two dice whose results are independent random variables, each with a discrete uniform distribution on . There are 36 equally likely ordered outcomes. Only have sum seven, so that event has probability . The sum itself is not uniformly distributed: sum two has only one outcome. Choosing a probability distribution for the elementary outcomes is part of the model; equal likelihood does not follow merely from counting the named possibilities.
The subject becomes especially useful when complete outcome lists are enormous or infinite. Independence turns a joint calculation into simpler pieces, expected value summarizes a random variable, and the law of large numbers explains how averages can become predictable even when individual observations are uncertain. The central limit theorem describes the scale and shape of many remaining fluctuations. These are distinct claims: a small variance of an average does not make every observation close to its expected value.
There is a satisfying unity here: dice, hidden causes, and Brownian motion all use the same rules for events and conditional probability. A model still needs justification. Its exact deductions describe what its assumptions imply; comparison with observations belongs to statistical inference.
Probability vector 2026-10-25
A probability vector lists the probabilities of the outcomes in a finite sample space. Its entries are nonnegative and sum to one, so a column probability vector is a point of a probability simplex. Row and column conventions describe the same probability distribution, but they determine whether a stochastic matrix acts on the right or its transpose acts on the left.
Random variable Created 2026-09-24 Updated 2026-10-14
A real-valued random variable is a measurable function from a probability space to the real numbers with their Borel sigma-algebra. More general targets give random elements. For every Borel set , measurability ensures that is an event, so the question "does the observed value lie in ?" has a defined probability.
The function is fixed; its input outcome is uncertain. This separates what we measure from how the uncertainty is modeled. A probability distribution is the resulting pushforward measure, . A cumulative distribution function, probability mass function, or probability density function describes that measure in an appropriate setting. The random variable and its probability distribution are different objects: the former also retains its relationship to other measurements on the same sample space.
For two independent uniform dice, let record their results and define and . The 36 ordered pairs are equally likely, but the resulting probability mass functions differ:
For the sum, count the diagonal of the outcome grid having total . For the maximum, subtract the pairs with both results below from the pairs with both results at most . These examples show how a deterministic function transforms a simple input probability distribution into a nonuniform output one.
Figure 1.
Different random variables on the same equally likely dice outcome space
. Details.
The corresponding expected values are and . The first follows immediately from linearity of expectation; the second follows from . Neither number must be an attainable result. An expected value describes an average under the probability measure, not a prediction that the next observation will equal it.
The distinction between a random variable and its probability distribution matters for dependence. and have the same discrete uniform distribution and are independent random variables. and a second copy of also have that same marginal probability distribution, but they always agree. Their joint probability distribution is concentrated on the diagonal; the marginals alone cannot say which relationship holds. This is why a model for several measurements must specify their joint law or an appropriate independence assumption.
Indicator random variables turn events into numbers: equals one on and zero elsewhere, and . This connects event counting with expected value and variance, and lets tools for random variables answer questions about probabilities. More complicated functions of observations can describe totals, waiting times, or estimation errors using the same framework.
Sample path Created 2026-10-06 Updated 2026-10-14
For a stochastic process and a fixed sample space outcome , its sample path is the function . One row of observed fair bits, one trajectory of a random walk, or one staircase of Poisson process arrival counts is a sample path. Fixing instead gives a random variable ranging across possible histories. The same two-variable object therefore describes both observations across outcomes and evolution within an outcome.
Statements about continuous, càdlàg or Hölder continuous function sample paths concern these functions simultaneously in time. They differ from assertions made at each fixed time separately. For example, take with a uniform distribution on and set . For every fixed , almost surely, but every sample path has a single spike. Thus this process is a modification of a stochastic process that is identically zero, while the two are not indistinguishable stochastic processes. Continuity of both sets of sample paths rules out this discrepancy: equality at a countable dense set then implies equality everywhere. This is why path regularity is an additional part of constructing a continuous-time model.
Sample space Created 2026-10-14 Updated 2026-10-14
The sample space is the set of outcomes represented by a probability model. One elementary outcome specifies a complete result at the level of detail the model keeps. An event is a subset belonging to the model's sigma-algebra ; it occurs when the actual outcome lies in that subset. Together with a probability measure , these form a probability space , with .[ref]
Choosing a sample space means deciding which distinctions matter. For two tosses, recording the ordered head-or-tail sequence distinguishes from ; recording only the number of heads merges them. Neither representation is automatically wrong, but the second cannot answer a question about which toss was heads. Keeping a detailed sample space and defining a random variable for the desired observation lets several questions share one model.
A sample space alone assigns no probabilities. Even writing as a Cartesian product does not establish independence: that requires a condition on the probability measure. On a finite sample space with all subsets admitted as events,
Only when all elementary probabilities are equal does this become , where the bars denote cardinality. This is the uniform distribution on a finite set, an additional modelling choice.
Sample spaces can also be infinite. For example, take , its Borel sigma-algebra, and the continuous uniform distribution. Then for , so each singleton has probability zero while . Thus an elementary outcome need not carry positive probability, and a continuous model cannot be understood by counting equally likely points. The distinction is developed in zero-probability event and countable additivity.
Let a random vector have a finite actual range of values. Its nonempty fibres partition the sample space, and every event in is a union of those fibres. Thus each fibre is an atom of a sigma-algebra and has exactly elements. This assertion concerns the actual range; additional values attained only on null sets must still be counted when working with an uncompleted sigma-algebra literally.
To verify the claim, the fibres belong to as preimages of singleton Borel sets. Their unions form a finite sigma-algebra making measurable, so minimality of the generated sigma-algebra gives the reverse inclusion. Distinct subcollections have distinct unions because the fibres are nonempty and disjoint.
Consequently a finite history of finite-valued observations generates a finite natural filtration at each fixed time. It may be strictly smaller than the filtration of its driving continuous observations: a single uniform random variable already generates infinitely many distinct events with different probabilities.
Stochastic process Created 2026-09-24 Updated 2026-10-14
A stochastic process describes uncertainty about a whole history: not just the probability distribution of a measurement now, but how measurements at different times fit together. It is a family of random variables on one probability space, with index set . Time is the usual index: for successive observations or for continuous time. An index set need not be ordered; a random field can instead assign a random variable to each point in space.
There are two complementary views. Fix a time and is a random variable; fix a sample space outcome and is one sample path. A model specifies the probability distribution of these histories. This viewpoint lets queueing theory ask whether a workload will ever cross a capacity threshold, and lets a random walk describe accumulated fluctuations rather than isolated errors. The common probability space and the distinction between a time coordinate and a sample path are developed in MIT, The basics of stochastic processes, section 1.
A concrete construction starts with a Bernoulli process of independent fair bits . Keeping records the next trial; adding the signs gives a simple random walk on the integer line, and . Every increment of this random walk is , yet the positions are dependent: contains all the previous increments. Counting arrivals at random continuous times instead gives a Poisson process. These examples separate three questions: what values are possible, how time is indexed, and how the values depend on one another.
Figure 1.
Three kinds of random history: fair bits, their accumulated signs, and Poisson arrival counts
. Details.
For the fair simple random walk on the integer line, the expected value is and the variance is . At time four, returning to zero requires exactly two positive steps, so . A rate-two Poisson process instead has . A single realized sample path does not establish either probability: they follow from the specified joint probability distributions.
The most revealing feature is often dependence. Two stochastic processes can have identical marginal distributions at every time while one forgets everything at the next step and the other repeats its first value forever. Their finite-dimensional distributions and covariance functions distinguish them. That extra structure is what makes a stochastic process useful for prediction.