Skip to content
Prev 2532 / 7420 Next

Manually calculate residuals

now just another question popped up:

How do I have to handle the case when
variables are transformed?

the regression function is as follows:

log(y) ~ log(x1)+ log(x2) + sqrt(x3)

Is that way correct?:

#original data not transformed yet
df <- data.frame(y=runif(10), x1=1:10, x2=11:20, x3=1:10) 

# parameter estimates for from lm with transformed data
Intercept <- 0.5
b1 <- 0.6
b2 <- 0.7
b3 <- 0.8

df$yTheo <- Intercept + b1*log(x$x1) + b2*log(x$x2) + b3*sqrt(x$x3)

#how about the transformed y? this way?
df$resid <- df$y - exp(df$yTheo)
#or this way
df$resid <- log(df$y) - df$yTheo


Are the manually calculated residuals to those which are usually produced with resid(lm())? Or are there any standardizations of residuals etc.


/Johannes



-------- Original-Nachricht --------
--