1
$\begingroup$

I'm separately analyzing 5 subsets of my data and running multiple linear regressions with the same outcome variable in each. (I am also running a single regression with all the subsets and using the subset variable as a predictor, but it is useful to run separate regressions for each subset because the results are quite different for each subset, in ways you would not be able to tell from the overall regression.)

The outcome variable is continuous and, prior to the log-transformation, I was modeling it in its original form. It is usually positive but in some cases zero (for that reason, I add a constant when log-transforming it.)

The variable is highly skewed in 4 subsets so I'm log-transforming it with a constant, chosen separately for each subset to lower the skewness of the variable in that subset to acceptable levels.

The thing is, the variable in the 5th subset is only slightly skewed (.28), well within the acceptable range. However, if I have a single table illustrating all 5 regressions, it's going to be hard for any reader to compare the magnitude of coefficients across the different subsets if 4 of the subsets have a logged y variable and one of them doesn't.

So my question is, does it make any sense to log-transform the y variable for the slightly skewed subset too? Would this make the results more accurate?

I tried doing so, adding a constant to reduce the skewness all the way to .006. When I run the regression with the log-transformed y variable, the results are mainly the same, but now two additional x variables have statistically significant effects. So it really does change the overall results.

On the one hand, presenting my results this way would be easier to interpret for the reader, and now the outcome variable is utterly devoid of skewness. But on the other hand, it wasn't necessary to log-transform that y variable for that subset. Is there a risk I actually made my results less accurate? Is there any other reason why this is a bad idea?

$\endgroup$
11
  • 3
    $\begingroup$ Why would skewness of a variable indicate you need to transform it? $\endgroup$
    – Glen_b
    Sep 2, 2022 at 14:22
  • 4
    $\begingroup$ Hi Wisconsinite and welcome to CV! It would be nice to know the underlying reason for this being a common practice in your field. If that reason is related to the "normality" of your dependent variable (DV = Y), then it is likely not a good reason as "normality" of your DV is not an assumption of a linear regression models (if that is what you are modelling Y with). $\endgroup$
    – Fanfoué
    Sep 2, 2022 at 14:57
  • 2
    $\begingroup$ In addition to saying why you need to correct skewness in the outcome variable, please edit the question to say why you are modeling your data as 5 different subsets with the same outcome variable. A single model of all the data that incorporates the "subset" as a predictor in some way would seem to be a preferred and much more efficient use of data. $\endgroup$
    – EdM
    Sep 2, 2022 at 15:12
  • 2
    $\begingroup$ What's the nature of the outcome variable? Is it continuous, or is it something discrete like counts? Are you modeling it in its original form, or as a ratio or percentage or other transformation? Is it necessarily non-negative, or even necessarily positive? Again, please add that information by editing the question. $\endgroup$
    – EdM
    Sep 2, 2022 at 15:32
  • 2
    $\begingroup$ Seeing the data and learning more about the nature of the outcome variable really would help. (It's rare that either is utterly irrelevant.) Other possibilities include a generalized linear model with log link, which doesn't require that all values are positive, only that the mean outcome is, conditional on predictors. I agree that different transformations for different subsets are hard (dogmatically: impossible) to justify and that minimising skewness is not a major goal compared with getting the dependence of the outcome on the predictors well approximated. $\endgroup$
    – Nick Cox
    Sep 2, 2022 at 18:16

1 Answer 1

1
$\begingroup$

A separate model for each subset, each with a separate transformation of the same outcome variable, isn't a good approach. Your worry

...if I have a single table illustrating all 5 regressions, it's going to be hard for any reader to compare the magnitude of coefficients across the different subsets if 4 of the subsets have a logged y variable and one of them doesn't

holds even "with a constant, chosen separately for each subset" added prior to log transformation. A regression coefficient associated with an outcome of $\log(y+1)$ isn't on the same scale as one associated with an outcome of $\log(y+10)$.

The "results ... quite different for each subset" can be handled by going beyond a simple coefficient for subset to include interactions between other predictors and subset. In a single combined model you could examine the overall distribution of residuals and then decide how to proceed. As you note, it's the distribution of residuals that matters, not that of the original y values.

If you want to go the y-transformation route, choose a common transformation that provides an acceptable overall distribution in the combined model. That could be a single choice of constant prior to log transformation. Or it could be a different type of transformation entirely, like a square root transformation. You don't have to end up with an exactly normal distribution of residuals; they just have to be well enough behaved. You can also get robust estimators of coefficient (co)variances that can handle deviations from the simplest linear regression assumptions.

Perhaps better, avoid y-transformation entirely. Continuous outcomes can be modeled with ordinal regression. A proportional-odds model is an extension of standard non-parametric tests to regression models. Frank Harrell explains this in Chapter 13 of his course notes and book, and provides an orm() function in his rms package that's designed to handle continuous outcomes efficiently.

$\endgroup$
2
  • $\begingroup$ Thank you. I guess I am probably doing it wrong (I am in the process of learning this kind of thing on my own), but when I do what I think you're suggesting, creating a single interactive model using the interaction of factor(subset variable)*factor(ordinal predictor variable), then my results are completely different from what I obtain through doing separate regressions for each subset, which seems impossible. Beyond the technical issue of whether I'm doing this right, I don't understand how it can be wrong to separate the data into subsets since each are legitimate regressions... $\endgroup$ Sep 2, 2022 at 18:04
  • $\begingroup$ @Wisconsinite separate-subset analysis isn't necessarily wrong, but it's usually much less powerful. If you are getting apparently "completely different" results between that and a full-interaction model, there might be a problem with interpreting interaction-model results. With interactions, individual coefficients represent differences from the Intercept under baseline conditions, and the interaction coefficients are extra differences associated with combinations of interacting predictors. Try posting a new question with results from both approaches, asking why they seem to differ. $\endgroup$
    – EdM
    Sep 2, 2022 at 20:54

Your Answer

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

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