Variance of a three-visit QALY total under AR(1) correlation

Gives the variance of a patient's 12-month QALY total, calculated by the trapezium rule from utilities at baseline, 6 and 12 months, when the utilities share a common variance sigma2 and follow AR(1) correlation with adjacent-visit correlation rho. It is the general double sum, sigma2 times the sum over all pairs of visits of w_j * w_k * r_jk, written out for three visits: the squared weights, plus twice the cross-products for the two adjacent pairs at rho and for the outer pair at rho^2.

Signature

Var_Q = sigma2 * (w_1^2 + w_2^2 + w_3^2 + 2 * (w_1 * w_2 * rho + w_2 * w_3 * rho + w_1 * w_3 * rho^2))
Inputs
InputsDefinitionUnit
sigma2Variance of utility at each visit, common to all visits; a standard deviation of 0.20 gives 0.04utility squared
w_1Weight of the baseline utility, half the interval to the next visit; 0.25 for a 6-month intervalyears
w_2Weight of the 6-month utility, half of each adjacent interval; 0.5 for two 6-month intervalsyears
w_3Weight of the 12-month utility, half the interval from the previous visit; 0.25 for a 6-month intervalyears
rhoCorrelation between utilities at adjacent visits; visits two steps apart have correlation rho^2correlation
Output
Var_QVariance of one patient's QALY total over follow-upQALYs squared

Function

Autoregressive correlation function for repeated health measurements

Maps the correlation between adjacent measurements on the same patient, and the distance between two measurements, to the correlation between them under a first-order autoregressive (AR(1)) structure. The correlation falls by the same factor with each step, so one parameter describes the whole within-patient correlation matrix. Combined with a common variance at every visit, the structure gives the variance of any weighted total or difference of the repeated measurements, such as a trial QALY total or a change in utility from baseline. In time-series notation the same pattern comes from the error process e_t = rho * e_(t-1) + u_t, which for a stationary series gives a correlation of rho^s between errors s periods apart.

Computational function

  • Computational function: AR(1) QALY variance and between-arm standard error for any visit schedule

    Takes a visit schedule in years, the utility variance at each visit, a correlation per year and the number of patients per arm, and returns the variance of each patient's QALY total and the standard error of the difference in mean QALYs between two arms. It derives the trapezium weights from the visit times, builds the continuous-time AR(1) correlation matrix of HE-FM-AR1-002 from the elapsed times, and evaluates the double sum behind HE-FM-AR1-003 for any number of visits. The inputs therefore differ from the formula's variables: the weights and the correlations are computed from the schedule rather than entered.

    Inputs and outputs: t: Vector of visit times in years, in increasing order and starting at baseline; required, at least two visits. Unit: years.; sigma2: Variance of utility at each visit; required, above zero. Unit: utility squared.; phi: Correlation between two utilities one year apart; required, above 0 and at most 1. Unit: correlation per year.; n: Number of patients per arm; required, a positive integer. Unit: patients.; w: Vector of trapezium weights, half of each adjacent interval, returned as an intermediate output. Unit: years.; Var_Q: Variance of one patient's QALY total. Unit: QALYs squared.; SE: Standard error of the difference in mean QALYs between two arms of n patients with equal variances, the square root of 2 * Var_Q / n. Unit: QALYs.

    Assumption: Utilities share a common variance at every visit, the correlation depends only on elapsed time, and patients are independent with complete utility data. The standard error assumes equal variances and equal arm sizes, as in the article's example. phi has to be above zero because elapsed times can be fractions of a year.

    Worked example (Three visits with 100 patients per arm): Visits at baseline, 6 and 12 months with a standard deviation of 0.20 and a correlation of 0.7 between visits six months apart (0.49 per year) reproduce the article's AR(1) variance of 0.03145 and standard error of about 0.0251. t = (0, 0.5, 1); sigma2 = 0.04; phi = 0.49; n = 100; w = (0.25, 0.5, 0.25); Var_Q = 0.03145; SE = 0.025080

    Worked example (Unequally spaced visits at 0, 3, 6 and 12 months): An extra 3-month visit changes the weights to 0.125, 0.25, 0.375 and 0.25, and with the same 0.49 per year the variance is about 0.03164. The figures are illustrative. t = (0, 0.25, 0.5, 1); sigma2 = 0.04; phi = 0.49; n = 100; w = (0.125, 0.25, 0.375, 0.25); Var_Q = 0.031645; SE = 0.025157

    Worked example (Perfect correlation limiting case): With phi equal to 1 every utility moves together, so the variance equals sigma2 times the squared length of follow-up, 0.04 for one year. This checks the implementation. t = (0, 0.5, 1); sigma2 = 0.04; phi = 1; n = 100; w = (0.25, 0.5, 0.25); Var_Q = 0.04; SE = 0.028284

    Excel: =Sigma2*SUMPRODUCT(B2:B4*TRANSPOSE(B2:B4)*Phi^ABS(A2:A4-TRANSPOSE(A2:A4))) With visit times in years in A2:A4, weights in B2:B4 from =(A3-A2)/2 in B2, =(A4-A2)/2 in B3 and =(A4-A3)/2 in B4, and named cells Sigma2 and Phi, the formula returns Var_Q in a cell named VarQ; =SQRT(2*VarQ/PatientsPerArm) returns SE. It needs dynamic-array Excel (Microsoft 365 or Excel 2021); earlier versions need Ctrl+Shift+Enter. Extending the ranges handles more visits, with each middle weight equal to half the distance between its neighbours.

    R: qaly_var_ar1 <- function(t, sigma2, phi, n) { k <- length(t); w <- (c(t[-1], t[k])-c(t[1], t[-k]))/2; v <- sigma2 * sum(outer(w, w) * phi^abs(outer(t, t, "-"))); c(var_q = v, se = sqrt(2*v/n)) } qaly_var_ar1(c(0, 0.5, 1), 0.04, 0.49, 100) returns 0.03145 and about 0.02508.

    Python: def qaly_var_ar1(t, sigma2, phi, n): k = len(t); w = [(t[min(j+1, k-1)]-t[max(j-1, 0)])/2 for j in range(k)]; v = sigma2*sum(w[a]*w[b]*phi**abs(t[a]-t[b]) for a in range(k) for b in range(k)); return w, v, math.sqrt(2*v/n) Uses the math module and returns the weights, Var_Q and SE.

    Test (Weights add up to the length of follow-up): The trapezium weights sum to the time from baseline to the last visit. Expected result: TRUE. Excel check: =ABS(SUM(B2:B4)-(A4-A2))<1E-12

    Test (Variance lies between the independence and perfect-correlation values): For phi from 0 to 1, Var_Q is at least sigma2 times the sum of squared weights and at most sigma2 times the squared sum of the weights. Expected result: TRUE. Excel check: =AND(VarQ>=Sigma2*SUMSQ(B2:B4),VarQ<=Sigma2*SUM(B2:B4)^2)

    Common error (Counting visit steps when visits are unequally spaced): In an illustrative 0, 3, 6, 12-month schedule, treating every step as a correlation of 0.7 gives the baseline and 12-month utilities a correlation of 0.343 rather than 0.49, and a QALY variance of about 0.02865 rather than 0.03164, about 9 per cent too low. Elapsed time, not visit number, belongs in the exponent.

    Source: Gabrio A, Plumpton C, Banerjee S, Leurent B. Linear mixed models to handle missing at random data in trial-based economic evaluations. Health Economics. 2022;31(6):1276-1287. Appendix C, which computes QALYs with weights equal to half the time between adjacent visits. Liang KY, Zeger SL. Biometrika. 1986;73(1):13-22. Section 4, Example 4, the continuous-time AR-1 working correlation for any number and spacing of observations.

    w_j = (t_(min(j+1, T)) - t_(max(j-1, 1))) / 2; Var_Q = sigma2 * sum_j sum_k w_j * w_k * phi^abs(t_j - t_k); SE = sqrt(2 * Var_Q / n)

Try this function

Implementations

  • Excel

    Three-visit QALY total variance under AR(1) in one cell

    With named cells Sigma2, W1, W2, W3 and AdjacentCorr, the formula returns the variance of the QALY total. The computational function on this page handles any number of visits.

    =Sigma2*(W1^2+W2^2+W3^2+2*(W1*W2*AdjacentCorr+W2*W3*AdjacentCorr+W1*W3*AdjacentCorr^2))

Assumptions

  • Trapezium weights for the AR(1) QALY total

    The QALY total is the area under the utility curve, a weighted sum of the visit utilities in which each weight is half of the adjacent intervals in years. Visits are equally spaced at 0, 6 and 12 months.

  • Common utility variance and complete visits for the AR(1) QALY variance

    Utility has the same variance at every visit and each patient's three utilities are observed. With incomplete follow-up, totals come from a likelihood model such as a linear mixed model under missing at random, and the assumed covariance then affects the estimated QALY difference as well as its variance.

Worked examples

  • QALY total variance with independent visits

    With zero correlation only the squared weights remain: 0.04 × 0.375 = 0.015, a standard deviation of about 0.122. This is the value an analysis that treats visits as independent would use.

    sigma2 = 0.04; w_1 = 0.25; w_2 = 0.5; w_3 = 0.25; rho = 0; Var_Q = 0.015
  • QALY total variance at an AR(1) correlation of 0.7

    The adjacent cross-products are 0.0875 each and the outer one 0.030625, each counted twice, so the bracket is 0.78625 and the variance 0.03145, a standard deviation of about 0.177.

    sigma2 = 0.04; w_1 = 0.25; w_2 = 0.5; w_3 = 0.25; rho = 0.7; Var_Q = 0.03145

Common errors

  • Treating repeated utility records as independent for the QALY standard error

    An analysis that models visit records as independent and uses model-based (naive) standard errors works with a QALY variance of 0.015 instead of 0.03145. With 100 patients per arm the standard error of the difference in mean QALYs is about 0.0173 instead of 0.0251, understated by about 31 per cent, giving a confidence interval about 70 per cent of its proper width. An independence working model in GEE with sandwich standard errors, or QALYs calculated per patient before comparing arms, avoids this.

  • Using rho for the outer pair in the AR(1) QALY variance

    Giving the baseline and 12-month pair the correlation rho instead of rho^2 turns the formula into the exchangeable one: 0.0325 instead of 0.03145 at rho = 0.7. The difference is small for a time-averaged total but grows for contrasts between distant visits, as in HE-FM-AR1-004.

Sources

  • QALYs as weighted combinations of visit utilities in trial analyses

    Gabrio A, Plumpton C, Banerjee S, Leurent B. Linear mixed models to handle missing at random data in trial-based economic evaluations. Health Economics. 2022;31(6):1276-1287. Methods and Appendix C, which obtain QALY differences as weighted linear combinations of the visit utilities with weights equal to half the time between adjacent visits.

    View source →

  • AR(1) covariance used in the QALY variance double sum

    Fitzmaurice GM, Laird NM, Ware JH. Applied Longitudinal Analysis. 2nd ed. Hoboken, NJ: Wiley; 2011. Covariance pattern models, including the first-order autoregressive pattern, which supply the covariance sigma2 * rho^abs(j-k) between visits entering the variance of a weighted sum.

    View source →

Canonical Identity

Stable URI · Machine-readable · Resolvable · CC BY 4.0