# “controlling for” a variable in retrospective cohort studies

I'm a doctor and I'm trying to teach myself logistic regression for biomedical research.

In many papers, people will say that they use multivariate logistic regression analysis to pick from a list of possible predictors (IVs), those most related to the disease state (Binary DV - yes or no). They will further go on to say that this is true, even when controlling for some other variable. From reading other posts, my understanding is that when people say they are "controlling for" a variable, they mean that they included that variable in their logistic regression model and that variable was not significant. Is this correct?

So, for example, we are looking at whether there is a significantly lower proportion of women compared to men in associate or full professor positions, but we need to control for the amount of time since graduation and whether they have a PhD. My understanding is that to do this, I would use SPSS to create a multinomial logistic regression model with associate or full professor (Y/N) as the dependent variable, Sex (M/F) and PhD (Y/N) as categorical "factors" and years since graduation as a continuous covariate.

When I do this, I get a model, but here is where I get confused. SPSS compares the intercept only model to the final model and tells me that the Chi-Square value is 287, df 3, Sig 0.000. I thought this means that the model is valid. But then, the Goodness of Fit tests are Pearson Chi-Square value of 272, dF 123, Sig 0.000 and Deviance Chi-Squrae 171.78, df 123, and Sig 0.002. I thought that meant that the model is bad. So, my first question is - is this model valid, and can I use the parameter estimates to tell me whether each of these factors is a significant predictor of professorship independent of the others?

Am I using the wrong tests to analyze this data?

Thank you so much for your time and assistance.

In your situation, it seems that you are interested in how gender affects the probability p of being a full/associate professor, after controlling for time since graduation and whether or not one has a PhD. (I doubt one can become a professor without a PhD, but that's another story.)

So the binary logistic regression model you would fit to the data would look like this:

log(p/(1-p)) = beta0 + beta1*Gender + beta2*Time + beta3*PhD


where log() denotes the log-transformation and p/(1-p) denotes the odds of being a full/associate professor. The expression log(p/(1-p)) is called the logit transform of p. (Note that a multinomial logistic regression would require your dependent variable to have 3 or more categories.)

Controlling for Time and PhD in your model allows you to study the effect of Gender on the probability p of being a full/associate professor (appropriately transformed via the logit transformation) among subjects in your target population for whom the time since graduation is the same and who share the same type of degree (e.g., they either all have a PhD or don't have a PhD).

There is no need to improve the model, since you are interested in the effect of Gender on the probability p controlling for the effects of Time and PhD. All you need to do is focus on the effect of Gender reported for your model and present the corresponding effect estimate, 95% confidence interval and p-value. (Note that you may need to exponentiate the reported effect to express it as an odds ratio, unless SPSS does it for you.)

As an example, let's say that you estimated the effect of Gender - expressed as an odds ratio - to be 1.45 (95% CI: 1.20 to 1.75; p-value = 0.001). Then you would conclude something along these lines:

Controlling for amount of time since graduation and whether or not one holds a PhD degree, the odds of being a full/associate professor were estimated to be 1.45 times higher in males compared to females (95% CI: 1.20 to 1.75). This finding indicated that gender has a statistically significant effect on the probability of being a full/associate professor (p-value = 0.001).

The above interpretation assumes that the Gender variable was coded so that 1 = Males; 0 = Females.

There is also no need to compare your model against the simpler model which includes just an intercept - instead, focus on the original model as that is the model which will help you answer the question you are interested in. However, you do want to see what the explanatory power of the model is by computing perhaps a pseudo R squared measure.

Most control variables are included in the model based on substantive grounds so they are kept in the model even if their associated p-values are not statistically significant.

The software you use - in this case, SPSS - will know how to treat each type of control variable. For example, a categorical control variable with 2 categories - A and B - will be coded in the model as a dummy variable with values 0 for category A and 1 for category B. A categorical control variable with 3 categories - A, B and C - will be coded in the model via two dummy variables. The first dummy variable will take the value 1 for category B and 0 for all others. The second dummy variable will take the value 1 for category C and 0 for all others. As the analyst, you get to choose which category you will treat as the reference against which the remaining categories will be compared. In these two examples, A was treated as the reference.

Your model was formulated based on the question you needed to answer. However, the model relies on certain assumptions which need to be verified from the data. So you should look into and check model diagnostics for your binary logistic regression model to ensure the data verify these assumptions.

Because the control variables are not of direct interest to you, the interpretation focus should be on the effect of gender.

• Thank you both, Isabella and a_statistician. Can you expound a little more on how to look into and check model diagnostics for the binary logistic regression model? What am I looking for in the pseudo R squared measures? Does it not matter that my goodness of fit tests have very high Chi-Square values (pearson = 225, deviance=131.686?). – Statsdunce Oct 21 '18 at 0:56
• Also, I also thought, for instance, that one of the assumptions for logistic regression is that there is no multicollinearity, but when I make a full model based on intuition (ie, PhD, M/F, years in practice, H-index, and number of publications), years in practice, H index, and pubs are significantly correlated with each other - so then do I need to remove 2 of these measures? – Statsdunce Oct 21 '18 at 0:57

Suppose you have a patient who needs 1000 cc blood for infusion (or transfusion?). Now 3 people come in and each of them contributes 20 cc blood, you have total 60 cc blood, but not enough for your need.

"the Chi-Square value is 287, df 3, Sig 0.000." means that "Sex (M/F) and PhD (Y/N) as categorical "factors" and years since graduation" contribute to be "associate or full professor (Y/N)", similar to 3 people really contribute some blood.

"the Goodness of Fit tests" tell you although 3 IVs can decrease the randomness of RV, but the randomness of RV still very large, similar although you have 60 cc blood, but it is far from your need.

• Thank you so much! Is there a different way I should be "controlling for" factors? Also, how do I improve the model? Only including variables with a p value of 0.1 or less from group-wise comparisons? – Statsdunce Oct 20 '18 at 22:42
• For controlling variables, you just put the variables into the model, if (1) there is evidence that variable has effect on outcome, mainly based on published paper; (2) you believe that variable has effect on outcome based on your medical knowledge and experience although no publications support it. My suggestion, for (1) even p value is high, should keep that variable in model, For (2), non-sig one can be excluded, especially, when sample size is small. For improvement of model fitting, try to find more related variables. Just like you need 940 cc blood,to find more people want to contribute. – user158565 Oct 20 '18 at 22:52