A categorical variable with two possible categories. Coding an event as one and its complement as zero makes the sample mean of that indicator variable equal to the event's sample proportion.
Categorical variable Created 2026-09-29 Updated 2026-10-05
A categorical variable takes values in a finite or countable set of labels. A regression model usually represents an unordered categorical predictor by indicator variables relative to a reference level in a regression factor.
Take independently decaying atomic nuclei, each with lifetime drawn from an exponential distribution of rate . With no replenishment, the survivor count is
Each indicator variable has success probability , so the binomial distribution gives
The smooth population law is the expected value , satisfying . One realization instead loses whole atomic nuclei at discrete times. An observed count above the smooth curve need not contradict the mathematical model.
For an original chosen example, let and half-life . Then . After , the survival probability is , giving
The standard deviation describes variation between repeated populations governed by these assumptions. It is not an uncertainty interval for a noiseless deterministic curve.
Figure 1.
Random survivor counts and the smooth radioactive-decay law
. Original constant-rate model with independent parent atomic nuclei and a half-life. Simulated histories are compared with their exact expected value and a one-standard deviation band. The second panel shows the exact binomial distribution after three half-lives. These are model calculations, not measurements from a historical sample. Details.
The half-life and the mean lifetime answer different questions:
The first is the median of one lifetime, or the time when half the population survives on average. The second is the lifetime's expected value. In this example they are and approximately .
For any fixed bin, each ball supplies an independent Bernoulli distribution indicator with success probability . Summing the indicator variables gives
The full occupancy vector has a multinomial distribution, the basic uniform balls-in-bins allocation. Distinct bin counts are not independent when and . To see this, write . For the same ball, if , while indicators from distinct balls are independent. Their covariance is therefore
With no balls the counts are deterministic; with one bin there are no distinct bin pairs. These degenerate cases do not contradict the conclusion.
Express the three counts as sums of indicator variables for , and . The linearity of expectation applies even though the bin counts are dependent. The binomial distribution gives
Thus
The relation checks the sum of these expectations. For , use the direct deterministic occupancies, or the usual binomial convention when .
Apply the Cauchy-Schwarz inequality to and the indicator variable . Since , it gives
Both sides of the truncated first moment bound in part (a) are nonnegative, so squaring it preserves the inequality. Combining the bounds and dividing by the positive second moment proves
This is the Paley-Zygmund inequality. It includes ; at the lower bound is zero and remains valid.
For each unordered triple of distinct vertices, let be the indicator variable that its three edges are present. This is a binomial random graph, so edge independence gives . The triangle count in a binomial random graph is . There are such triples; all are triangles in the complete graph.
The combinatorial maximum and expectation are
The maximum is attainable with positive probability if ; for , the random variable is identically zero. The linearity of expectation requires no independence between different triangle indicators.
Use a common intercept and laboratory-specific slopes in the normal linear model. With denoting days and the indicator variables for laboratories B and C, the design matrix has row , and
The interaction terms change slopes, without introducing laboratory-specific intercepts. Thus the estimated daily growth rates are
in millimetres per day, with fitted common intercept mm. The residual degrees of freedom are . The usual unbiased error variance estimate is the square of the residual standard error:
The small difference from arises from rounding the standard error to two decimal places; the latter uses the more precise residual sum of squares supplied later. A maximum-likelihood estimate would instead divide that residual sum of squares by .
Write for the request count on day . Both fits are Poisson regression models with independent
In model 1,
where the variables are indicator variables for winter, weekend, bank holiday, and low or medium pollution; non-winter weekdays that are not bank holidays and have high pollution form the baseline. Model 2 imposes
retaining only winter and weekend effects.
The models are nested, and the likelihood-ratio test statistic is the decrease in residual deviance,
There are three restrictions. By Wilks theorem, under this statistic is asymptotically a chi-squared distribution with three degrees of freedom. Since
we reject model 2 at the level in favour of model 1.
Kilometres is an ordinal categorical variable: its five levels have a meaningful order. Treating it as an ordinary factor would use four indicator variables and hence four unrelated regression coefficients. Converting the levels to numerical scores instead imposes a single linear trend across successive mileage bands. This is more parsimonious and gives greater precision when that trend is a reasonable approximation, although it also assumes that adjacent levels are equally spaced in their effect.
For a nonnegative random variable with finite mean and , the part of the expectation on is at most . Subtracting gives . If the second moment is positive and finite, applying the Cauchy-Schwarz inequality to and the indicator variable gives the Paley-Zygmund inequality .
Uniform balls-in-bins allocation Created 2026-10-06 Updated 2026-10-07
Place labelled balls independently into labelled bins, each with probability . The vector of bin counts has a multinomial distribution, and each count separately has the binomial distribution . Distinct bin counts have covariance , so they are dependent for and . Counts of bins of a specified size are sums of indicator variables; their expectations follow from the linearity of expectation, without any independence between bins.