Learn R Programming

rqlm (version 4.2-1)

ttemsm: Pooled logistic regression for target trial emulation

Description

This function implements pooled logistic regression for use in target trial emulation. Before running the function, the user must prepare an analysis dataset by stacking the sequential‐trial datasets in long format. If inverse probability weights (such as IPCW) are required, the corresponding weight variable should be included in the dataset in advance. The regression model is specified through the formula argument, and the individual identifier must be provided via the id argument, so that cluster‐robust standard errors are computed across repeated trials for each individual. When a weight variable is specified through weights, the function performs inverse probability weighting. The output includes point estimates of the hazard ratio, corresponding confidence intervals, and P-values.

Usage

ttemsm(formula, data, id, weight, eform=TRUE, cl=0.95, digits=4, var.method="MBN")

Value

Results of the pooled logistic regression analysis.

  • coef: Coefficient estimates; transformed to the exponential scale if eform=TRUE.

  • SE: Cluster-robust standard error estimates for coef.

  • CL: Lower limits of confidence intervals.

  • CU: Upper limits of confidence intervals.

  • P-value: P-values for the coefficient tests.

Arguments

formula

An object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted.

data

A data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model.

id

id variable for individual participants containing in the data object.

weight

weight variable for individual participants containing in the data object.

eform

A logical value that specify whether the outcome should be transformed by exponential function (default: TRUE)

cl

Confidence level for calculating confidence intervals (default: 0.95)

digits

Number of decimal places in the output (default: 4).

var.method

Method for estimating standard errors. Standard cluster-robust variance estimator (standard) and Morel-Bokossa-Neerchaal-type corrected cluster-robust estimator (MBN) are available (default: MBN).

References

Gosho, M., Ishii, R., Noma, H., and Maruo, K. (2023). A comparison of bias-adjusted generalized estimating equations for sparse binary data in small-sample longitudinal studies. Statistics in Medicine 42, 2711-2727.

Hernan, M. A., Alonso, A., Logan, R., et al. (2008). Observational studies analyzed like randomized experiments: an application to postmenopausal hormone therapy and coronary heart disease. Epidemiology 19, 766-779.

Hernan, M. A., Dahabreh, I. J., Dickerman, B. A., and Swanson, S. A. (2025). The Target Trial Framework for Causal Inference From Observational Data: Why and When Is It Helpful? Annals of Internal Medicine 178, 402-407.

Hernan, M. A., Wang, W., and Leaf, D. E. (2022). Target Trial Emulation: A Framework for Causal Inference From Observational Data. JAMA 328, 2446-2447.

Morel, J. G., Bokossa, M., and Neerchal, N. (2003). Small sample correction for the variance of GEE estimators. Biometrical Journal 45, 395-409.

Examples

Run this code
data(exdata04)

ttemsm( Y ~ A + L1 + time + I(time^2) + trial,
  data    = exdata04, id = ID, weight = w_pp,
  eform   = TRUE, cl = 0.95, var.method="standard")
# Pooled logistic regression for target trial emulation

ttemsm( Y ~ A + L1 + time + I(time^2) + trial,
  data    = exdata04, id = ID, weight = w_pp,
  eform   = TRUE, cl = 0.95, var.method="MBN")
# Pooled logistic regression for target trial emulation
# Morel-Bokossa-Neerchaal-type corrected SE estimator is used.

Run the code above in your browser using DataLab