Adjusting data for covariates
0
2
Entering edit mode
3.2 years ago
chutt ▴ 20

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 • 979 views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 2629 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6