I have a dataset (N = 158) and the following variables that I am going to put into a regression model:

  • Y (a continuous dependent variable)
  • X (a continuous predictor)
  • Z (a continuous predictor)
  • GENDER (a binary predictor)

Initially, it was pretty straightforward that I just simply needed to use linear regression analysis to analyze this data. Before modeling, however, I found that the variable of GENDER (male [n=110], female [n=48]) has an unequal variance in my dependent variable of Y as indicated by a significant Levene's Test for Equality of Variances, and this result indicates a violation of homoscedasticity.

I'm not sure if I understood this case correctly, but based on my knowledge, in such a case I will need to add GENDER as a covariate into the model to control for its impact (please correct me if I was wrong). However, due to its unequal variance, I probably need to do some transformation for GENDER before modeling as GENDER does violate the assumption of homoscedasticity. If my understanding of above statement was correct, here are my questions:

First, can I do Logarithmic Transformations to a binary variable (GENDER) in this case?

Second, after the issue of violation of homoscedasticity was addressed, I wonder if I could use dummy-variable regression to run analysis in my case (assuming no interaction) or I have to use ANCOVA?


1 Answer 1


You'll need to revise your question as it is currently confusing. If you have the variables Y, X and Z in your regression, where does Gender come into it?

Let's say you have a variable W which is Gender, which you will include as a predictor in your model along with X and Z. Then you can fit a linear model (via ordinary least squares) which uses Y as the outcome variable and includes main effects for X, Z and W (say) and assumes homoscedastic errors. You can then obtain the residuals for this model and plot them against each predictor variable.

If the plot of residuals versus W indicates that the residuals are more variable for one gender versus the other, then you need to allow the error variability to be different across genders. In that case, you can use generalized least squares regression instead of ordinary least squares regression to fit the revised model. Note that it is the plot of residuals versus W that you need to examine, not the plot of Y versus W.

  • 1
    $\begingroup$ Hi Isabella, thank you SOOO much for your detailed illustration. This does make more sense to me. And, you are right about my confusing description of the scenario. The model will have X, Y, Z, and GENDER since literatures indicate a gender difference in the outcome variable. I am going to do this again following with your suggestion. Again, thanks much for your input, really appreciated! $\endgroup$
    – adonies
    May 10, 2018 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.