 Research
 Open access
 Published:
Estimation of marginal structural models under irregular visits and unmeasured confounder: calibrated inverse probability weights
BMC Medical Research Methodology volume 23, Article number: 4 (2023)
Abstract
Clinical information collected in electronic health records (EHRs) is becoming an essential source to emulate randomized experiments. Since patients do not interact with the healthcare system at random, the longitudinal information in large observational databases must account for irregular visits. Moreover, we need to also account for subjectspecific unmeasured confounders which may act as a common cause for treatment assignment mechanism (e.g. glucoselowering medications) while also influencing the outcome (e.g. Hemoglobin A1c). We used the calibration of longitudinal weights to improve the finite sample properties and to account for subjectspecific unmeasured confounders. A Monte Carlo simulation study is conducted to evaluate the performance of calibrated inverse probability estimators using timedependent treatment assignment and irregular visits with subjectspecific unmeasured confounders. The simulation study showed that the longitudinal weights with calibrated restrictions improved the finite sample bias when compared to the stabilized weights. The application of the calibrated weights is demonstrated using the exposure of glucose lowering medications and the longitudinal outcome of Hemoglobin A1c. Our results support the effectiveness of glucose lowering medications in reducing Hemoglobin A1c among type II diabetes patients with elevated glycemic index (\(\ge 8.5 \%\)) using stabilized and calibrated weights.
Introduction
Prospective randomized experiments are conducted to evaluate the effectiveness of an intervention. However, in the absence of controlled experiments, large data repositories may provide an alternative source to emulate the randomized experiment with the intention to draw causal inference pertaining to the effectiveness of an intervention [1]. Longitudinal data can be collected at fixed (or prespecified) time points or irregular time points during the study followup. For example, a randomized controlled study may prespecify the fixed followup visits in advance at regular time points, while the data collection at unequally spaced visit times in an observational data repository may be related to the outcome. Since patients do not interact with the health care system at random, the longitudinal information collected in electronic health records (EHRs) tend to exhibit bias in the form of informative visit regimen [2]. For example, the data collected in EHRs may correspond to an overrepresentation of patient population with severe or worse disease symptoms when patients are only visiting the clinic with the acute onset of new medical ailment or the management of preexisting chronic condition. The outcomes and the visits in discrete timeintervals may be correlated in which case the application of standard regression model (e.g. generalized estimating equations) generates biased estimation [3, 4]. To correct for this, Pullenayegum and Lim [5] outlined two methods to handle longitudinal data with irregular visits: (i) inverseintensity weighting and (ii) modelbased approach using correlated random effects between the visits and the outcome. Inverseintensity weighting method uses the measured covariates to capture the correlation between the visit and outcome processes. Similarly, the semiparametric method assumes the dependency between the visits and outcome through baseline covariates and timevarying latent factors.
Pullenayegum and Lim [5] describe four categories of visit process: (i) fixed visits, (ii) historydependent protocol visit, (iii) physiciandriven visit, (iv) patientdriven visit. We limit the focus of this article to “historydependent protocol visit” in which the protocol specify when the visits should be, but the intervals between visits are allowed to depend on patients’ previously observed history [5]. As an example, we may specify the covariatedependent irregular visits are more frequent in the presence of confounding factors [5]. In our context, historydependent protocol visit is a reasonable assumption for the management of patients with diabetes, since the patients are expected to visit the primary care clinic routinely depending on their health status, and as recommended by Diabetes Canada guidelines [6]. We describe the irregular visits as the presence of missed visits that do not take place within an interval (i.e. missed visits). We use nonoverlapping intervals to discretise the continuoustime processes, and we conceptualize treatment, confounder and outcome as random variables that evolve with study followup. We assume that the historydependent protocol visit characterize the missing at random mechanism in which the missing outcome is not dependent on current and future outcome conditional on the past outcome and covariates [5]. We may quantify the extent of visit irregularity by examining the deviation from perfect repeatmeasures (i.e. one visit per time interval) using the proportion of missed visits within each time intervals [7].
In the context of longitudinal causal inference, Hernán et al. [8] considered subjectspecific visit times using a static observation plan with prespecified regular times and dynamic observation plan with irregular visit occurrence due to clinical evolution of patients. Hernán et al. [8] demonstrated the need to account for selection bias and confounding arising in estimation of the effects of a dynamic treatment regime. The dependence between the outcome and the visit can arise under various combinations including: (i) conditional independence given past outcomemodel covariates, (ii) conditional independence given past observationtime model covariates, (iii) conditional independence given shared latent variables [9]. In this article, the dependence between the treatment and the outcome is induced by an unmeasured (subjectspecific) confounder, and thereby treatment is assumed to influence the outcome after conditioning on the observed history [10].
Regression models may yield biased estimation of longitudinal causal effect of timevarying treatment in the presence of timevarying confounder and treatmentconfounder feedback [11]. In particular, selection bias is introduced when standard methods (e.g. generalized estimating equations) are used to adjust for the effect of timedependent confounding. The existence of treatmentconfounder feedback (i.e. past treatment affects the current confounder which affects the current treatment) requires the use of causal inference methods to estimate the causal effect of timedependent treatment [12]. In addition to treatmentconfounder feedback, the longitudinal data collected in EHRs may also contain additional feedback with respect to visitconfounder where the past visit affects the current confounder which affects the future visit. Marginal structural models using inverseprobability weights with respect to treatment and visit account for such temporal feedback, and provide consistent estimates of marginal causal effects with correct model specification and without unmeasured confounding factors.
Knowledge gap and motivating example
To our knowledge, the simultaneous existence of treatmentconfounder and visitconfounder feedback with unmeasured confounder for each subject in longitudinal settings has not been considered in the causal inference literature. The cumulativetime weights with respect to treatment and visit account for this feedback. Moreover, the treatment weights and visit weights are calibrated to make the nonprobability (i.e. observational) sample similar to the target population. In this article, we extend the earlier work by Yiu and Su [13]) in twofolds: (i) extending calibration of longitudinal weights to irregular visits, (ii) incorporating unmeasured confounder for each subject in longitudinal design. The application of this method is demonstrated to assess the effectiveness of glucose lowering medications among diabetes patients with elevated glycemic index (Hemoglobin A1c \(\ge 8.5 \%)\).
Methods
Notation
A framework for longitudinal causal inference is considered for n individuals \((i=1,...,n)\) in \(m_i\) timeintervals \((j=1,...,m_i)\). An equally spaced time interval is denoted as \(\{T_{i1}< ... < T_{ik_i}\}\). The timedependent binary treatment is denoted as \(A_i(T_{ij})=A_{ij}\), timedependent binary confounder is denoted as \(L_i(T_{ij})=L_{ij}\), the occurrence of visit is denoted as \(V_i(T_{ij})=V_{ij}\), the continuous outcome is denoted as \(Y_i(T_{ij})=Y_{ij}\). The vector of baseline covariates for individual i is denoted as \(X_{i}\). The latent confounder \(\eta _i\) is defined as a common cause of treatment \(A_{ij}\) and outcome \(Y_{ij}\) for individual i. In some instances, the index for individual i is suppressed because it is assumed that the random vector for each individual i is drawn independently with respect to other individuals. The cumulative treatment status \(\bar{A}_{ij}\), cumulative confounder status \(\bar{L}_{ij}\), cumulative visit status \(\bar{V}_{ij}\) denotes the complete history of each factor up to and including visit j. As an example, \(\bar{A}_{ij}= \{A_{i0},A_{i1},...A_{ij}\}\); \(\bar{L}_{ij}= \{L_{i0},L_{i1},...L_{ij}\}\); \(\bar{V}_{ij}= \{V_{i0},V_{i1},...V_{ij}\}\). We denote observed history as \(\bar{{H}}_{j1} \equiv \{\bar{V}_{j1}, \bar{Y}_{j1}, \bar{L}_{j1},\bar{A}_{j1},X\}\). We introduce \(Y^{\bar{a},\bar{v}}_j\) and \(L_j^{\bar{a},\bar{v}}\) as potential outcome and potential confounder (respectively) under treatment regime \(\bar{a}\) and visit regime \(\bar{v}\) with respect to the \(j^{th}\) visit.
Marginal structural model
The marginal causal effects of treatment are specified through a parametric marginal structural model with respect to the longitudinal outcome as
where \(Y_j^{\bar{a},\bar{v}}\) is the potential outcome indexed with respect to hypothetical treatment \(\bar{a}\) and hypothetical visit \(\bar{v}\). The link function is represented using an identity function \(g^{1}(\cdot )\). We assume a rankpreserving model in which the net change in potential outcome (i.e. \(E( Y_j^{\bar{a},\bar{v}}  \bar{{H}}^*_{j1})\)) is preserved with respect to the treatment and visit for all subjects (i.e. absence of effect modification) [14]. In the context of EHRs, the causal contrast correspond to net change in HbA1c with respect to glucoselowering medications. We are interested in accounting for three sources biases that distort the causal estimator: (i) measured confounding arising due to timedependent covariates, (ii) selection bias arising due to irregular visits (i.e. missing at random), and (iii) subjectspecific unmeasured confounder.
We use the generalized estimating equations with inverse probability weights to obtain an estimate of the marginal treatment effect with respect to timedependent covariates. We describe the marginal structural model using the score function of weighted generalized estimating equations as
where \(SW_i\) are the inverse probability weights with stabilizing factor, \(\nu _i\) is the working covariance matrix of \(Y_i\) and it is specified through working correlation matrix \(R(\alpha )\), and \(\mu _i(\beta )\) is the mean vector. The correct specification of the correlation matrix \(R(\alpha )\) improves the efficiency of estimation while misspecification may still lead to consistent estimators.
The longitudinal weights with stabilization factor are constructed to account for treatmentconfounder and visitconfounder feedback as
where the product terms are defined over cumulative discretetime intervals. The observed partial history with the exclusion of timedependent covariates for treatment and visits is denoted as \(\bar{{H}}^*_{j1}\) and \(\bar{{H}}^{**}_{j1}\). Since the timevarying treatment \(A_j\) and timevarying visit \(V_j\) are statistically endogenous, the stabilized inverse probability treatment weights \(SW^{\bar{A}}_t\), stabilized inverse probability visit weights \(SW^{\bar{V}}_t\) and joint inverse probability weights \(SW^{\bar{A},\bar{V}}_t\) are required to estimate the marginal causal effect of glucoselowering medications on hemoglobin A1c. The stabilized treatment weights are used to create a pseudopopulation in which the imbalance for timedependent covariates across treatment groups is reduced. The stabilized visit weights are used to create a pseudopopulation in which the selection bias due to irregular visits (missing at random) is reduced. The pseudopopulation generated using the joint weights \(SW^{\bar{A},\bar{V}}_t\) incorporate both sources of biases (i.e. confounding bias and selection bias).
Assumptions
Longitudinal causal inference with timevarying treatment use the sequential version of identifiability assumptions: (i) latent sequential exchangeability, (ii) sequential postivity and (iii) sequential consistency. The sequential exchangeability assumption is an extension of conditional exchangeability (or no unmeasured confounding) assumption where the probability of treatment assignment and visit occurrence at \(j^{th}\) visit depends on past treatment, past visit and covariate history, and conditional on these factors the potential outcome and potential confounder is independent of the treatment assignment. The latent sequential exchangeability assumption (or equivalently latent ignorability assumption) can be described as
The sequential positivity assumption is defined as a nonzero probability of treatment assignment and observed visit at each time interval j given the history \(\bar{{H}}_{j1}\). We describe sequential positivity as \(P(A_j \bar{{H}}_{j1}) >0\) and \(P(V_j \bar{{H}}_{j1}) > 0\) for \(\forall \bar{a}, \bar{v}\). The sequential consistency assumption links the potential outcome \(Y_j^{\bar{a},\bar{v}}\) and confounder \(L_j^{\bar{a},\bar{v}}\) to the observed outcome and confounder as
If causal identifiability assumptions are satisfied then an observational study can be used to mimic a randomized experiment with the limitation that the conditional probability of treatment assignment is unknown and need to be estimated using the data in an observational study. It is further assumed that the administrative censoring \(C_{ij}\) is noninformative where censoring is independent of observation times \(T_{ij}\) and longitudinal outcome \(Y_{ij}\) conditioned on history \(\bar{{H}}_{j1}\) as \(C_{ij} {\perp \! \! \! \perp } \{Y_{ij},T_{ij}\}  \{ \bar{{H}}_{j1}, \eta _{i}\}\).
Calibration of inverse probability weights
We motivate the application of calibrated longitudinal weights to estimate the causal effects of glucose lowering medications on hemoglobin A1c. Calibration has been used in causal inference framework to estimate the average treatment effect when regularizing highdimensional covariates with lasso penalty [15], to minimize the variance of calibrated weights [16], to improve the finite sample properties of maximum likelihood estimation [17], to account for unmeasured clusterlevel confounders [18].
Under finite longitudinal sample, stabilized inverse probability weights may not remove the associations between timedependent treatment \(A_{ij}\) and timedependent covariate \(\bar{L}_{ij}\) conditional on past treatment regimen \(\bar{A}_{ij1}\). There may still exist chance imbalances and residual confounding of covariates in the pseudopopulation (weighted using \(SW_{ij}^A\) or \(SW_{ij}^V\)) and this may contribute to finite sample estimation errors [19]. The sample estimation errors may further become exacerbated when the treatment model or the visit model are misspecified. In this article, the longitudinal inverse probability treatment and visit weights are calibrated to account for (i) associations between treatment regimen and timedependent covariates, (ii) associations between irregular visits and timedependent covariates, (iii) unmeasured subjectspecific (i.e. timeinvariant) confounder. The purpose of calibrating the longitudinal weights is to improve the small sample properties of the longitudinal weights [17], while accounting for the unmeasured subjectspecific confounder and irregular visits.
The calibration restrictions are employed on inverse probability weights to make the treatment assignment unassociated with the history of the timevarying covariates at each time interval in the pseudopopulation. Yiu and Su [17] proposed the calibrated inverse probability weights to improve estimation errors under finite samples using maximum likelihood estimation. Similar to Yiu and Su [17], we calibrate the treatment and visit inverse probability weights using the maximization of weighted loglikelihood functions:
after weighting the sample as
where \(c(\bar{L}_{ij},{\lambda } )\) is the calibration function and reduces to one when the vector of coefficients \({\lambda }=0\) (i.e. \(c(\bar{L}_{ij},{\lambda =0})=1)\). We assume a nonnegative parametric form of \(c(\bar{L}_{ij},{\lambda } )= exp(K\lambda )\), where the matrix \(K \in \mathbb {R}^{N \times r}\) includes the datadependent restrictions with \(N=\sum _{i=1}^n m_i\) observations and r columns. The unknown vector of \(\lambda \in \mathbb {R}^{r}\) is estimated using the calibration of inverse probability treatment and visit weights.
In similar spirit to Yiu and Su [20], the regression coefficient \(\alpha _w\) of treatment model are partitioned into \(\{\alpha _b,\alpha _d\}\), where \(\alpha _b\) characterize the baseline distribution (e.g. intercept term) and \(\alpha _d\) characterize the dependence of treatment assignment and covariates. Likewise, the regression coefficients of irregular visits \(\omega _w\) are partitioned into \(\{\omega _b, \omega _d\}\) with the same convention. We maximize the weighted loglikelihood function with respect to \(\lambda\) through a score equation
where the innermost index k accumulates over j time intervals. The dependence of treatment \(A_{ij}\) with the timedependent covariates \(\bar{L}_{ij}\) is represented as \(\alpha _d\) and it is constrained to be zero while the vector of treatment coefficients (excluding timedependent covariates) is represented as \(\alpha _b\) and it is set to the maximum likelihood estimates \(\hat{\alpha }\). In addition to calibrated treatment weights, the visit weights are calibrated to reduce the association between irregular visits and timedependent covariates through a score equation
where the vector of regression coefficients \(\omega _{d}=0\) denote the independence of timedependent covariate \(\bar{L}_{i,j1}\) and irregular visits \(V_{ij}\) (constrained to be zero) while \(\omega _b=\hat{\omega }\) is set to maximum likelihood estimates \(\hat{\omega }\).
In both score Eqs. (3) and (4), we notice that the calibrated weights (i.e. \(SW_{ij}^A(\lambda )\) and \(SW_{ij}^V(\lambda )\)) are used to weight the likelihood of treatment model and visit model (respectively) for the \(i^{th}\) patient up to and including the time interval j. The calibration restrictions are inverted to estimate the values of unknown coefficients \(\lambda\). The calibration restrictions using \(\{\alpha _d=0\}\) and \(\{\omega _d=0\}\) ensures that the treatment assignment and irregular visits are statistically exogenous with respect to the timedependent covariates. Since the covariate balancing restrictions reduce the dependence for treatment assignment and irregular visits with respect to the functional covariate history \(\tilde{L}_{ij}\), we may represent the modelbased restrictions (derived in Appendix Section) as
and
where the modelbased propensity scores for treatment model \(\hat{e}_{ik}^A\) and visit model \(\hat{e}_{ik}^V\) are estimated as \(\hat{e}_{ij}^A=P_{\alpha }(A_{ij} \bar{H}_{j1}^*)\) and \(\hat{e}_{ij}^V=P_{\omega }(V_{ij} \bar{H}_{j1}^*)\). The modelbased covariate balancing restrictions are accumulated with respect to longitudinal observations. The residuals for treatment (i.e. \(A_{ij}  \hat{e}_{ij}^A\)) and irregular visit (i.e. \(V_{ij}  \hat{e}_{ij}^V\)) are set to be orthogonal with respect to the functional history of timedependent covariates \(\tilde{L}_{ij}\) (including intercept term) in the pseudopopulation defined using the calibrated weights.
Unity mean restrictions
The stabilized inverse probability weights used in the pseudolikelihood function of marginal structural models tend to satisfy the property of unity mean at each time interval (i.e. \(E(SW_{j}^A)=E(SW_{j}^V)=1 \ \forall j\)) [21]. However, this property is not guaranteed to hold for calibrated inverse probability weights. Thus, in addition to the covariate balancing score constraints, we further impose the restrictions for average calibrated weights to be one at each time interval as
The average treatment weights and visit weights are constrained to be equal to one at each time interval to stabilize the longitudinal weights and to prevent trivial solutions of zero (or negative weights) during the calibration procedure.
Timeinvariant latent restrictions
In the presence of subjectlevel unmeasured confounder \(\eta _i\), the exposed and the unexposed subjects (with respect to treatment) are not conditionally exchangeable given \(\bar{H}_{j1}\) because noncausal association between \(\bar{A}_{j}\) and \(Y_{j}\) cannot be blocked by conditioning on measured history \(\bar{H}_{j1}\). We derive the balancing constraints for subjectspecific unmeasured confounder in the context of repeatedmeasures longitudinal outcomes in Appendix Section. We obtain the empirical constraints to account for the unmeasured individuallevel confounder \(\eta _i\) using treatment \(A_{ij}\) as
and using visit \(V_{ij}\) as
The empirical constraints in Eqs. (5) and (6) are sufficient to describe the covariate balancing restrictions with respect to the timeinvariant latent confounder \(\eta _i\). These empirical restrictions balance the timedependent covariate distribution across treatment groups and visit indication within each time interval in the presence of subjectspecific latent confounder.
Simulation study
Kang et al. [22] assessed the performance of various methods that use inverse probability weighting to estimate the causal effect from observational data with incomplete (missing) outcome. In similar spirit to Kang et al. [22] and others [16, 23, 24], the data generation in this simulation study is designed as an amalgamation of earlier longitudinal settings to evaluate the performance of inverse probability weighting with calibration restrictions.
Estimation of marginal treatment effect
We allow the treatment \(A_{j}\) to depend on the evolution of an individual’s timevarying covariate(s) \(\bar{L}_{j1}\), and also \(\bar{A}_{j1}\). Using the potential outcome framework defined with respect to treatment \(\bar{A}_j\) and visit \(\bar{V}_j\), the nonnull causal effect is estimated using the G formula as
where the sum is defined with respect to all possible realizations of \(\{\bar{y}_{j1}, \bar{l}_{j1}\}\) and the marginal means of potential outcome \(E(Y_{j}^{\bar{a},\bar{v}} X=x)\) is specified with respect to treatment \(\bar{A}_j=\bar{a}_j\) and visit \(\bar{V}_j=\bar{v}_j\). With large number of time intervals, the marginal means of potential outcomes may also be approximated using Markov and stationary assumptions [25].
Apart from observed dependencies between outcome \(E(Y_j \bar{H}_{j1})\) and treatment \(E(A_j \bar{H}_{j1})\) using observed history \(\bar{H}_{j1}\), a subjectspecific random effect \(\eta _i\) generates latent dependency between the outcome \(E(Y_j \bar{H}_{j1} ,\eta )\) and the timedependent treatment \(E(A_j\bar{H}_{j1} ,\eta )\). As detailed in Appendix section, the Gcomputation can be extended to incorporate the subjectspecific random effect \(\eta _i\) as
The Gcomputation is a generalization of covariate standardization in the longitudinal setting with timedependent exposure to express the marginal causal effect when the identifiability assumptions are satisfied [26]. The Gcomputation defines the populationaverage (i.e. marginal) causal contrast with respect to treatment and visit conditioned on baseline covariates and random effect. We used the Gcomputation to estimate the marginal quantity of interest (i.e. treatment effect) in marginal structural model.
Data generation
In the conditional data generating mechanism, the most recent values for visit \(V_{j1}\), confounder \(L_{j1}\) and past treatment \(A_{j1}\) are assumed to influence the longitudinal outcome \(Y_{j}\). The interdependencies in the collection of longitudinal information (with respect to discrete timeintervals) give rise to treatmentconfounder feedback and visitconfounder feedback [27, 28]. The treatmentconfounder feedback (i.e. \(\cdot \cdot \cdot \rightarrow A_{j1} \rightarrow L_j \rightarrow A_j \rightarrow \cdot \cdot \cdot\)) and visitconfounder feedback (i.e. \(\cdot \cdot \cdot \rightarrow V_{j1} \rightarrow L_j \rightarrow V_{j+1} \rightarrow \cdot \cdot \cdot\)) are defined over discrete timeintervals (as shown in Fig. 1).
The baseline covariates \(\varvec{X}_i^T\) are assumed to be measured as
where \(\varvec{U_i^T}= (U_{i1}, U_{i2}, U_{i3})\) is a vector of unobserved covariates independently sampled from multivariate standard normal distribution. The outcome \(Y_{ij}\) is generated as
The data generating mechanism for timevarying covariates \(L_{ij}\), irregular visits \(V_{ij}\) and treatment \(A_{ij}\) are specified as
where \(V_{j}=L_{j}=A_{j}=Y_{j}=0\) when \(j<0\) and \(expit(\cdot )=\frac{exp(\cdot )}{1+exp(\cdot )}\). Bernoulli distribution is used to generate the timevarying binary factors with respect to the conditional probabilities for \(V_{ij}\), \(L_{ij}\) and \(A_{ij}\) while the outcome is assumed to be distributed using normal distribution (\(Y_i \sim N(\Theta ,\sigma ^2_Y)\)). The probabilities of the binary factors \((L_{ij}, A_{ij}, V_{ij})\) are described using inverselogit link function where positive values indicate increased probability of binary factor. The latent factor \(\eta _i \sim N(0,1)\) is timeinvariant for each individual and acts as a common cause for timevarying treatment \(A_{ij}\) and outcome \(Y_{ij}\).
In the absence of visit (i.e. \(V_{ij}=0\)), we assume the continuation of previous treatment \(A_{ij}\) and previous covariate \(L_{ij}\), and a change in treatment and covariate is only observed in the presence of visit. Moreover, we specify the outcome \(Y_{ij}\) to be missing in the absence of visit. Using the conditional data generating mechanism, the joint distribution is expressed using the causal Markov factorization as
The data generating mechanism in the presence of visit and unmeasured (latent) factor \(\eta _i\) is described using a directed acyclic graphs in Fig. 1 where red edges denote associations, and black edges denote causal relationship between treatment and outcome.
Estimation procedures
The gcomputation formula (in the absence and presence of unmeasured confounder) is used to obtain the true values of marginal treatment effects (see Appendix Section). Since the timevarying treatment \(A_j\) and visit \(V_j\) are statistically endogenous in observational studies, the stabilized inverse probability treatment weights (sIPTW), stabilized inverse probability visit weights (sIPVW) and joint stabilized inverse probability weights (sIPTW \(\times\) sIPVW) with calibration restrictions (described in Section 2.4) are used to estimate the causal effect. The correct specification of the treatment model, visit model and marginal outcome model (with the exclusion of timedependent confounders) are used in relation to the data generating mechanism. Four simulation scenarios are considered in the simulation study:

Scenario 1: absence of irregular visits (i.e. \(\bar{V}_j=\mathbb {\bar{1}}\)) and absence of unmeasured confounder \(\eta _i\). The estimation of marginal treatment effect is performed using sIPTW and calibrated IPTW with the constraint for [a] orthogonality between treatment residual \((A_{ij}  \hat{e}_{ij}^A)\) and timedependent covariates \(L_{ij}\), [b] average treatment weights equal to one at each time interval.

Scenario 2: absence of irregular visits and presence of unmeasured confounder \(\eta _i\). The estimation of marginal treatment effect is performed using sIPTW and calibrated IPTW estimator with the constraint for [a], [b] and [c] covariate balance with respect to timeinvariant latent confounder restriction.

Scenario 3: presence of irregular visits and absence of unmeasured confounder \(\eta _i\). The estimation of marginal treatment effect is performed using sIPTW, calibrated IPTW, sIPVW and calibrated IPVW estimators with the constraint for [a] orthogonality between treatment residual \((A_{ij}  \hat{e}_{ij}^A)\) (or visit residual \(V_{ij}\hat{e}_{ij}^V\)) and timedependent covariates \(L_{ij}\), [b] average treatment weights equal to one at each time interval.

Scenario 4: presence of irregular visits and presence of unmeasured confounder \(\eta _i\). The estimation of marginal treatment effect is performed using sIPTW, calibrated IPTW, sIPVW and calibrated IPVW estimators with the constraint for [a], [b], [c] covariate balance with respect to timeinvariant latent confounder restriction.
We implemented the constrained optimization of the cumulativetime product weights using the BarzilaiBorwein (BB) method [29]. After the estimation of stabilized and calibrated weights, the marginal causal effect of treatment is estimated using the pseudolikelihood function of generalized estimating equations with AR(1) working correlation structure (geeglm function in R) with stabilized weights and calibrated weights. Based on the data generating mechanism, the correct specification of the marginal structural models for four scenarios were fitted as
The absence of irregular visits in scenario 1 and 2 led to the exclusion of \(V_{j1}\) in the equation above. We also applied a naïve estimator by fitting unweighted generalized estimating equations with AR(1) working correlation structure. The naïve estimator was used as a reference to determine the extent of bias introduced by measured confounding, selecting bias (due to irregular visit) and unmeasured subjectspecific confounding within simulated scenarios.
Simulation parameters
Table 1 describes the simulation parameters for the data generating mechanism described in Fig. 1. The performance of inverse probability weightbased estimators is assessed using relative bias, Monte Carlo error (MCE), root mean square error (rMSE) and coverage probability. Relative bias is estimated as the average difference between an estimator and the true parameter value. MCE is defined as the standard deviation of an estimator while the rMSE is the square root sum of bias squared and MCE squared. The coverage probability was estimated as the proportion of times when the 95% confidence interval contained the true parameter value. The simulation study is repeated for 1,000 replications using a sample size \(N=100\) with ten discrete time intervals.
Results
The results of the simulation study are presented for the four scenarios in which the presence or absence of irregular visits and timeinvariant latent confounder is considered. The results are summarized using the performance metrics of relative bias, MCE, rMSE, coverage probabilities and successful convergence of calibrated weights, as shown in Table 2.
Scenario 1: regular visits, no unmeasured confounder
We assessed the performance of sIPTW and calibrated IPTW in the absence of irregular visits and unmeasured confounder. An improvement in bias was observed for calibrated IPTW in relation to sIPTW. The MCE and rMSE for calibrated weights was smaller than the stabilized weights, and the coverage probabilities were close to 95% nominal rate. The correlation between stabilized weights and calibrated weights ranged from 0.986 to 0.999. Successful convergence of calibrated weights was observed for all 1,000 replicates.
Scenario 2: regular visits, unmeasured confounder
In this scenario, we assessed the performance of sIPTW and calibrated IPTW in the absence of irregular visits, and in the presence of unmeasured confounder. Nominal coverage rates close to 95% were observed for marginal structural models with sIPTW and calibrated IPTW. The calibrated weights had smaller mean bias than stabilized weights. The calibrated weights also had smaller MCE and rMSE than stabilized weights. The correlation between stabilized weights and calibrated weights ranged from 0.929 to 0.999. Successful convergence was observed for 959 out of 1,000 replicates.
Scenario 3: irregular visits, no unmeasured confounder
In this scenario, we assessed the performance of stabilized and calibrated variants of treatment and visit weights in the presence of irregular visits and absence of unmeasured confounder. The coverage probabilities were close to the expected 95% nominal rate for the four estimators: (i) sIPTW, (ii) sIPVW, (iii) joint sIPTW and sIPVW, (iv) and calibrated IPTW and IPVW. Smaller bias was observed for calibrated weights when compared to the stabilized weights. The correlation between stabilized weights and calibrated weights ranged from 0.25 to 0.99, and successful convergence was observed for all 1,000 replicates.
Scenario 4: irregular visits, unmeasured confounder
In this scenario, we assessed the performance of stabilized and calibrated variants of treatment and visit weights in the presence of irregular visits and unmeasured confounder. The coverage probabilities were close to the expected 95% nominal rate for all estimators. A reduction in bias was observed for calibrated IPTW and IPVW estimators when compared with sIPTW and sIPVW estimators. The correlation between stabilized weights and calibrated weights ranged from 0.24 to 0.99, and successful convergence was recorded for 966 out of 1,000 replicates.
Application: emulating randomized experiment using EHRs
Electronic health records (EHRs) can serve as a complete lifetime record of a patient’s longitudinal health trajectory, and they can be collected from different sources including hospitals, specialist clinics, primary care providers, pharmacies, and laboratories. University of Toronto practice based research network (UTOPIAN) collects deidentified patientlevel medical information from EHRs of primary care practices across the Greater Toronto region [30, 31]. The EHRs in UTOPIAN database contains patientlevel demographics, medical diagnosis, procedures, medications, immunization, laboratory test results, vital signs and risk factors. Even though the UTOPIAN repository is a rich source of deidentified patientlevel medical information, it is prone to many sources of bias including informed presence of patients due to acute onset of new medical ailment or the management of preexisting chronic condition. In our context, we used the irregular visits in longitudinal followup to describe the informed presence of diabetes patients in primary care.
Glucose lowering medications
Diabetes is one of the most common chronic conditions in which the body cannot properly use insulin produced by pancreas (Type II). Hemogloblin A1c (HbA1c) is an important glycemic marker to reduce the incidence of diabetesrelated complications and mortality [32]. More than 90% of type II diabetes patients eventually require more than metformin monotherapy to achieve their target for optimal glucose control. Dual or combination therapy may become necessary when metformin is insufficient. The secondline options for glucose management include sodiumglucose cotransporter 2 inhibitors (SGLT2i) and dipeptidyl peptidase4 inhibitors (DPP4i) medications. SGLT2i medications are associated with reduction in cardiovascular outcomes and decreased progression of renal disease [6], while DPP4i medications are known to have highly favourable tolerability among elderly patients [33]. We assess the effectiveness of SGLT2i and DPP4i drugs using HbA1c as the glycemic marker among patients with type II diabetes. We assume intentiontotreat design for timevarying treatment assignment where the analysis are based on the treatment assignment (i.e. drug prescription) rather than the treatment eventually received (i.e. drug dispensation).
Cohort generation
We emulate a randomized experiment using an observational setting, and describe several elements of emulating the target trial in Table 3. Patients are enrolled in the longitudinal cohort from January 01 2018 when the following conditions are satisfied: (i) patient is at least 18 years of age; (ii) patient has a clinical indication for diabetes [34]; (iii) HbA1c \(\ge 8.5 \%\) is recorded within the study period. Patient followup starts when these eligibility criteria (i)(iii) are met. Patients are administratively censored on September 30 2021 or censored at midcalendar (June 30) when deceased year is recorded. The enrollment period is terminated on January 01 2020 while the study followup is terminated on September 30 2021. Once the patient is enrolled in the cohort, three month timeintervals are generated under the assumption that the patient regularly visits the clinic on quarterly basis (i.e. every 3 months) as recommended by Diabetes Canada guidelines [6]. The presence of billing record for any primary care services within a quarter for a given patient indicate \(V_{ij}=1\). As an example, \(V_{ij}=0\) if no billing record is available within an index quarter and \(V_{ij}=1\) if patient has one or more billing records within an index quarter. The timedependent exposures \(A_{ij}^\prime\) and \(A_{ij}^{\prime \prime }\) (prescription for SGLT2i and DPP4i medications), timedependent confounders \(L_{ij}\) (comorbidities and glucose lowering medications, respectively), and continuous outcome \(Y_{ij}\) (Hemoglobin A1c) are assumed to be constant within each index quarter. In the case of multiple visits within each quarter, positive values of \(A_{ij}^\prime\), \(A_{ij}^{\prime \prime }\) and \(L_{ij}\) take precedence while an average value of \(Y_{ij}\) is computed for each patient within each quarter. Once the positive indication for a comorbidity is recorded, the patient is assumed to have the comorbidity for the remainder of the study period. Patients who had an earlier prescription for SGLT2i or DPP4i medications three years prior to January 01 2018 were excluded. The threeyear look back window reduced the possibility of selection bias by left truncating those individuals who initiated the secondary treatment (using SGLT2i or DPP4i) prior to meeting the eligibility criteria.
We assume the timevarying patient characteristics (i.e. comorbidities, other glucoselowering medications) as timedependent confounders. Other glucose lowering medications \((X_{ij})\) include the use of monotherapy and combination therapy using several drug classes: (i) metformin, (ii) GLP1, (iii) sulfonylurea, (iv) insulin, as detailed elsewhere [35]. We included several comorbidities with disease onset date as timedependent covariates: (i) chronic obstructive pulmonary disease (COPD), (ii) depression, (iii) dyslipidemia, (iv) hypertension, (v) osteoarthritis, (vi) chronic kidney disease, as detailed elsewhere [34].
Marginal structural model
The effectiveness of glucose lowering medications was assessed among diabetes patients who were prescribed SGLT2i and/or DPP4i medications during the study period. Longitudinal marginal structural models using generalized estimating equations (AR1 correlation) with stabilized and calibrated weights were used to generate covariate balance with respect to treatment assignment (i.e. SGLT2i and DPP4i medications) and irregular visits. We fitted the following marginal structural model:
where \(\sum _{j}\) denotes the cumulative number of prescriptions for glucose lowering medications, truncated at two prescriptions. The marginal structural model did not include the timedependent covariates \(L_{ij}\) as they were accounted for using the longitudinal weights. The pseudopopulations were defined using the stabilized weights with their calibrated counterparts defined as
where \(\bar{A}^{\prime }\) denotes treatment for SGLT2i medications and \(\bar{A}^{\prime \prime }\) denotes treatment for DPP4i medications, and \(\tilde{\lambda }=\{\lambda _1 , \lambda _2 , \lambda _3 \}\). The stabilized weights with respect to the SGLT2i medications, DPP4i medications, and irregular visits were used to construct the pseudopopulations. At last, the product weights of SGLT2i medications, DPP4i medication and irregular visits were calibrated to balance the timedependent covariate distributions. The calibration restrictions included the balancing conditions for the orthogonality constraint (i.e. \((A_{ik}  \hat{e}_{ik}^A) {\perp \! \! \! \perp } \tilde{L}_{ik1}\) and \((V_{ik}  \hat{e}_{ik}^A) {\perp \! \! \! \perp } \tilde{L}_{ik1}\)), and unity constraints (i.e. \(E(SW_{j})=1 \ \forall j\)). We truncated the stabilizing and calibrated weight functions at 1% and 99% quantiles to improve the estimation of the marginal effects [36].
Effectiveness of glucose lowering medications
We describe the effectiveness of glucose lowering medications among diabetes patients with elevated HbA1c (i.e. \(\ge 8.5 \%\)) using the stabilized (product) weights and the calibrated weights. The pseudopopulation characterized using the product weights (Fig. 3) and calibrated weights (Fig. 4) were used to describe the net change in mean HbA1c with respect to the patient demographics, geographical characteristics and treatment assignment. The stabilized (product) weights ranged from 0.003 to 20.808 with mean value of 1.381 while the calibrated weights ranged from 0.003 to 13.045 with mean value of 1.002 (see Fig. 2). The correlation between stabilized and calibrated weights was 0.985.
Using the calibrated weights, we note that older patients have lower mean HbA1c than younger patients (e.g. \(6579\) years vs. \(1834\) years: \(0.63\%\) (95% CI: \(1.02\%\) to \(0.24\%\), Pvalue \(< 0.001\))). The mean HbA1c is lower among male patients than female patients (\(0.16\%\) (95% CI: \(0.31\%\) to \(0.00\%\), Pvalue \(=0.049\))). The mean HbA1c is lower among patients residing in highest income quintiles than lowest income quintiles (\(0.26\) % (95% CI: \(0.49\%\) to \(0.04\%\), Pvalue \(=\) 0.02)). We note that the mean HbA1c is reduced with glucose lowering medications (SGLT2i and DPP4i). For example, the mean HbA1c is reduced by \(0.38\%\) (95% CI: \(0.57\%\) to \(0.19\%\), Pvalue \(<0.001\)) with a single prescription of SGLT2i medication while it is reduced by \(0.28\%\) (95% CI: \(0.45\%\) to \(0.10\%\), Pvalue\(<0.001\)) with a single prescription of DPP4i medication. A reduction of \(0.78\%\) (95% CI: \(0.87\%\) to \(0.69\%\)) in mean HbA1c is observed with primary care visit, indicating improved regulation of blood glucose. Similar findings were observed for stabilized weights (when compared to calibrated weights) as the inference did not change drastically (see Figs. 3 and 4).
Discussion
The longitudinal data in EHRs feature several methodological complexities. For example, the irregular visits in EHRs are often recorded in which the longitudinal outcome is measured sporadically across timeintervals, and it may depend on patients’ observed history (i.e. missing at random) [5]. Furthermore, the presence of timeinvariant latent confounders in EHRs may generate biased estimation of treatment effect [37].
In this article, we proposed calibrated weights to estimate the effect of timedependent treatment on longitudinal outcomes with irregular visits and with unmeasured confounding. We derived the calibrated restrictions for subjectspecific latent confounder which acts as a common cause for treatment and outcome. In our simulation study, the effect of timevarying treatment propagated towards the longitudinal outcome in multiple pathways: (i) direct effect of treatment on outcome, (ii) indirect effect of treatment through the timevarying covariate, (iii) indirect effect of treatment through the irregular visits. The proposed weights created a pseudopopulation in which the irregular visits were exogenous (using the visit weights), and in which the treatment groups were exchangeable (using the treatment weights). Marginal structural model with inverse probability weights with respect to treatment accounted for confounding bias in treatmentconfounder feedback while the inverse probability weights with respect to irregular visit accounted for selection bias in visitconfounder feedback [8]. An improvement in finite sample properties (e.g. reduced bias) was observed with the application of calibrated weights. We further employed the calibrated weights to assess the effect of cumulative prescription of glucose lowering medications (SGLT2i and DPP4i) on Hemoglobin A1c.
Similar to calibrated weights, Imai and Ratkovic [24] proposed a methodology for covariate balancing weights which improved performance by reducing the mean square error under correct and incorrect model misspecification. Covariate balancing weights are computationally intensive and may only accommodate small number of followup visits and covariates in longitudinal settings due to increase in the total number of moment conditions for weight estimation [13]. Even when the causal identifiability assumptions hold, biased estimation of average treatment effect is possible for longitudinal marginal structural models or gcomputation when the parametric models are misspecified. In the earlier literature [20] and in this article, the calibrated restrictions on inverse probability weights improved the estimation error under finite sample when compared to maximum likelihood estimation.
Young et al. [38] discretized continuoustime and used pooled logistic regression with short intervals to estimate the causal effect of treatment on longitudinal outcome with rare occurrence. If we consider binary repeatedmeasures outcome (e.g. elevated Hemoglobin A1c) then we may specify short discrete time intervals with negligible event rate where the timedependent treatment is influenced with respect to the observed history. Varying the length of timeintervals may also describe the extent of irregularity in followup visits [7]. Furthermore, in this article, attention was limited to irregular visits where the entire study population was assumed to follow a single type of homogeneous process. As alluded by Neuhaus et al. [39], a more realistic approach could be to consider a combination of regular and irregular visits in the longitudinal cohort using the outcomevisit dependency. One approach to incorporate this could be to cluster the patient profiles (with respect to irregularities in visits) using latent class analysis prior to assessing the effectiveness of glucose lowering medications [32].
In this article, we made the assumption of sequential positivity with respect to the treatment and irregular visits. Sequential positivity assumption may become implausible in some situations when the clinical profile of a patient precludes them from receiving SGLT2i or DPP4i medications, or precludes them from visiting the primary care clinic for some timeintervals. As an extension when the sequential postivity assumption is unrealistic, we may employ doubly robust estimators to reduce bias and imprecision due to large weights. Doubly robust estimators may improve the robustness against model misspecification when either the treatment model or the counterfactual outcome model is misspecified [40]. For example, Pullenayegum and Feldman [41] described the doubly robust estimator which is robust to the misspecification of the visit model (using the inverse intensity weights) and imputation model (using increment estimator). Future research may focus on the extension of calibrated estimators to accommodate for the misspecification of treatment or outcome models using doubly robust estimation [20]. The proposed estimators with calibrated restrictions also relied on the assumption of sequential exchangeability where all potential confounders are measured at each timeinterval (i.e. no unmeasured timevariant confounders). In a situation where the sequential exchangeability assumption is violated, Coulombe et al. [42] and Streeter et al. [43] describe sensitivity analysis to assess the extent to which unmeasured confounding can affect the marginal effect of the treatment. As an extension to this article, sensitivity analysis may become necessary if we consider unmeasured timedependent covariates in longitudinal settings.
Conclusion
We demonstrated the application of calibrated weights to assess the effect of irregular visits and to assess the efficacy of glucose lowering medications (SGLT2i and DPP4i) on the longitudinal trajectory of Hemoglobin A1c. The empirical results showed a reduction in mean Hemoglobin A1c with cumulative prescriptions of SGLT2i and DPP4i medications using primary care EHRs. These findings support the earlier results from a metaanalysis in which SGLT2i medications had stronger efficacy than DPP4i medications [44]. In general, stronger efficacy of one treatment (e.g. SGLT2i medications) in reducing Hemoglobin A1c is not a clinical rationale for selecting a particular treatment (e.g. DPP4i medications). Instead, the treatment for glycemic control in type II diabetes patients is often intertwined with several clinical characteristics including weight change, blood pressure, cardiovascular profile, renal profile, and other safety profiles [45].
Availability of data and materials
The research ethics approval for the use of Electronic health records (EHRs) data does not permit making the data publicly available. Researchers interested in accessing EHR data from the Data Safe Haven for research can apply to do so at: https://www.dfcm.utoronto.ca/gettingutopiansupport.
References
Hernán MA, Robins JM. Using big data to emulate a target trial when a randomized trial is not available. Am J Epidemiol. 2016;183(8):758–64.
Goldstein BA, Phelan M, Pagidipati NJ, Peskoe SB. How and when informative visit processes can bias inference when using electronic health records data for clinical research. J Am Med Inform Assoc. 2019;26(12):1609–17.
Lin H, Scharfstein DO, Rosenheck RA. Analysis of longitudinal data with irregular, outcomedependent followup. J R Stat Soc Ser B Stat Methodol. 2004;66(3):791–813.
McCulloch CE, Neuhaus JM, Olin RL. Biased and unbiased estimation in longitudinal studies with informative visit processes. Biometrics. 2016;72(4):1315–24.
Pullenayegum EM, Lim LS. Longitudinal data subject to irregular observation: A review of methods with a focus on visit processes, assumptions, and study design. Stat Methods Med Res. 2016;25(6):2992–3014.
Lipscombe L, Booth G, Butalia S, Dasgupta K, Eurich DT, Goldenberg R, et al. Pharmacologic glycemic management of type 2 diabetes in adults. Can J Diabetes. 2018;42:S88–103.
Lokku A, Lim LS, Birken CS, Pullenayegum EM. Summarizing the extent of visit irregularity in longitudinal data. BMC Med Res Methodol. 2020;20(1):1–9.
Hernán MA, McAdams M, McGrath N, Lanoy E, Costagliola D. Observation plans in longitudinal studies with timevarying treatments. Stat Methods Med Res. 2009;18(1):27–52.
Tan KS, French B, Troxel AB. Regression modeling of longitudinal data with outcomedependent observation times: extensions and comparative evaluation. Stat Med. 2014;33(27):4770–89.
Gasparini A, Abrams KR, Barrett JK, Major RW, Sweeting MJ, Brunskill NJ, et al. Mixedeffects models for health care longitudinal data with an informative visiting process: A Monte Carlo simulation study. Statistica Neerlandica. 2020;74(1):5–23.
Hernán MA, Brumback B, Robins JM. Marginal structural models to estimate the joint causal effect of nonrandomized treatments. J Am Stat Assoc. 2001;96(454):440–8.
Hernán MA, Robins JM. Causal inference. Boca Raton: Chapman & Hall/CRC, forthcoming; 2022.
Yiu S, Su L. Joint calibrated estimation of inverse probability of treatment and censoring weights for marginal structural models. Biometrics. 2022;78(1):115–27. Wiley Online Library.
Robins JM, Tsiatis AA. Correcting for noncompliance in randomized trials using rank preserving structural failure time models. Commun Stat Theory Methods. 1991;20(8):2609–31.
Tan Z. Regularized calibrated estimation of propensity scores with model misspecification and highdimensional data. Biometrika. 2020;107(1):137–58.
Zubizarreta JR. Stable weights that balance covariates for estimation with incomplete outcome data. J Am Stat Assoc. 2015;110(511):910–22.
Yiu S, Su L. Joint calibrated estimation of inverse probability of treatment and censoring weights for marginal structural models. arXiv preprint arXiv:1806.05144. 2018.
Propensity score weighting for causal inference with clustered data. J Causal Inference. 2018;6(2). De Gruyter.
Imai K, King G, Stuart EA. Misunderstandings between experimentalists and observationalists about causal inference. J R Stat Soc A Stat Soc. 2008;171(2):481–502.
Yiu S, Su L. Covariate association eliminating weights: a unified weighting framework for causal effect estimation. Biometrika. 2018;105(3):709–22.
Hernán MA, Robins JM. Estimating causal effects from epidemiological data. J Epidemiol Community Health. 2006;60(7):578–86.
Kang JD, Schafer JL, et al. Demystifying double robustness: A comparison of alternative strategies for estimating a population mean from incomplete data. Stat Sci. 2007;22(4):523–39.
Tan Z. Bounded, efficient and doubly robust estimation with inverse weighting. Biometrika. 2010;97(3):661–82.
Imai K, Ratkovic M. Covariate balancing propensity score. J R Stat Soc Ser B (Statistical Methodology). 2014;76(1):243–63. Wiley Online Library.
Robins JM, Greenland S, Hu FC. Estimation of the causal effect of a timevarying exposure on the marginal mean of a repeated binary outcome. J Am Stat Assoc. 1999;94(447):687–700.
Daniel RM, Cousens S, De Stavola B, Kenward MG, Sterne J. Methods for dealing with timedependent confounding. Stat Med. 2013;32(9):1584–618.
Zeger SL, Liang KY. Feedback models for discrete and continuous time series. Stat Sin. 1991:51–64.
Robins J. The control of confounding by intermediate variables. Stat Med. 1989;8(6):679–701.
Varadhan R, Gilbert P. BB: An R package for solving a large system of nonlinear equations and for optimizing a highdimensional nonlinear objective function. J Stat Softw. 2009;32(1):1–26.
Birtwhistle R, Keshavjee K, LambertLanning A, Godwin M, Greiver M, Manca D, et al. Building a panCanadian primary care sentinel surveillance network: initial development and moving forward. J Am Board Fam Pract. 2009;22(4):412–22.
Tu K, Greiver M, Kidd MR, Upshur R, Mullin A, Medeiros H, et al. The University of Toronto Family Medicine Report. Toronto: Department of Family and Community Medicine; 2019. (ISBN: 978 1 999 0809 0 7).
Luo M, Lim WY, Tan CS, Ning Y, Chia KS, van Dam RM, et al. Longitudinal trends in HbA1c and associations with comorbidity and allcause mortality in Asian patients with type 2 diabetes: a cohort study. Diabetes Res Clin Pract. 2017;133:69–77.
Karagiannis T, Paschos P, Paletas K, Matthews DR, Tsapas A. Dipeptidyl peptidase4 inhibitors for treatment of type 2 diabetes mellitus in the clinical setting: systematic review and metaanalysis. BMJ. 2012;344.
CPCSSN. Case Definitions: Canadian Primary Care Sentinel Surveillance Network (CPCSSN), Version 2020Q2. 2020. http://cpcssn.ca/wpcontent/uploads/2020/10/CPCSSNCaseDefinitions2020Q21.pdf. Accessed 15 May 2020.
Greiver M, Havard A, Bowles JK, Kalia S, Chen T, Aliarzadeh B, et al. Trends in diabetes medication use in Australia, Canada, England, and Scotland: a repeated crosssectional analysis in primary care. Br J Gen Pract. 2021;71(704):e209–18.
Xiao Y, Moodie EE, Abrahamowicz M. Comparison of approaches to weight truncation for marginal structural Cox models. Epidemiol Methods. 2013;2(1):1–20.
Imai K, Kim IS. When should we use unit fixed effects regression models for causal inference with longitudinal data? Am J Polit Sci. 2019;63(2):467–90.
Young JG, Hernán MA, Picciotto S, Robins JM. Relation between three classes of structural models for the effect of a timevarying exposure on survival. Lifetime Data Anal. 2010;16(1):71.
Neuhaus JM, McCulloch CE, Boylan RD. Analysis of longitudinal data from outcomedependent visit processes: Failure of proposed methods in realistic settings and potential improvements. Stat Med. 2018;37(29):4457–71.
Bang H, Robins JM. Doubly robust estimation in missing data and causal inference models. Biometrics. 2005;61(4):962–73.
Pullenayegum EM, Feldman BM. Doubly robust estimation, optimally truncated inverseintensity weighting and incrementbased methods for the analysis of irregularly observed longitudinal data. Stat Med. 2013;32(6):1054–72.
Coulombe J, Moodie EE, Platt RW, Renoux C. Estimation of the marginal effect of antidepressants on body mass index under confounding and endogenous covariatedriven monitoring times. arXiv preprint arXiv:2106.14364. 2021.
Streeter AJ, Lin NX, Crathorne L, Haasova M, Hyde C, Melzer D, et al. Adjusting for unmeasured confounding in nonrandomized longitudinal studies: a methodological review. J Clin Epidemiol. 2017;87:23–34.
Wang Z, Sun J, Han R, Fan D, Dong X, Luan Z, et al. Efficacy and safety of sodiumglucose cotransporter2 inhibitors versus dipeptidyl peptidase4 inhibitors as monotherapy or addon to metformin in patients with type 2 diabetes mellitus: A systematic review and metaanalysis. Diabetes Obes Metab. 2018;20(1):113–20.
Scheen A. Reduction in HbA1c with SGLT2 inhibitors vs. DPP4 inhibitors as addons to metformin monotherapy according to baseline HbA1c: A systematic review of randomized controlled trials. Diabetes Metab. 2020;46(3):186–96.
Acknowledgements
Authors like to acknowledge the primary care research team at University of Toronto, Department of family and community medicine for providing access to electronic health records data.
Funding
This statistical research was supported by Natural Sciences and Engineering Research Council (NSERC) Canadian Graduate Scholarship (CGS: 534600).
Author information
Authors and Affiliations
Contributions
SK conducted the literature review and drafted this manuscript. SK conducted the simulation study and performed the statistical analysis using the electronic health records. OS critically appraised this manuscript, and provided feedback to improve the content of this manuscript. RM and MG provided insights on the clinical application of statistical methods. All author(s) read and approved the final manuscript.
Corresponding author
Ethics declarations
Ethics approval and consent to participate
This project received Research Ethics Board (REB) approval from Health Sciences REB board at University of Toronto (RIS Protocol Number: 39268).
Consent for publication
Not applicable.
Competing interests
The authors declare that they have no competing interests.
Additional information
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Supplementary Information
Additional file 1.
Appendix.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/. The Creative Commons Public Domain Dedication waiver (http://creativecommons.org/publicdomain/zero/1.0/) applies to the data made available in this article, unless otherwise stated in a credit line to the data.
About this article
Cite this article
Kalia, S., Saarela, O., Escobar, M. et al. Estimation of marginal structural models under irregular visits and unmeasured confounder: calibrated inverse probability weights. BMC Med Res Methodol 23, 4 (2023). https://doi.org/10.1186/s12874022018312
Received:
Accepted:
Published:
DOI: https://doi.org/10.1186/s12874022018312