From Two Marker Measurements to a Slope
A slope association uses the rate of change in a subject’s longitudinal marker trajectory, not just the marker’s level. In a shared random-effects model, that trajectory is represented by a subject-specific function \(m_i(t)\), and its instantaneous slope at time \(t\) is \(m_i'(t)\). In practice, marker values are often observed only at a small number of times. A natural calculation from two observations is a finite difference. The key question is what that calculation estimates: it is exactly a slope across an interval, but it is not generally the instantaneous slope at either endpoint.
When using observed marker values \(Y_i(t)\) in place of \(m_i(t)\), the corresponding calculation is \(\{Y_i(t_b)-Y_i(t_a)\}/(t_b-t_a)\). That calculation includes measurement error as well as change in the underlying trajectory. This distinction matters when a slope is used as a subject-specific predictor: an observed difference may be a noisy proxy for the latent derivative, rather than the derivative itself.
Symmetric Differences and Their Approximation Error
Suppose the target is the derivative at \(t_0\), and measurements are available at \(t_0-h\) and \(t_0+h\), where \(h>0\). The central finite difference is $$ D_{i,h}(t_0)=\frac{m_i(t_0+h)-m_i(t_0-h)}{2h}. $$ It is a secant slope across a symmetric interval, centered on \(t_0\). Its approximation quality depends on how the trajectory curves near that center.
Assume \(m_i\) has six continuous derivatives in a neighborhood of \(t_0\), so Taylor expansions through fifth order have remainders of order \(h^6\).
Use Taylor expansions about \(t_0\), retaining all terms through the fifth derivative and a remainder of order \(h^6\).
Even-power terms cancel; the third-derivative term gives the leading approximation error.
Subtracting the second expansion from the first cancels the constant, second-order, and fourth-order terms. The fifth-order terms add. Dividing by \(2h\) gives
Thus, for a smooth trajectory, the central difference’s leading bias as an approximation to the derivative is \(h^2m_i'''(t_0)/6\). The third derivative describes how the curvature changes locally. A smaller symmetric interval usually reduces this approximation error, but—as shown below—it can increase the effect of measurement error when the inputs are noisy observations.
With two times that are not symmetric around the target, there is no corresponding cancellation of even-power terms in general. The secant remains the average rate over its interval. If \(m_i\) is continuous on the interval and differentiable inside it, the mean value theorem ensures it equals \(m_i'(c)\) at some interior time \(c\); it does not say that \(c\) is a chosen target time or that the secant equals the derivative at either endpoint.
Worked Example: A Central Difference on a Curved Trajectory
Suppose a hypothetical subject’s latent marker trajectory, measured in marker units, is \(m_i(t)=10+1.2t+0.08t^2+0.01t^3\), with time \(t\) measured in months. Estimate the derivative at \(t_0=4\) months using observations at 3 and 5 months, and compare the estimate with the exact derivative.
The interval is symmetric with \(h=1\) month. Substitution into the trajectory gives \(m_i(5)=10+1.2(5)+0.08(25)+0.01(125)=19.25\) marker units and \(m_i(3)=10+1.2(3)+0.08(9)+0.01(27)=14.59\) marker units. Therefore, $$ D_{i,1}(4)=\frac{19.25-14.59}{5-3}=\frac{4.66}{2}=2.33\ \text{marker units per month}. $$
The derivative is \(m_i'(t)=1.2+0.16t+0.03t^2\), so \(m_i'(4)=1.2+0.64+0.48=2.32\) marker units per month. The central difference exceeds the derivative by \(0.01\) marker units per month. Here \(m_i'''(t)=0.06\), and the leading-error term predicts \(h^2m_i'''(4)/6=1(0.06)/6=0.01\), exactly the observed difference. The fifth derivative is zero for this cubic trajectory, so there are no higher-order terms in this calculation.
Irregular Observation Times and the Target of Interpretation
Longitudinal assessments are often irregularly spaced. Always divide by the actual elapsed time, not by an assumed visit interval. Even with the correct denominator, however, a finite difference may describe a broad interval rather than the derivative at a scientifically relevant time. The midpoint interpretation is especially clear for a quadratic trajectory: a secant across an interval equals the derivative at that interval’s midpoint. With more complex curvature, it need not equal the derivative at the midpoint either.
Worked Example: An Irregularly Spaced Secant
For a hypothetical trajectory \(m_i(t)=5+0.5t+0.2t^2\), measured in marker units with time in months, observations are taken at 1 and 5 months. Calculate the secant and compare it with the derivatives at the endpoints and midpoint.
The two trajectory values are \(m_i(1)=5+0.5(1)+0.2(1^2)=5.7\) and \(m_i(5)=5+0.5(5)+0.2(5^2)=12.5\) marker units. The time gap is \(5-1=4\) months, so $$ D_i(1,5)=\frac{12.5-5.7}{4}=\frac{6.8}{4}=1.70\ \text{marker units per month}. $$
The derivative is \(m_i'(t)=0.5+0.4t\). Thus \(m_i'(1)=0.90\), \(m_i'(3)=1.70\), and \(m_i'(5)=2.50\) marker units per month. The secant equals the derivative at the midpoint \(t=3\) for this quadratic, but it differs substantially from the derivatives at either observed time. Reporting 1.70 as the “slope at month 5” would therefore mislabel an interval-average slope as an endpoint derivative.
When observation times are asymmetric around a target, a finite difference can also be biased for that target even if the time gap is short. For a forward difference from \(t_0\) to \(t_0+h\), a Taylor expansion gives \( \{m_i(t_0+h)-m_i(t_0)\}/h=m_i'(t_0)+h m_i''(t_0)/2+O(h^2)\). Its leading error is first order in \(h\), compared with second order for a symmetric central difference. The central formula is not always available: near the start or end of follow-up, observations on both sides of a target may not exist.
Measurement Error and Sparse Data
Let the observed marker be \(Y_i(t)=m_i(t)+\epsilon_i(t)\), where the measurement error has mean zero and, for the calculation below, errors at the two times are independent with variance \(\sigma_\epsilon^2\). The observed finite difference is the latent secant plus the difference of the two errors divided by the time gap. Under these assumptions it is unbiased for the latent secant, but it is noisy:
The variance follows because the two independent error variances add in the numerator, while dividing by the gap divides variance by the squared gap. If errors are correlated, this expression changes: the numerator variance is \(\operatorname{Var}\{\epsilon_i(t_b)\}+\operatorname{Var}\{\epsilon_i(t_a)\}-2\operatorname{Cov}\{\epsilon_i(t_b),\epsilon_i(t_a)\}\). In particular, a very short interval can make a raw difference highly variable, even though reducing the interval decreases smooth-trajectory approximation error.
Worked Example: Noise Amplification Across a Short Gap
Suppose a hypothetical subject has latent marker values 8.0 and 8.5 units at 2.0 and 2.5 months. The recorded values are 8.1 and 8.7 units, respectively. Calculate the observed slope and identify how much of its difference from the latent secant comes from the stated errors.
The latent secant is \((8.5-8.0)/(2.5-2.0)=0.5/0.5=1.00\) marker unit per month. The observed secant is \((8.7-8.1)/(2.5-2.0)=0.6/0.5=1.20\) marker units per month. The errors are \(+0.1\) and \(+0.2\) marker units; their difference is \(0.2-0.1=0.1\) marker unit. Dividing that error difference by 0.5 months adds \(0.1/0.5=0.20\) marker units per month. Accordingly, the observed slope is \(1.00+0.20=1.20\) marker units per month. This is one realization of measurement error, not evidence that the underlying trajectory’s derivative is 1.20.
For illustration, if the measurement-error standard deviation were 0.2 marker units at each time and errors were independent, the slope’s conditional standard error from measurement error alone would be \(\sqrt{2(0.2^2)/(0.5^2)}=\sqrt{0.32}=0.566\) marker units per month. This large value shows why a raw two-point slope over a short gap can be unstable.
Using Finite Differences in a Slope Association
In a slope-based association, the hazard model’s marker-related term may use a quantity such as \(\alpha_s m_i'(t)\), where \(\alpha_s\) is the association parameter and \(m_i'(t)\) is the latent instantaneous slope on the specified time scale. Substituting a two-observation difference changes the predictor from an instantaneous latent slope to a noisy interval-average slope. Consequently, the estimated association need not have the same interpretation, and ordinary measurement error in a predictor can distort estimates.
A trajectory model offers an important alternative: estimate the subject-specific latent trajectory and obtain its derivative from that fitted function. This uses the assumed trajectory structure and can borrow information across a subject’s repeated measurements. It does not eliminate uncertainty; derivative estimates can be sensitive to model form, especially when the data are sparse or the trajectory is highly curved. A raw finite difference makes fewer trajectory-shape assumptions but can be much noisier and tied to a particular pair of assessment times.
| Approach | What it represents | Main advantage | Main concern |
|---|---|---|---|
| Two-time finite difference | Average change over the selected interval | Transparent calculation with few modeling assumptions | Depends on interval choice and magnifies measurement error, particularly for short gaps |
| Derivative of a fitted trajectory | Instantaneous slope of the modeled latent trajectory | Uses repeated data and can target a specific time | Depends on trajectory-model adequacy; sparse data may leave the derivative uncertain |
| One-sided finite difference | Average change over an interval on one side of the target | Can be calculated at a boundary without data on both sides | Usually has first-order approximation error and does not directly equal the boundary derivative |
A finite difference may still be useful as a descriptive summary or as a sensitivity analysis. Before treating it as a slope predictor, specify which two measurements define it, the time unit, and whether its intended interpretation is an interval average or an approximation to a derivative. If it is intended to approximate a derivative, justify why the selected interval is sufficiently local and why the trajectory is not changing curvature too sharply over it.
Diagnostics, Pitfalls, and Limits
Several practical checks can reveal when a finite-difference approximation is questionable:
- Check the time gap and units. A difference divided by days is not numerically interchangeable with one divided by months. Record the actual gap and report the slope in marker units per time unit.
- Compare plausible intervals. If slopes computed from nearby pairs change sharply as the interval changes, curvature, noise, or both may be important. This is a warning, not a test that identifies the cause.
- Inspect the observation pattern. Widely separated or irregular measurements may make the secant a poor proxy for a derivative at a particular time. Missing measurements near the target cannot be repaired merely by labeling a long-interval secant “local.”
- Assess measurement precision. A small time gap can amplify even modest differences in measurement error. Repeated observations and a fitted measurement-error model may be needed to distinguish trajectory change from noise.
- Be cautious at boundaries. A central difference requires times on both sides of its target. A one-sided difference is possible at a boundary but has different error properties and interpretation.
A common mistake is to calculate \(\{Y_i(t_b)-Y_i(t_a)\}/(t_b-t_a)\) and call it “the derivative at \(t_b\).” That reasoning confuses a finite-interval average with a pointwise rate. The correction is to call the quantity a secant or interval-average slope, state both times and the time units, and describe it as an approximation to a derivative only when the interval and trajectory smoothness make that interpretation reasonable. Neither a small interval nor a smooth fitted curve alone guarantees a reliable estimate when measurement error or model uncertainty is substantial.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- A marker rises from 12 to 15 units between months 4 and 7. What is the finite-difference slope, with units, and what does it describe?
- For a smooth trajectory, what derivative determines the leading error of a central difference, and what is the order of that error in \(h\)?
- Why can a short interval make an observed two-point slope less stable even as it improves the central-difference approximation for a smooth latent trajectory?
- When is it valid to say that a secant equals the derivative at some time in the interval? Does that identify the derivative at the right endpoint?
Solutions. (1) The slope is \((15-12)/(7-4)=3/3=1\) marker unit per month. It is the average rate of change over months 4 through 7, not necessarily the instantaneous slope at month 4 or month 7. (2) The leading error is \(h^2m_i'''(t_0)/6\), so it is of order \(h^2\); the third derivative captures changing curvature. (3) The central-difference approximation error decreases with \(h\) under smoothness, but independent measurement-error variance in the observed slope is \(2\sigma_\epsilon^2/(2h)^2\) when endpoints are \(t_0-h\) and \(t_0+h\). This variance increases as \(h\) decreases. (4) If the trajectory is continuous on the closed interval and differentiable in its interior, the mean value theorem guarantees equality to the derivative at some interior time. It does not identify that time as the right endpoint or as any other prespecified time.