From: Gorjanc Gregor <Gregor.Gorjanc_at_bfro.uni-lj.si>

Date: Mon 12 Sep 2005 - 06:25:23 EST

mu <- 2

y <- mu + b * x + e

plot(y = y, x = x)

y <- mu + b1 * x + b2 * x^2 + e

plot(y = y, x = x)

University of Ljubljana

"One must learn by doing the thing; for though you think you know it, you have no certainty until you try." Sophocles ~ 450 B.C.

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Sep 12 06:31:17 2005

Date: Mon 12 Sep 2005 - 06:25:23 EST

Hello!

Scaling i.e. (x - mean(x)) / sd(x) of covariates in the model can improve the efficiency of estimation. That is nice, but sometimes one needs to report estimates for original scale. I was able to backtransform estimates of linear regression quite easily but I stumped on higher polynomials. Is there a general rule that I am not aware of or is my algebra so bad?

I appologize for not pure R question but I hope others will also benefit. I attached the R code for example bellow.

## --- Generate data for linear regression ---

e <- rnorm(n = 100, sd = 10) x <- rnorm(n = 100, mean = 100, sd = 10) b <- 3

mu <- 2

y <- mu + b * x + e

plot(y = y, x = x)

## Fit linear regression

(lm1 <- lm(y ~ x))

## Fit linear regression with transformed i.e. standardized covariate

(lm2 <- lm(y ~ scale(x)))

## Backtransform estimate of regression coefficient

coef(lm2)[2] / sd(x)

## --- Generate data for quadratic regression ---

e <- rnorm(n = 100, sd = 10)

x <- runif(n = 100, min = 1, max = 100)

b1 <- 2 b2 <- -0.01 mu <- 2

y <- mu + b1 * x + b2 * x^2 + e

plot(y = y, x = x)

## Fit regression

(lm1 <- lm(y ~ x + I(x^2)))

## Fit regression with transformed i.e. standardized covariate

(lm2 <- lm(y ~ scale(x) + I(scale(x)^2)))

## Backtransform estimates of regression coefficients

*## ??
*

Lep pozdrav / With regards,

Gregor Gorjanc

University of Ljubljana

Biotechnical Faculty URI: http://www.bfro.uni-lj.si/MR/ggorjan Zootechnical Department mail: gregor.gorjanc <at> bfro.uni-lj.si Groblje 3 tel: +386 (0)1 72 17 861 SI-1230 Domzale fax: +386 (0)1 72 17 888Slovenia, Europe

"One must learn by doing the thing; for though you think you know it, you have no certainty until you try." Sophocles ~ 450 B.C.

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Sep 12 06:31:17 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:40:09 EST
*