1
$\begingroup$

I wish to plot a continuous response variable (richness) against categorical predictors, but in doing so I need to control for a continuous 'nuisance' predictor (depth). My solution is to run a linear model of richness~depth, and then plot the residuals from the model instead of the raw data. However, in order to improve the model fit, I log-transformed the response variable. What implications does this have for plotting the residuals? Can I back-transform them? Would I be better to use an untransformed response and put up with the poorer fit?

$\endgroup$
1
$\begingroup$

Right, I think I’ve got this. My aim is to de-trend the data. In a model without transformation, this is response value – fitted value = response residuals. When the model is fitted with the response variable natural-log transformed, this is equivalent to response residuals = exp(response value) / exp(fitted value). Therefore, in an untransformed model, the residuals are the difference between response and fitted values; in the transformed model, the residuals are the ratio between the back-transformed response and fitted values. This means that raw data values – exp(fitted values from log model) = difference between raw and fitted values. This is the de-trended data that I’ve been after: the value that remains once the influence of this predictor has been removed.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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