This vignette defines the models and historical borrowing metrics supported in the historicalborrowlong package.

Models

Definitions

Unless otherwise specified, Greek letters refer to parameters estimated by the model, and Roman letters refer to fixed hyperparameters and other constants set by the user in advance.

  • “Study”: a clinical trial. Could be a borrowed clinical trial from the past or a current clinical trial under analysis.
  • “Group”: a study arm, such as a treatment group or placebo group.
  • “Rep”: a repeated measure in the context of repeated measures / longitudinal modeling. Could be a time point such as a study visit.
  • kk: study index.
  • KK: index of the current study.
  • yky_k: vector of patient-by-rep clinical responses to a continuous outcome variable for study kk.
  • (X)k(X)_{k}: the row of matrix XX corresponding to study kk.
  • α\alpha: Vector of control group mean parameters, one for each rep for the pooled model, one for each study and rep in the hierarchical and independent models. The first elements are for the historical studies, and the last one is for the current study.
  • δ\delta: Vector of study-specific treatment mean parameters. There is one for each combination of study, non-control treatment group, and rep. An optional constraint may be added to pool all arms at baseline within each study, which reduces the number of elements of δ\delta.
  • dd: integer index for the elements of δ\delta.
  • bb: integer index for the elements of β\beta.
  • tt: index of a rep (e.g. time point of a repeated measure such as a patient visit in a clinical trial.)
  • β\beta: Vector of study-specific baseline covariate parameters.
  • XαX_\alpha: model matrix for the control group mean parameters α\alpha. It has indicator columns to select the appropriate element of α\alpha for each element of yky_k.
  • XδX_\delta: model matrix for the treatment mean parameters δ\delta. It has indicator columns to select the appropriate element of δ\delta for each element of yky_k.
  • XβX_\beta: model matrix for the baseline covariate fixed effect parameters β\beta. It has indicator columns to select the appropriate element of β\beta for each element of yky_k.
  • σk\sigma_k: Vector of rep-specific residual standard deviations for study kk.
  • Λk\Lambda_k: lower-triangular Cholesky factor of the by-rep residual correlation matrix for study kk.
  • NkN_k: number of patients in study kk.
  • Σk\Sigma_k: by-rep residual covariance matrix of study kk.
  • TT: number of repeated measures per subject.
  • ITI_T: identity matrix with rows and columns equal to the number of repeated measures per subject.
  • I()I(\cdot): indicator function
  • AR(1)(n,ρ)AR(1)(n, \rho): an AR(1) correlation matrix with nn rows and correlation parameter ρ\rho.
  • mkm_k index to indicate the type of residual covariance of study kk: 1 for unstructured / fully parameterized, 2 for AR(1), and 3 for diagonal.

Baseline covariates

The baseline covariates model matrix XβX_\beta adjusts for baseline covariates. It may contain a continuous column for baseline and binary indicator columns for the levels of user-defined covariates. All these columns are included if possible, but the method automatically drops baseline covariate columns to ensure that the combine model matrix Xk*=[Xα*Xδ*Xβ*]kX_k^* = \left [ {X_\alpha}^* \quad {X_\delta}^* \quad {X_\beta}^* \right ]_k is full rank, where Xk*X_k^* denotes the rows of matrix XX corresponding to study kk, with additional rows dropped if the corresponding elements of yy are missing. The choice of columns to drop from Xβk*{X_\beta}_k^* is determined by the rank and pivoting strategy of the QR decomposition of XkX_k using the Householder algorithm with pivoting (base::qr(), LINPACK routine DQRDC).

Separately within each study, each column of XβX_\beta is centered to have mean 0, and if possible, scaled to have variance 1. Scaling ensures that the priors on parameters β\beta remain relatively diffuse relative to the input data. Study-level centering ensures that the α\alpha parameters truly act as unconditional study-specific control group means (as opposed to conditional on the subset of patients at the reference level of XβX_\beta), and it ensures that borrowing across α\alpha components fully presents as control group borrowing.

Model matrices

Each primary model is parameterized thus:

E(y)=(Xα)kα+(Xδ)kδ+(Xβ)kβ \begin{aligned} E(y) = \left( X_\alpha \right)_k \alpha + \left ( X_\delta \right)_k \delta + \left ( X_\beta \right)_k \beta \end{aligned}

Above, (Xα)k\left (X_\alpha \right)_k, (Xδ)k\left (X_\delta \right)_k, and (Xβ)k\left (X_\beta \right)_k are fixed matrices for study kk. (Xβ)k\left (X_\beta \right)_k is a conventional model matrix for the baseline covariates β\beta, and the details are explained in the “Baseline covariates” section below. (Xα)k\left (X_\alpha \right)_k is a matrix of zeroes and ones. It is constructed such that each scalar component of α\alpha is the mean response of the control group in a particular study at a given time point. Likewise, (Xδ)k\left (X_\delta \right)_k is a matrix of zeroes and ones such that each scalar component of δ\delta is the mean response of a non-control treatment group in a particular study at a given time point.

To illustrate, let yijkty_{ijkt} be patient ii in treatment group jj (where j=1j = 1 is the control group) of study kk at time point tt, and let (Xββ)ijkt\left ( X_\beta \beta \right )_{ijkt} be the corresponding scalar element of the vector (Xβ)β\left ( X_\beta \right ) \beta. Then,

E(yijkt)=I(j=1)αkt+I(j>1)δjkt+(Xββ)ijkt \begin{aligned} E(y_{ijkt}) = I (j = 1) \alpha_{kt} + I (j > 1) \delta_{jkt} + \left ( X_\beta \beta \right )_{ijkt} \end{aligned}

In addition, if the constraint in the parameterization is activated (i.e. hbl_mcmc_hierarchical(constraint = TRUE)) then the control and treatment patients are pooled at time point t=1t = 1 within each study kk:

E(yijk1)=αk1+(Xββ)ijk1 \begin{aligned} E(y_{ijk1}) = \alpha_{k1} + \left ( X_\beta \beta \right )_{ijk1} \end{aligned}

This parameterization is represented in the more compact expression (Xα)kα+(Xδ)kδ+(Xβ)kβ\left( X_\alpha \right)_k \alpha + \left ( X_\delta \right)_k \delta + \left ( X_\beta \right)_k \beta in the model definitions in this vignette.

Post-processing

The hbl_summary() function post-processes the results from the model. It accepts MCMC samples of parameters and returns estimated marginal means of the response and treatment effect. To estimate marginal means of the response, hbl_summary() takes group-level averages of posterior samples of fitted values while dropping covariate adjustment terms from the model (i.e. Xαα+XδδX_\alpha \alpha + X_\delta \delta). Because the columns of XβX_\beta are centered at their means, this choice is mathematically equivalent to emmeans::emmeans() with the weights = "proportional" (Lenth (2016)).

Hierarchical model

Functions:

The hierarchical model analyzes the data from all studies and shrinks the control study-by-rep means αkt\alpha_{kt} (one scalar parameter for each unique combination of study and rep) towards a common normal distribution with mean μt\mu_t and variance τt2\tau_t^2. For each study in the data (both current and historical), the covariance is user-defined. Options include:

  1. Fully parameterized (“unstructured”) with a separation strategy with the LKJ prior to model within-subject correlations among residuals.
  2. AR(1) variances σk\sigma_k and correlation ρk\rho_k.
  3. Diagonal with variances σk\sigma_k.

ykMVN((Xα)kα+(Xδ)kδ+(Xβ)kβ,INkΣk)αktindNormal(μt,τt2)μtindNormal(0,sμ2)τtindfτδdtindNormal(0,sδ2)βbindNormal(0,sβ2)Σk=(ITσk)ΛkΛk(ITσk)σk1,,σkTindUniform(0,sσ)ΛkΛk{LKJ(shape=sλ,order=T)mk=1AR(1)(T,ρk)mk=2ITmk=3ρkindUniform(1,1)(only for mk=2) \begin{aligned} & y_k \sim \text{MVN}((X_\alpha)_k \cdot \alpha + (X_\delta)_k \cdot \delta + (X_\beta)_k \cdot \beta, \ I_{N_k} \otimes \Sigma_k ) \\ & \qquad \alpha_{kt} \stackrel{\text{ind}}{\sim} \text{Normal} (\mu_t, \tau_t^2) \\ & \qquad \qquad \mu_t \stackrel{\text{ind}}{\sim} \text{Normal}(0, s_\mu^2) \\ & \qquad \qquad \tau_t \stackrel{\text{ind}}{\sim} f_\tau \\ & \qquad \delta_{dt} \stackrel{\text{ind}}{\sim} \text{Normal} (0, s_\delta^2) \\ & \qquad \beta_{b} \stackrel{\text{ind}}{\sim} \text{Normal} (0, s_\beta^2) \\ & \qquad \Sigma_k = \left (I_T \sigma_k \right ) \Lambda_k \Lambda_k' \left (I_T \sigma_k \right ) \\ & \qquad \qquad \sigma_{k1}, \ldots, \sigma_{kT} \stackrel{\text{ind}}{\sim} \text{Uniform}(0, s_\sigma) \\ & \qquad \qquad \Lambda_k \Lambda_k' \sim \begin{cases} \text{LKJ}(\text{shape} = s_\lambda, \ \text{order} = T) && m_k = 1 \\ \text{AR(1)}(T,\rho_k) && m_k = 2 \\ I_T && m_k = 3 \\ \end{cases} \\ & \qquad \qquad \rho_k \stackrel{\text{ind}}{\sim} \text{Uniform}(-1, 1) \qquad (\text{only for } m_k = 2) \end{aligned}

The prior fτf_\tau on τ\tau is critically important because:

  1. It controls the prior amount of borrowing, and
  2. The prior has a large influence if there are few historical studies in the data.

fτf_\tau can either be a flexible half-Student-t distribution with dτd_\tau degrees of freedom and scale parameter sτs_\tau:

fτ=Student-t(0,sτ,dτ)+ f_\tau = \text{Student-t}(0, s_\tau, d_\tau)^+ or a uniform distribution with lower bound 0 and upper bound sτs_\tau:

fτ=Uniform(0,sτ) f_\tau = \text{Uniform}(0, s_\tau)

Following the recommendation of Gelman (2006), please use half-Student-t if the number of historical studies is small and consider uniform for large numbers of historical studies.

For the half-Student-t distribution, the role of the sτs_\tau parameter is equivalent to the σ\sigma parameter from the Student-t parameterization in the Stan user manual.

Independent model

Functions:

The independent model is the same as the hierarchical model, but with independent control group parameters α\alpha. We use it as a no-borrowing benchmark to quantify the borrowing strength of the hierarchical model.

ykMVN((Xα)kα+(Xδ)kδ+(Xβ)kβ,INkΣk)αktindNormal(0,sα2)δdtindNormal(0,sδ2)βbindNormal(0,sβ2)Σk=(ITσk)ΛkΛk(ITσk)σk1,,σkTindUniform(0,sσ)ΛkΛk{LKJ(shape=sλ,order=T)mk=1AR(1)(T,ρk)mk=2ITmk=3ρkindUniform(1,1)(only for mk=2) \begin{aligned} & y_k \sim \text{MVN}((X_\alpha)_k \cdot \alpha + (X_\delta)_k \cdot \delta + (X_\beta)_k \cdot \beta, \ I_{N_k} \otimes \Sigma_k ) \\ & \qquad \alpha_{kt} \stackrel{\text{ind}}{\sim} \text{Normal} (0, s_\alpha^2) \\ & \qquad \delta_{dt} \stackrel{\text{ind}}{\sim} \text{Normal} (0, s_\delta^2) \\ & \qquad \beta_{b} \stackrel{\text{ind}}{\sim} \text{Normal} (0, s_\beta^2) \\ & \qquad \Sigma_k = \left (I_T \sigma_k \right ) \Lambda_k \Lambda_k' \left (I_T \sigma_k \right ) \\ & \qquad \qquad \sigma_{k1}, \ldots, \sigma_{kT} \stackrel{\text{ind}}{\sim} \text{Uniform}(0, s_\sigma) \\ & \qquad \qquad \Lambda_k \Lambda_k' \sim \begin{cases} \text{LKJ}(\text{shape} = s_\lambda, \ \text{order} = T) && m_k = 1 \\ \text{AR(1)}(T,\rho_k) && m_k = 2 \\ I_T && m_k = 3 \\ \end{cases} \\ & \qquad \qquad \rho_k \stackrel{\text{ind}}{\sim} \text{Uniform}(-1, 1) \qquad (\text{only for } m_k = 2) \end{aligned}

Pooled model

Functions:

The pooled model is the same as the independent model, but with rep-specific control means pooled across studies. In other words αkt\alpha_{kt} loses the kk subscript, and we use a smaller matrix (Xαpool)k\left (X_\alpha^{\text{pool}} \right )_k instead of (Xα)k(X_\alpha)_k. (Xαpool)k\left (X_\alpha^{\text{pool}} \right )_k has fewer columns (rep-specific rather than study-by-rep-specific). Like the independent model, we use it as a no-borrowing benchmark to quantify the borrowing strength of the hierarchical model.

ykMVN((Xαpool)kα+(Xδ)kδ+(Xβ)kβ,INkΣk)αtindNormal(0,sα2)δdtindNormal(0,sδ2)βbindNormal(0,sβ2)Σk=(ITσk)ΛkΛk(ITσk)σk1,,σkTindUniform(0,sσ)ΛkΛk{LKJ(shape=sλ,order=T)mk=1AR(1)(T,ρk)mk=2ITmk=3ρkindUniform(1,1)(only for mk=2) \begin{aligned} & y_k \sim \text{MVN}((X_\alpha^{\text{pool}})_k \cdot \alpha + (X_\delta)_k \cdot \delta + (X_\beta)_k \cdot \beta, \ I_{N_k} \otimes \Sigma_k ) \\ & \qquad \alpha_{t} \stackrel{\text{ind}}{\sim} \text{Normal} (0, s_\alpha^2) \\ & \qquad \delta_{dt} \stackrel{\text{ind}}{\sim} \text{Normal} (0, s_\delta^2) \\ & \qquad \beta_{b} \stackrel{\text{ind}}{\sim} \text{Normal} (0, s_\beta^2) \\ & \qquad \Sigma_k = \left (I_T \sigma_k \right ) \Lambda_k \Lambda_k' \left (I_T \sigma_k \right ) \\ & \qquad \qquad \sigma_{k1}, \ldots, \sigma_{kT} \stackrel{\text{ind}}{\sim} \text{Uniform}(0, s_\sigma) \\ & \qquad \qquad \Lambda_k \Lambda_k' \sim \begin{cases} \text{LKJ}(\text{shape} = s_\lambda, \ \text{order} = T) && m_k = 1 \\ \text{AR(1)}(T,\rho_k) && m_k = 2 \\ I_T && m_k = 3 \\ \end{cases} \\ & \qquad \qquad \rho_k \stackrel{\text{ind}}{\sim} \text{Uniform}(-1, 1) \qquad (\text{only for } m_k = 2) \end{aligned}

Borrowing metrics

The package supports the following metrics to quantify borrowing. Various functions in historicalborrowlong compute each of the following metrics independently for each discrete time point (“rep”).

Effective sample size (ESS)

See the hbl_ess() function for an implementation.

Neuenschwander et al. (2006) posit a prior effective sample size metric for meta-analytic predictive (MAP) priors. In the original paper, the underlying hierarchical model only uses historical controls, and the hypothetical new study is the current study of interest. In historicalborrow, we adapt this metric to a hierarchical model which also includes both control and treatment data from the current study. We still define NN below to be the number of (non-missing) historical control patients so we can still interpret ESS on the same scale as in the paper.

For the pooled model, define V0V_0 to be the posterior predictive variance of the control mean α*\alpha^* of a hypothetical new unobserved study. According to Neuenschwander et al. (2006), it can be derived as an average of study-specific variances. In practice, we estimate V0V_0 using the average of MCMC samples of 1σi2\frac{1}{\sum \sigma_i^{-2}}.

V0:=Var(α*|y,τ=0)=1σi2 V_0 := \text{Var}(\alpha^* | y, \tau = 0) = \frac{1}{\sum \sigma_i^{-2}}

For the hierarchical model, we define the analogous posterior predictive variance VτV_\tau using the prior distribution

Vτ:=Var(α*|y)=E[(α*E(α*|y))2|y]p(α*|μ,τ)p(μ,τ|y)dμdτ V_\tau := \text{Var}(\alpha^* | y) = \int E[(\alpha^* - E(\alpha^*|y))^2 | y] \cdot p(\alpha^* | \mu, \tau) \cdot p(\mu, \tau | y) d\mu d\tau

The above integral implies a straightforward method of estimating VτV_\tau using MCMC samples:

  1. For each MCMC sample m=1,,Mm = 1, \ldots, M from the hierarchical model, identify samples μ(m)\mu^{(m)} and τ(m)\tau^{(m)} of μ\mu and τ\tau, respectively.
  2. Draw (α*)m(\alpha^*)^{m} from a Normal(μ(m)\mu^{(m)}, (τ(m))2(\tau^{(m)})^2) distribution.
  3. Estimate VτV_\tau as the variance of the collection (α*)1,(α*)2,,(α*)M(\alpha^*)^{1}, (\alpha^*)^{2}, \ldots, (\alpha^*)^{M} from (2).

Next, define NN as the number of non-missing control patients from the historical studies only. Given NN, V0V_0, and VτV_\tau, define the effective sample size as:

ESS:=NV0Vτ \text{ESS} := N \frac{V_0}{V_\tau}

V0Vτ\frac{V_0}{V_\tau} is a weight which quantifies the fraction of historical information that the hierarchical model leverages for borrowing. Notably, the weight should be 1 if the hierarchical and pooled model exhibit the same strength of borrowing. Multiplied by NN, the quantity becomes a heuristic for the strength of borrowing of the hierarchical model, measured in terms of the number of historical patients.

Precision ratio (hierarchical model only)

The precision ratio is an experimental ad hoc metric and should be used with caution. It is implemented in the hbl_summary() function for the hierarchical model.

The precision ratio compares the prior precision of a control mean response (an α\alpha component, numerator) to the analogous precision of the full conditional distribution (denominator). The former is 1τ2\frac{1}{\tau^2}, and the latter is 1τ2+nσ2\frac{1}{\tau^2} + \frac{n}{\sigma^2}. Here, nn is the number of non-missing patients in the current study, σ2\sigma^2 is the residual variance, and τ2\tau^2 is the variance of study-specific control means (components of α\alpha). The full precision ratio is:

1τ21τ2+nσ2 \begin{aligned} \frac{\frac{1}{\tau^2}}{\frac{1}{\tau^2} + \frac{n}{\sigma^2}} \end{aligned}

The precision ratio comes from the conditional distribution of αk\alpha_k in the hierarchical model given the other parameters and the data. More precisely, in this conditional distribution, the mean is a weighted average between the prior mean and data mean, and the precision ratio is the weight on the prior mean. This can be seen in a simpler case with a Bayesian model with a normal data model, a normal prior on the mean, and known constant variance. For details, see Chapter 2 of Gelman et al. (2020).

Variance shift ratio

The variance shift ratio is an experimental ad hoc metric and should be used with caution. It is implemented in the legacy hbl_metrics() function.

Let VmV_m be the estimated posterior variance of αI\alpha_I (current study control group response mean) estimated by model mm. The variance shift ratio is:

Vm*VindependentVpoolVindependent \begin{aligned} \frac{V_{m*} - V_{\text{independent}}}{V_{\text{pool}} - V_{\text{independent}}} \end{aligned}

where m*m* is a historical borrowing model like the mixture model or hierarchical model.

Mean shift ratio (legacy)

The mean shift ratio is not recommended to measure the strength of borrowing. Rather, it is an informal ad hoc measure of the lack of commensurability between the current and historical data sources. It is implemented in the legacy hbl_metrics() function.

To define the mean shift ratio, let θm\theta_m be the posterior mean control group response estimated by model mm. The mean shift ratio is:

θm*θindependentθpoolθindependent \begin{aligned} \frac{\theta_{m*} - \theta_{\text{independent}}}{\theta_{\text{pool}} - \theta_{\text{independent}}} \end{aligned}

where m*m* is a historical borrowing model like the mixture model or hierarchical model.

References

Gelman, A. 2006. “Prior Distributions for Variance Parameters in Hierarchical Models.” Bayesian Analysis 1 (3): 515–43. https://doi.org/10.1214/06-BA117A.
Gelman, A., J. B. Carlin, H. S. Stern, D. B. Dunson, A. Vehtari, and D. B. Rubin. 2020. Bayesian Data Analysis. 3rd ed. CRC Press.
Lenth, Russell V. 2016. “Least-Squares Means: The r Package Lsmeans.” Journal of Statistical Software 69 (1): 1–33. https://doi.org/10.18637/jss.v069.i01.
Neuenschwander, B., G. Capkun-Niggli, M. Branson, and D. J. Spiegelhalter. 2006. “Summarizing Historical Information on Controls in Clinical Trials.” Bayesian Analysis 1 (3): 515–43. https://doi.org/10.1214/06-BA117A.