
Prepare an outcome model object for transportGC
transportGCPreparedModel.RdAn outcome model needs to be fitted using the study data to perform transportability analysis using g-computation. However, glm and functions in survival typically contain the data used to fit the model in their respective result objects. This function provides the option to remove most components containing the data from these result objects to comply with data sharing regulations. The party with sole access to the study data may use only this function and provide the results object (possibly in a .rds file) to others who request it.
Note that for time-to-event outcomes, survreg should used for the outcome model over coxph because the latter is not meant to produce predicted survival times. The coxph option is provided, but we warn that the computation time might be prohibitive.
Arguments
- outcomeModel
Either a formula or a
glm,survreg,coxph, orpolrobject representing the outcome model. Please setmodel = Tif providing a fitted model object.- response
String indicating name of response variable. If
NULL, it will be auto-detected fromoutcomeModel.- responseLevels
For ordinal responses, vector of strings indicating levels of response variable in the study data. If
NULLandpolris used, it will be auto-detected usingresponseandstudyData.- treatment
String indicating name of treatment variable. This argument is required.
- treatmentLevels
Vector of strings indicating levels of treatment variable in the study data. If
NULL, it will be auto-detected usingtreatmentandstudyData.- family
Either a family function as used for
glm, or one ofc("coxph", "survreg"). Only required ifoutcomeModelis a formula.- method
Link function used for
polr, one ofc("logistic", "probit", "loglog", "cloglog", "cauchit"). Only required ifoutcomeModelis a formula andpolris used.- studyData
Data frame of the study data.
- wipe
Logical indicating whether original study data should be wiped from outcome model-fitting object.
- formula
The formula used to fit outcomeModel, if outcomeModel is provided as a fitted model object. This is necessary to provide only when using
coxph,survregandpolrbecause these objects do not have the formula components.
Value
A transportGCPreparedModel object containing the following components:
outcomeModel: The fitted outcome model with all components containing the data used to fit the model removedresponse: String indicating name of response variabletreatment: String indicating name of treatment variabletreatmentLevels: Vector of strings indicating levels of treatment variablefamily: Thefamilyargument providedwipe: Thewipeargument providedformula: The formula used to fit the outcome model