AI Glossary / Statistics and probability / Intermediate
Indexed random variable
Definition
An indexed random variable is a member of a family of random variables identified by an index, such as X[i], X-t, or Y[i,j]. The index may label a person, time, location, measurement, or combination of these. Indexing organizes the model; the joint probability specification determines how the variables behave and depend on one another.
What it means
Writing X[1] and X[2] gives two uncertain quantities distinct names within a shared notation. It does not say that their distributions are identical or that their outcomes are independent.
For example, daily demand can be written D[t]. The time label identifies which day's demand is meant. A separate model must describe its possible values, changing average, and relationship with previous days. The notation is a way to express those relationships clearly, not an automatic assumption about them.
How it works
Define the index set and its meaning first. For customers numbered 1 through N, Y[i] might indicate whether customer i completes a purchase. For repeated measurements, Y[i,t] might represent customer i's activity during period t. The two indices prevent different kinds of repetition from being confused.
Distinguish a random variable from its observed value. Before observation, Y[i] has possible outcomes described by a probability model. After recording a particular outcome y[i], that value becomes evidence. Unobserved variables in the same indexed family may still require prediction or inference.
Specify the distribution and dependencies explicitly. Variables with equal marginal distributions can be dependent. Variables that are independent can have different marginal distributions. Neither property follows from putting them in the same array.
In a graphical model, an indexed expression can represent repeated nodes. A plate or repeated declaration is a compact way to describe a larger graph. It is necessary to know which parameters are shared, which quantities vary by index, and which conditional independence assumptions are intended.
Shared uncertain parameters deserve particular attention. Observations can be independent conditional on such a parameter while being dependent after that parameter is averaged out. Treating conditional independence as unconditional independence can understate uncertainty in totals or averages.
An index itself need not always be random. A fixed customer identifier simply selects a variable. A random index selects a member according to another uncertain quantity, as in a mixture model. Those are different constructions and should be described separately.
Array dimensions also have practical consequences. A software loop might create repeated distributions, whereas a mathematical sequence might have infinitely many indexed members. A finite implementation does not automatically represent every possible continuous-time or infinite-index process.
Check the mapping between data and indices. Sorting one table without updating its identifiers can attach an outcome to the wrong person or time. Repeated records, missing periods, and inconsistent starting indices can change the implemented model even when the mathematical notation looks correct.
Finally, explain the model in domain language. Readers should know whether an index means an independent participant, another observation of the same participant, or a future prediction. This determines what conclusions and validation procedures are appropriate.
Three practical examples
- A forecasting model writes sales as Y[store,week] to distinguish store differences from changes over time.
- A Bayesian model assigns an indexed outcome to each customer while sharing uncertain population parameters.
- A sensor model uses X[device,time] and explicitly represents dependence between repeated readings from the same device.
Think of it this way
Think of numbered drawers containing uncertain measurements. The labels tell you which drawer to discuss. They do not tell you whether the contents were generated separately, share a common cause, or follow the same distribution. Those relationships need their own description.
Worked example
An original example defines a shared probability P that equals 0.2 or 0.8, each with probability one half. Given P, indexed variables X[1] and X[2] are independent Bernoulli variables with success probability P.
Each has marginal success probability 0.5*0.2 + 0.5*0.8 = 0.5. Their joint success probability is 0.5*(0.2)^2 + 0.5*(0.8)^2 = 0.34.
If they were independent without conditioning, that joint probability would instead equal 0.5*0.5 = 0.25. Their covariance is 0.34 minus 0.25 = 0.09, so they are positively dependent marginally.
For S = X[1] + X[2], the mean is 1. Each marginal variance is 0.25, giving Var(S) = 0.25 + 0.25 + 2*0.09 = 0.68. Ignoring the shared uncertainty would give 0.50. The indexing is identical in both calculations; the difference comes from the dependence model.
Illustrative case study
In a fictional case, Alder Support models whether repeated messages from the same account require escalation. Its first analysis labels each message X[i] and mistakenly treats every message as independent.
The team changes the notation to X[account,message] and adds an account-level component. It also separates accounts across evaluation partitions so repeated messages do not disguise poor performance on new accounts. Clearer indexing exposes the modeling issue, but the revised assumptions still require checking against observed behavior. No measured improvement is claimed for this fictional project.
Common misconceptions and mistakes
Do not read an index as a numerical effect: customer 20 is not necessarily twice customer 10 in any meaningful sense. Do not assume adjacent indices imply temporal dependence unless the indexing represents time and the model includes it.
Using the same letter does not establish identical distributions. A compact loop does not prove independence, and shared parameters can create dependence after marginalization.
Business use
Indexed variables help teams specify models consistently, organize repeated measurements, and audit how records enter an analysis. Clear index definitions are especially valuable when joining customer, transaction, location, and time data. Review the sampling unit and dependency structure before interpreting a large row count as a large amount of independent evidence.
People also ask
Is an indexed random variable just an array element?
It can be represented that way in software, but its mathematical meaning includes uncertainty and its place in a probability model.
Does the index have to be time?
No. People, locations, groups, and multiple identifiers are common alternatives.
Check your understanding
If X[1] and X[2] share an uncertain parameter, must they be independent?
Answer: No. They may be conditionally independent given the parameter and dependent marginally, as the worked example demonstrates.
Related terms
- Random variable
- Conditional independence
- Stochastic process
- Plate notation
- Joint distribution
- Hierarchical model
- Mixture model
Learn next
Next, study the distinction between conditional and marginal independence. Then draw a small graphical model with repeated observations and identify which parameters are shared across indices.
More in Statistics and probability
- Implicit models - Implicit models, in probabilistic modeling, specify a procedure for generating samples rather than relying on an explicitly evaluable probability mass or...
- Imputation variance - Imputation variance is the component of an estimate's variability associated with replacing missing or unusable observations by imputed values.
- Index number - An index number expresses a quantity, price, or other measure relative to a specified reference, commonly set to 100.
- Indian buffet process - The Indian buffet process, or IBP, is a probability model for allocating potentially unbounded binary features to objects.
- Indirect sampling - Indirect sampling obtains information about a target population through records or other linked units rather than sampling and observing the target units...
- Individuals chart - An individuals chart is a statistical process control chart that plots one numerical observation at each monitoring occasion.
Sources
MultiBUGS, BUGS model specification language, including arrays, repeated structures, and nested indexing: https://www.multibugs.org/documentation/latest/ModelSpecification.html Russell and Norvig, Artificial Intelligence: A Modern Approach, companion website for the source textbook: https://aima.cs.berkeley.edu/
Previous: Indexed language Next: Indexing