Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Principal Curves as Self-Consistent Paths

Pseudotime and Trajectory Inference · Tutorial 355 of 700

Principal Curves as Self-Consistent Paths

Learn how a principal curve’s self-consistency condition extends the idea of a straight principal component to curved patterns of cell states.

Advanced 10 min read

What You'll Learn

  • Define a principal curve using conditional means at nearest-point projections.
  • Identify conditions needed for the projection and conditional expectation to be meaningful.
  • Verify self-consistency for a straight line and a curved synthetic pattern.
  • Distinguish a self-consistent curve from a variance-maximizing principal-component line.
  • Recognize ambiguity, branching, and curvature as sources of fitting problems.

From a Straight Axis to a Curved Path

A principal component summarizes variation along a straight direction. That can be a useful representation when cell states vary approximately along a line, but it can obscure a pattern that bends through expression space. A principal curve generalizes the geometric idea: instead of one straight axis, it uses a smooth path whose location at each point agrees with the average of cells projected there.

This definition is about the relationship between a curve and the distribution of observations, not about a known biological time variable. As in the earlier material on pseudotime as a relative ordering and choosing geometry for trajectory inference, a geometric path is a representation of cell-state variation; it does not by itself establish causal direction or elapsed time.

Definition: Let \(X\) be a random vector in \(\mathbb{R}^d\) with finite second moments, and let \(f\) be a smooth curve \(f(t)\in\mathbb{R}^d\). Define \(\lambda_f(X)\) as a parameter value at which the Euclidean distance from \(X\) to the curve is minimized. The curve is self-consistent if, for almost every parameter value \(t\) with respect to the distribution of \(\lambda_f(X)\), $$ f(t)=E[X\mid \lambda_f(X)=t]. $$ The conditional expectation is understood as a version of the conditional mean given the projection parameter. For a continuous parameter, this is not an ordinary conditional average over a positive-probability event.

The core condition says that the curve passes through the conditional mean of observations assigned to each of its locations. In applications, an estimated curve is only approximately self-consistent: finite samples, smoothing choices, and numerical fitting can leave discrepancies between the curve and these conditional means.

Conditions Behind the Definition

The definition relies on the projection being meaningful. A nearest point should exist for the observations considered, and the minimizing parameter should be unique with probability one, or a tie-breaking rule must be specified. If a cell is equally close to multiple parts of a curve, its projection is ambiguous and so is its contribution to a conditional mean. Finite second moments ensure that the relevant conditional means are defined when the conditioning groups have positive probability.

Smoothness helps describe a path rather than a disconnected collection of points, but it does not make the path biologically correct. In practice, one also wants to avoid self-intersections and implausible oscillations. Those properties are modeling choices and constraints, not consequences of self-consistency alone. In particular, more than one curve can satisfy the condition for the same distribution.

A straight principal-component line is a special geometric reference, but the two ideas optimize or require different things. Principal-component analysis chooses a direction that captures maximal variance among straight directions. Self-consistency instead requires the conditional mean at each projection location to lie on the curve. A curved path need not maximize any single linear variance, and a variance-maximizing line need not follow a curved pattern.

Worked Example: A Straight Self-Consistent Line

Consider hypothetical two-dimensional observations \(X=(T,T)+(\varepsilon,-\varepsilon)/\sqrt{2}\), where \(T\) takes values \(-0.2\) and \(0.2\) with equal probability, and \(\varepsilon\) is independent of \(T\), has mean zero, and has variance \(0.04\). Check the diagonal line \(f(t)=(t,t)\).

The unit tangent to the diagonal is \(u=(1,1)/\sqrt{2}\), and a unit normal is \(v=(1,-1)/\sqrt{2}\). The coordinates of \(X\) along these directions are \(u^\mathsf{T}X=\sqrt{2}T\) and \(v^\mathsf{T}X=\varepsilon\). The nearest point on the diagonal is therefore \(f(T)\): its parameter is \((X_1+X_2)/2=T\).

Given \(T=t\), independence and the zero mean of \(\varepsilon\) give \(E[X\mid T=t]=(t,t)\). Thus the line is self-consistent. Its variance along the unit tangent is \(2\operatorname{Var}(T)=2(0.04)=0.08\); its variance along the normal is \(\operatorname{Var}(\varepsilon)=0.04\). Thus, the diagonal is already the uniquely leading principal-component direction. If the normal perturbation instead has variance \(0.02\), its normal-coordinate variance is \(0.02\), while the tangent-coordinate variance remains \(0.08\).

Under that adjusted variance, the diagonal is both self-consistent and the leading principal-component line. The variance comparison matters: self-consistency alone does not establish that a line is the first principal component.

Why the Conditional-Mean Condition Holds for a Line

The straight-line case makes the defining condition easier to interpret. Let a line through the population mean \(\mu=E[X]\) have unit direction \(u\). The orthogonal projection coordinate is \(S=u^\mathsf{T}(X-\mu)\), and the nearest point on the line is \(\mu+Su\). The conditional mean at that coordinate is

$$ E[X\mid S] =\mu+uS+E\!\left[X-\mu-uS\mid S\right]. $$

Consequently, the line is self-consistent exactly when the conditional mean of the residual perpendicular to the line is zero:

$$ E\!\left[X-\mu-uS\mid S\right]=0. $$

This is the short justification for the line example: independent, mean-zero perpendicular noise has conditional mean zero at every value of \(S\). More generally, being a principal-component direction does not by itself guarantee this conditional-mean property for every possible distribution. It does hold under additional distributional conditions, such as a multivariate normal model with a principal-component direction: the perpendicular residual has zero covariance with the projection coordinate, and jointly normal uncorrelated components are independent.

Worked Example: A Curved Self-Consistent Arc

Consider a hypothetical arc of radius \(R=2\), with \(f(\theta)=2(\cos\theta,\sin\theta)\) for \(-\pi/3\leq\theta\leq\pi/3\). Let observations have the form \(X=(2+\varepsilon)(\cos\Theta,\sin\Theta)\), where \(\Theta\) takes values \(-\pi/3,0,\pi/3\), and, independently, \(\varepsilon\) is equally likely to be \(-0.2\) or \(0.2\).

The radial multiplier \(2+\varepsilon\) is positive. Each observation lies on the same ray from the origin as \(f(\Theta)\), and its nearest point on the specified arc is \(f(\Theta)\). The angle is within the arc’s range, so this projection is unique. At any supported angle \(\theta\),

$$ E[X\mid \Theta=\theta] =E[2+\varepsilon\mid\Theta=\theta](\cos\theta,\sin\theta) =2(\cos\theta,\sin\theta) =f(\theta). $$

For example, at \(\theta=0\) the two observations are \((1.8,0)\) and \((2.2,0)\). Their conditional mean is \(((1.8+2.2)/2,0)=(2,0)=f(0)\). The same calculation holds at the other two angles. Thus this curved arc is self-consistent for the stated synthetic distribution. The result depends on the radial perturbation having conditional mean zero and on observations projecting to their generating angles; it is not a general claim that arbitrary noise around a curve preserves self-consistency.

A Curved Pattern Need Not Have a Useful Straight Summary

A small synthetic example shows what a straight principal component can miss. Take three hypothetical points on the same radius-two arc, at angles \(-\pi/3,0,\pi/3\): \((1,-\sqrt{3})\), \((2,0)\), and \((1,\sqrt{3})\). Their sample mean is \((4/3,0)\). The sample covariance matrix is diagonal because the positive and negative vertical coordinates cancel in the cross-product.

$$ s_x^2=\frac{(-1/3)^2+(2/3)^2+(-1/3)^2}{3-1}=\frac{1}{3}, \qquad s_y^2=\frac{(-\sqrt{3})^2+0^2+(\sqrt{3})^2}{3-1}=3, \qquad s_{xy}=0. $$

The leading principal-component direction is vertical, since its sample variance is \(3\), compared with \(1/3\) horizontally. But the three observations form a curved arc. The vertical line through their mean does not pass through the outer points, and a straight-axis summary cannot represent the bend. The arc itself is self-consistent for this discrete distribution: each point projects to itself, and the conditional mean at each of its three projection locations is that point. This illustrates a difference in purpose, not a defect in principal-component analysis: PCA supplies a linear summary, while a principal curve can represent a curved center path.

Worked Example: Checking the Assumptions and Interpreting a Candidate

Suppose a hypothetical fitted curve is the radius-two arc in the previous example, and an observation is \(X=(2.1,0)\). Its closest point on the arc is \((2,0)\), so its projection angle is zero. In the radial-noise example, observations projected to zero were \((1.8,0)\) and \((2.2,0)\), whose conditional mean is \((2,0)\). The candidate therefore matches the conditional mean at this location.

This check supports local self-consistency for the stated synthetic model; it does not prove that the curve is the unique or best trajectory. If instead all observations projected near zero were shifted outward, for example to \((2.1,0)\) and \((2.3,0)\), their conditional mean would be \((2.2,0)\), not \((2,0)\). The candidate would fail the defining condition there. For a fitted curve, the analogous diagnostic is to compare locations on the curve with estimated conditional means of the cells projected nearby, allowing for finite-sample uncertainty and smoothing.

Diagnostics, Alternatives, and Limitations

A principal curve is most plausible when the data have one dominant, smoothly bending center path. Several checks help reveal when this representation is strained:

  • Large conditional-mean discrepancies: cells projected to a region have a mean systematically displaced from the fitted curve. This signals poor self-consistency, although small samples can make the estimated means noisy.
  • Unstable projections: small changes in the embedding or curve produce large changes in where cells project. Near self-intersections or closely neighboring curve segments, a unique and stable nearest point may not exist.
  • Branching or multiple pathways: a single path can average distinct directions into a misleading route. A branched trajectory requires a representation that permits branches rather than forcing one curve.
  • Endpoint effects: observations beyond a path’s ends may be assigned to endpoints, concentrating cells there and distorting the local conditional mean. Apparent endpoints should therefore be assessed rather than interpreted automatically as biological boundaries.
  • Excessive bending: a very flexible fit can follow sampling noise. A smooth-looking curve is not sufficient evidence that the underlying cell-state pattern truly bends that way.

Compared with a principal-component line, a principal curve can follow a smooth bend but requires choices about flexibility and can be less stable. Compared with a branching graph or tree representation, a single curve is simpler but cannot express genuine branching. The introductory material on choosing geometry for trajectory inference motivates matching the representation to the pattern; the defining condition here clarifies what a principal curve means once that choice has been made.

Self-consistency is not a guarantee of biological validity, a guarantee of uniqueness, or evidence that cells move along the curve in a particular direction. Results also depend on the space in which distances are measured: scaling or transforming features can change nearest projections and conditional means. A curve in a low-dimensional embedding represents structure in that embedding, not necessarily every feature of the original expression space. These limitations make diagnostics and sensitivity checks part of interpretation, not optional refinements.

Key takeaway: A principal curve is a smooth path whose value at each projection location equals the conditional mean of observations projecting there. A principal-component line is a special linear reference, but maximal variance and self-consistency are distinct properties.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. In one sentence, state the self-consistency condition for a curve \(f\).
  2. For a line \(f(s)=\mu+su\), with \(S=u^\mathsf{T}(X-\mu)\), what conditional-mean requirement makes the line self-consistent?
  3. In the curved-arc example, why does the radial perturbation preserve the conditional mean on the arc?
  4. Can a principal-component direction be assumed to be self-consistent for any distribution? Explain.
  5. Name one diagnostic sign that a single principal curve is a poor representation of the cell-state pattern.

Solutions. (1) For almost every projection parameter \(t\) with respect to the distribution of \(\lambda_f(X)\), \(f(t)=E[X\mid\lambda_f(X)=t]\). (2) The perpendicular residual must have conditional mean zero: \(E[X-\mu-uS\mid S]=0\). (3) The observations project to their generating angles, and the perturbation has conditional mean zero, so the conditional radial mean remains two. (4) No. A principal component maximizes variance among straight directions; self-consistency additionally requires the conditional perpendicular residual mean to vanish. (5) Examples include unstable nearest projections, large discrepancies between the curve and conditional means, or clear branching that a single path cannot express.

Clinical Biostats