[R Coding] Modified version of drop1 function for change-in-estimate method using the glm function and logit link.
March 13, 2015
The change-in-estimate method (CIE) is a well established method for selecting confounding variables to include in a regression model. Confounders bias estimates of exposure effect and, in short, to identify a confounder (C) we calculate two estimates of the effect of exposure on the outcome, one which is adjusted for the C and the other we don't. If the two estimates differ, we conclude that C is in fact a confounder.
The function dropCIE.R was developed to use with the glm function in R and the logit link function to help select a "final" model via CIE of the odds ratio (OR) for some set tolerance using an all-possible-models manual backwards selection procedure. Input for the code is as follows:
model: a fitted object model, i.e. the full model where all potential confounders for the final regression model are included.
beta: a single numeric value representing the coefficient, i.g. log(OR), of the exposure/variable of interest.
coefnum: a single numeric value representing the beta coefficient number, e.g. for the model logit(p) = beta_0 + beta_1 x the position for beta_1 is 2 since the intercept is in the first position.
varlist: a character string with the names of all potential confounder in the model - the exposure/variable of interest should not be included in this list.
factor: a value to scale the exposure variable by, e.g. if the exposure variable is ordinal and you want to apply CIE for the highest level that is not 1 (default: factor = 1).
tol: a numeric value representing the tolerance for how much change in the OR must occur to be considered a confounder in the final model (default: tol = 0.10).
Assuming there are k confounders, the program will start with the full model and drop one variable from varlist at a time and calculate the CIE when dropped. The variable with the smallest CIE will be removed from varlist an the program will output what the CIE was. The program will then start the sequence again but using k-1 confounders and then drop the next smallest CIE and output its respective value. This will continue until the smallest CIE is larger than the set tolerance. Once the final model is selected, it will automatically be saved into a new object with the same name as the inputted model but with a suffix "u" added to the end.