Skip to contents

Estimates the average treatment effect (ATE) using g-computation in a generalizability or transportability analysis. In particular, the estimators should be unbiased for the ATE in the superpopulation or the target population, respectively.

Usage

transportGC(
  effectType = c("meanDiff", "rr", "or", "hr"),
  preparedModel,
  targetData,
  bootstrapNum = 500
)

Arguments

effectType

Type of effect desired for the ATE: "meanDiff" for mean difference, "rr" for relative risk, "or" for odds ratio, and "hr" for hazard ratio.

preparedModel

A transportGCPreparedModel object. This is obtained by using the transportGCPreparedModel function to fit an outcome model using the study data.

targetData

A target dataset.

bootstrapNum

Number of bootstrap datasets to simulate to obtain robust variance estimators

Value

A transportGC object with the following components:

  • effect: Calculated ATE

  • effectType: Type of effect calculated

  • var: Estimated variance of ATE estimator, calculated using bootstrap

  • preparedModel: The transportGCPreparedModel object used to estimate the ATE

  • bootstrapNum: Integer indicating number of bootstrap datasets simulated to calculate robust variance estimators.

Details

The expected workflow is as follows:

  1. A researcher who wants to perform a generalizability/transportability analysis collects data from the target population.

  2. They then request the owner of the study data from which they wish to generalize/transport to provide an outcome model fitted using the study data.

  3. The owner of the study data runs the transportGCPreparedModel function on the study data to obtain a transportGCPreparedModel object which contains the fitted outcome model.

  4. The owner of the study data provides the transportGCPreparedModel object to the researcher, perhaps in a .rds file.

  5. The researcher uses this function and the provided transportGCPreparedModel object to perform the analysis using g-computation.

Since model-fitting objects in R often contain the data used to fit the model, the transportGCPreparedModel function wipes this data, if requested, in the model-fitting object and keeps additional information about the name of the response variable, the name of the treatment variable and the levels of treatment. This is in awareness with government regulations regarding access and integration of data sources from different countries.

Bootstrap is used to calculate robust variance estimates of the ATE estimator. Note that these standard errors are only valid conditional on the observed study data when wipe = T because it is not possible to resample the study data when access to it is restricted.