This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Adjusting data for covariates

I have a bunch of parameters to adjust for continuous/categorical covariates (age and sex) and I found out about using residuals as adjusted data. I have one question about this procedure. We possibly get negatives and positives given that residual= original-predicted. Do we need to take only the absolute value of the residuals as the adjusted data? any help on this is kindly appreciated.

Here is a summary of my question.

Let's say I have parameter 'Z' corresponding ages are 'age'.

Z <- c(0.9,1.2,3.0,4.5,0.8,0.4)
age <- c(30,22,45,60,33,20)

fit <-lm(Z~age)
adjusted<- fit$residuals + fit$coefficients["(Intercept)"] # this is the residual

This gives -2.1 -1.0 -1.5 -1.5 -2.5 -1.6 as adjusted Z for age bias. but Z supposed to be positives. Is this acceptable. Can I report these negatives as adjusted values for covariate age or should I get the absolute value of residuals?

A similar post is here: Adjust for covariates

r

You should include some example data and code, otherwise it would be difficult to give any sort of specific example.

You can get residual with adjusted <- resid(fit)

And it is ok with negatives, as Z is now a different variable. It is the residual of Z on age and it doesn't need to fall within a predefined range.

0 answers

No answers yet.

Log in to answer this question.