Tutorials › Marginal Structural Models › Notation For Longitudinal Treatments And Covariates

Time-Varying Treatments and Confounder Feedback · Tutorial 1 of 501

Notation For Longitudinal Treatments And Covariates

Learn to read and construct two-visit longitudinal records without confusing a current measurement with its history or placing a variable at the wrong point in time.

Intermediate 10 min read

What You'll Learn

  • Distinguish baseline covariates, later covariates, treatment decisions, and the final outcome by their visit indices.
  • Write current treatment and covariate values separately from histories accumulated through a visit.
  • Expand and reconstruct a complete two-visit record in its chronological order.
  • Check that each history contains exactly the variables observed up to its stated index.
  • Identify common indexing errors that make a longitudinal record ambiguous.

Why Visit Indices Matter

In a longitudinal study, a participant can contribute several measurements over time. A notation that simply labels a participant as treated or untreated loses the order of treatment decisions and measurements. To describe a two-visit study clearly, we need to show which variable was recorded at which point and which earlier values are included when we refer to a history.

Consider a study with a baseline measurement, a first treatment decision, a later covariate measurement, a second treatment decision, and an outcome recorded after the second decision. The order matters for organizing the data: the later covariate is not another name for the baseline covariate, and the second treatment is not the entire treatment history.

Definition: For participant \(i\), let \(L_{0i}\) denote the baseline covariate value or vector, \(A_{0i}\) the first treatment, \(L_{1i}\) the covariate value or vector measured before the second treatment, \(A_{1i}\) the second treatment, and \(Y_i\) the outcome measured after the second treatment. The participant index is \(i=1,\ldots,n\). The visit index \(t\) in \(L_t\) or \(A_t\) identifies the measurement or decision time; it is not a participant index.

For example, \(L_{1i}\) might be a disease-severity measurement for participant \(i\) taken between the first and second treatment decisions. The notation does not say that this measurement has a particular value, distribution, or causal role. It identifies when the measurement belongs in the record. A covariate can contain several measurements, so \(L_{0i}\) and \(L_{1i}\) may be vectors. For simplicity, \(A_{0i}\) and \(A_{1i}\) denote scalar treatments here; if a treatment consists of several components, each \(A_{ti}\) can also be a vector.

Current Values and Histories

A current value is indexed by its own visit: \(A_{1i}\) is the second treatment alone. A history collects values from earlier visits through the named visit. Use an overbar to denote such a collection. Thus \(\bar A_{1i}\) contains both treatments, while \(\bar L_{1i}\) contains both covariate measurements.

Definition: For the two-visit study, define the treatment histories by \(\bar A_{0i}=(A_{0i})\) and \(\bar A_{1i}=(A_{0i},A_{1i})\), and the covariate histories by \(\bar L_{0i}=(L_{0i})\) and \(\bar L_{1i}=(L_{0i},L_{1i})\). A tuple in parentheses lists values in chronological order. The final outcome \(Y_i\) is recorded after the two treatment decisions and is not, by this definition, a component of either history.

The subscript on a history marks its last included visit. Consequently, \(\bar A_{0i}\) does not include \(A_{1i}\), and \(\bar L_{0i}\) does not include \(L_{1i}\). In particular, the bar does not mean “all variables in the study”; it means the sequence of the indexed variable through the indicated visit. If a history is discussed without a participant index, such as \(\bar A_1\), the index \(i\) is suppressed for readability, not replaced by a different convention.

$$ \bar A_{1i}=(\bar A_{0i},A_{1i})=(A_{0i},A_{1i}), \qquad \bar L_{1i}=(\bar L_{0i},L_{1i})=(L_{0i},L_{1i}). $$

These definitions are bookkeeping conventions, not assumptions about a statistical model. They do not require that every participant receive the same treatment, that covariates be scalar, or that the values be independent. They do require a study schedule that lets the analyst identify the relevant occasions. If a measurement is taken after a treatment decision rather than before it, the record must reflect that actual timing; using the symbols above without clarifying the schedule could misrepresent what is observed at each point.

Worked Example: Assigning Indices to a Clinical Timeline

A study records a patient's baseline disease severity, gives an initial treatment, records disease severity again three months later before a second treatment decision, and measures a clinical outcome one month after that decision. Write the record for participant 7.

Call baseline severity \(L_{0,7}\), the initial treatment \(A_{0,7}\), the three-month severity measurement \(L_{1,7}\), the second treatment \(A_{1,7}\), and the outcome \(Y_7\). The time labels make clear that \(L_{1,7}\) is measured before \(A_{1,7}\), while \(Y_7\) is measured after it.

The histories are \(\bar L_{0,7}=(L_{0,7})\), \(\bar L_{1,7}=(L_{0,7},L_{1,7})\), \(\bar A_{0,7}=(A_{0,7})\), and \(\bar A_{1,7}=(A_{0,7},A_{1,7})\). The complete chronologically ordered record is \(L_{0,7}, A_{0,7}, L_{1,7}, A_{1,7}, Y_7\). Notice that the outcome is part of the record but not part of the treatment history.

Two Useful Bookkeeping Results

History notation is useful because it compresses a sequence without changing its contents. The first result makes explicit how the sequence grows from the first visit to the second.

Result: Under the definitions above, each two-visit history is formed by appending exactly one visit-specific value to its first-visit history. In particular, \(\bar A_{1i}=(\bar A_{0i},A_{1i})\) and \(\bar L_{1i}=(\bar L_{0i},L_{1i})\). If treatment values are scalar, the treatment histories contain one and two entries respectively; if covariate vectors have dimensions \(p_0\) and \(p_1\), the covariate histories contain \(p_0\) and \(p_0+p_1\) scalar entries respectively.

Derivation. By definition, the treatment history through visit 0 contains only \(A_{0i}\), and the history through visit 1 contains the treatment values at visits 0 and 1 in chronological order. Therefore \(\bar A_{1i}=(A_{0i},A_{1i})\), which is precisely \((\bar A_{0i},A_{1i})\). The same definition applied to the covariates gives \(\bar L_{1i}=(L_{0i},L_{1i})=(\bar L_{0i},L_{1i})\). If \(L_{0i}\) has \(p_0\) components and \(L_{1i}\) has \(p_1\), concatenating the vectors gives \(p_0+p_1\) components. Thus the identities and the entry counts follow directly from the definitions. \(\square\)

The second result is a practical uniqueness property: once the two treatment values and two covariate values are known, the histories are determined, and the current second-visit values can be recovered from the histories.

Result: For any participant \(i\), the pair of histories \((\bar A_{1i},\bar L_{1i})\) determines \(A_{0i}, A_{1i}, L_{0i}, L_{1i}\) uniquely. The first entries are \(A_{0i}\) and \(L_{0i}\); the second entries are \(A_{1i}\) and \(L_{1i}\).

Proof. By definition, \(\bar A_{1i}\) is the ordered tuple \((A_{0i},A_{1i})\), so its first entry is \(A_{0i}\) and its second is \(A_{1i}\). Likewise, \(\bar L_{1i}=(L_{0i},L_{1i})\), so its first and second entries are \(L_{0i}\) and \(L_{1i}\). The order and entry labels are fixed by the visit indices; there is no second assignment of these four values consistent with the same ordered histories. \(\square\)

This result is simple, but it guards against a real data-management error: treating a history as an unordered set. If the order were discarded, the pair \((A_{0i},A_{1i})\) would no longer indicate which treatment came first. A history is an ordered sequence, not merely a list of values.

Worked Example: Reading a Binary Treatment History

Suppose a participant receives no treatment at the first decision and treatment at the second decision. Use 0 for no treatment and 1 for treatment. Write the current values and histories, and explain what each notation contains.

The current values are \(A_{0i}=0\) and \(A_{1i}=1\). The first-visit history is \(\bar A_{0i}=(0)\). The two-visit history is \(\bar A_{1i}=(0,1)\), with the first entry recording the first decision and the second entry recording the second decision.

The pair \((1)\) is not \(\bar A_{1i}\): it contains only the second treatment. Conversely, \((0,1)\) is not a value of \(A_{1i}\); it is the history through the second visit. This distinction still applies if the treatment values are labels rather than numbers.

Putting the Full Record in Chronological Order

A complete record for one participant can be written as \((L_{0i},A_{0i},L_{1i},A_{1i},Y_i)\). This order is chosen to match the study schedule: baseline covariates, first treatment, later covariates, second treatment, and final outcome. It does not imply that every possible variable must be observed, nor does it specify a model for the relationship among the values.

When covariates are vectors, it helps to check dimensions explicitly. For instance, if \(L_{0i}=(L_{0i}^{(1)},L_{0i}^{(2)})\) measures age and baseline severity, and \(L_{1i}=(L_{1i}^{(1)},L_{1i}^{(2)},L_{1i}^{(3)})\) measures severity, symptoms, and laboratory status later, then \(\bar L_{1i}\) contains five scalar components in the order baseline age, baseline severity, later severity, later symptoms, and later laboratory status. Parenthesized superscripts here identify components, not additional visit indices.

Worked Example: Checking a Vector-Valued Covariate History

For one participant, suppose \(L_{0i}=(52,3)\), where the entries are age in years and baseline severity, and \(L_{1i}=(5,2,1)\), where the entries are later severity, symptom count, and a laboratory indicator. Suppose \(A_{0i}=0\) and \(A_{1i}=1\). Write \(\bar L_{1i}\), \(\bar A_{1i}\), and the complete record, and check the number of covariate entries.

The covariate history concatenates the baseline vector and the later vector in that order: \(\bar L_{1i}=((52,3),(5,2,1))\). If a flat list is preferred, the same ordered components are \((52,3,5,2,1)\). There are \(2+3=5\) scalar covariate entries.

The treatment history is \(\bar A_{1i}=(0,1)\). If the outcome is \(Y_i=8\), the full record is \(((52,3),0,(5,2,1),1,8)\). The nested parentheses retain the fact that each \(L_t\) is a vector; flattening is safe only if the component order and meanings are documented.

Common Indexing Errors and Checks

Most notation errors in a two-visit record are errors of timing or scope. They can be caught by asking two questions: what occasion does this subscript identify? and does this history include only values through the stated visit? A quick audit should verify that every participant-level variable is indexed consistently and that the ordering matches the data-collection schedule.

  • Using \(A_{1i}\) to mean the full treatment history. \(A_{1i}\) is the second treatment value; \(\bar A_{1i}=(A_{0i},A_{1i})\) is the history.
  • Putting the second treatment into \(\bar A_{0i}\). The history through visit 0 contains only \(A_{0i}\).
  • Using \(L_{1i}\) for baseline and later covariates together. \(L_{1i}\) is the covariate value at the later measurement; the history is \(\bar L_{1i}\).
  • Leaving the observation order implicit. A tuple such as \((L_{0i},L_{1i})\) is interpreted in visit order; rearranging entries changes what the tuple represents.
  • Treating the outcome as a treatment or covariate-history entry. Here \(Y_i\) is a separate final outcome, recorded after the two decisions.

The notation also has limits. If visits occur at irregular times, the subscript \(1\) alone may not record the elapsed time; the schedule or actual time variable must be supplied. If participants have different numbers of treatment decisions, two-visit notation does not describe every record without modification. And if a measurement's timing relative to treatment is unclear, no choice of subscripts can resolve that ambiguity: the study's measurement schedule must be clarified first.

Check Your Understanding

For each question, use the definitions in the two-visit schedule above. Solutions follow the questions so that the indexing can be checked directly.

  1. Write the treatment history through the second visit for participant 4, given \(A_{0,4}=1\) and \(A_{1,4}=0\). Which quantity is the current second treatment?
  2. If \(L_{0i}\) has three components and \(L_{1i}\) has two, how many scalar components are in \(\bar L_{1i}\)?
  3. A researcher writes \(\bar A_{0i}=(A_{0i},A_{1i})\). What is the indexing error, and what should \(\bar A_{0i}\) be?
  4. Write the chronological record when \(L_{0i}=4\), \(A_{0i}=1\), \(L_{1i}=6\), \(A_{1i}=0\), and \(Y_i=9\). State which part is the treatment history through visit 1.

Solutions. (1) \(\bar A_{1,4}=(1,0)\); the current second treatment is \(A_{1,4}=0\). (2) The history has \(3+2=5\) scalar components. (3) The expression includes the second-visit treatment in a history ending at visit 0; correctly, \(\bar A_{0i}=(A_{0i})\). (4) The chronological record is \((4,1,6,0,9)\); the treatment history is \(\bar A_{1i}=(1,0)\).

Clinical Biostats