Skip to main content
added 252 characters in body
Source Link

I’m working with primate brain data as a predictor in regression models. In the primate brain literature it is custom to log brain data, but it is unclear to me why. It has been argued that since one gram brain tissue means different things to primates of different size, it is the relative brain volume (among species) that is interesting, hence taking the log (does that make sense?).

By taking the log you enhance the impact of differences in small values in a regression, and the opposite for larger values?

In another post it has been argued that logging a predictor can be approximated with a polynomial regression such that

$𝛽_{0}+𝛽_{1}log(𝑃)β‰ˆπ›½_{0}+𝛽_{1}(π‘ƒβˆ’1)βˆ’π›½_{1}(1/2)(π‘ƒβˆ’1)^2+𝛽_{1}(1/3)(π‘ƒβˆ’1)^3βˆ’π›½_{1}(1/4)(π‘ƒβˆ’1)^4\\=𝛽^βˆ—_0+𝛽^βˆ—_1𝑃+𝛽^βˆ—_2𝑃^2+𝛽^βˆ—_3𝑃^3+𝛽^βˆ—_4𝑃^4$

If this is correct it means that logging a predictor correspond to a certain hypothesis about the relationship between X and Y. And that’s all it means, or am I missing something?

I have been trying to illustrate this and this is the code I came up with. However, I was expecting the regression lines to be more similar. Am I doing it right?

x <- rlnorm(100, 1)
log.x <-= log(x)
y <- rnorm(100, x, 5)

a = x-1
b = (1/2*(x-1))^2
c = (1/3*(x-1))^3
d = (1/4*(x-1))^4

f1 <- lm(y ~ poly(x,a 4)+ b + c + d)
f2 <- lm(y ~ log.x)

sa <- seq(min(xa), max(xa), length.out=1000)
b <- seq(min(b), max(b), length.out=1000)
c <- seq(min(c), max(c), length.out=1000)
d <- seq(min(d), max(d), length.out=1000)
t <- predict(f1, newdata = data.frame(xa = sa, b = b, c = c, d = d))

plot(y ~ log.x)
lines(log(sa), t, col = "red")

s <- seq(min(log.x), max(log.x), length.out=1000)
t <- predict( f2, newdata = data.frame(log.x = s))
lines(s, t, col = "blue")

I’m working with primate brain data as a predictor in regression models. In the primate brain literature it is custom to log brain data, but it is unclear to me why. It has been argued that since one gram brain tissue means different things to primates of different size, it is the relative brain volume (among species) that is interesting, hence taking the log (does that make sense?).

By taking the log you enhance the impact of differences in small values in a regression, and the opposite for larger values?

In another post it has been argued that logging a predictor can be approximated with a polynomial regression such that

$𝛽_{0}+𝛽_{1}log(𝑃)β‰ˆπ›½_{0}+𝛽_{1}(π‘ƒβˆ’1)βˆ’π›½_{1}(1/2)(π‘ƒβˆ’1)^2+𝛽_{1}(1/3)(π‘ƒβˆ’1)^3βˆ’π›½_{1}(1/4)(π‘ƒβˆ’1)^4\\=𝛽^βˆ—_0+𝛽^βˆ—_1𝑃+𝛽^βˆ—_2𝑃^2+𝛽^βˆ—_3𝑃^3+𝛽^βˆ—_4𝑃^4$

If this is correct it means that logging a predictor correspond to a certain hypothesis about the relationship between X and Y. And that’s all it means, or am I missing something?

I have been trying to illustrate this and this is the code I came up with. However, I was expecting the regression lines to be more similar. Am I doing it right?

x <- rlnorm(100, 1)
log.x <- log(x)
y <- rnorm(100, x, 5)

f1 <- lm(y ~ poly(x, 4))
f2 <- lm(y ~ log.x)

s <- seq(min(x), max(x), length.out=1000)
t <- predict(f1, newdata = data.frame(x = s))

plot(y ~ log.x)
lines(log(s), t, col = "red")

s <- seq(min(log.x), max(log.x), length.out=1000)
t <- predict( f2, newdata = data.frame(log.x = s))
lines(s, t, col = "blue")

I’m working with primate brain data as a predictor in regression models. In the primate brain literature it is custom to log brain data, but it is unclear to me why. It has been argued that since one gram brain tissue means different things to primates of different size, it is the relative brain volume (among species) that is interesting, hence taking the log (does that make sense?).

By taking the log you enhance the impact of differences in small values in a regression, and the opposite for larger values?

In another post it has been argued that logging a predictor can be approximated with a polynomial regression such that

$𝛽_{0}+𝛽_{1}log(𝑃)β‰ˆπ›½_{0}+𝛽_{1}(π‘ƒβˆ’1)βˆ’π›½_{1}(1/2)(π‘ƒβˆ’1)^2+𝛽_{1}(1/3)(π‘ƒβˆ’1)^3βˆ’π›½_{1}(1/4)(π‘ƒβˆ’1)^4\\=𝛽^βˆ—_0+𝛽^βˆ—_1𝑃+𝛽^βˆ—_2𝑃^2+𝛽^βˆ—_3𝑃^3+𝛽^βˆ—_4𝑃^4$

If this is correct it means that logging a predictor correspond to a certain hypothesis about the relationship between X and Y. And that’s all it means, or am I missing something?

I have been trying to illustrate this and this is the code I came up with. However, I was expecting the regression lines to be more similar. Am I doing it right?

x <- rlnorm(100, 1)
log.x = log(x)
y <- rnorm(100, x, 5)

a = x-1
b = (1/2*(x-1))^2
c = (1/3*(x-1))^3
d = (1/4*(x-1))^4

f1 <- lm(y ~ a + b + c + d)
f2 <- lm(y ~ log.x)

a <- seq(min(a), max(a), length.out=1000)
b <- seq(min(b), max(b), length.out=1000)
c <- seq(min(c), max(c), length.out=1000)
d <- seq(min(d), max(d), length.out=1000)
t <- predict(f1, newdata = data.frame(a = a, b = b, c = c, d = d))

plot(y ~ log.x)
lines(log(a), t, col = "red")

s <- seq(min(log.x), max(log.x), length.out=1000)
t <- predict( f2, newdata = data.frame(log.x = s))
lines(s, t, col = "blue")
Source Link

The log of a predictor and polynomial regression

I’m working with primate brain data as a predictor in regression models. In the primate brain literature it is custom to log brain data, but it is unclear to me why. It has been argued that since one gram brain tissue means different things to primates of different size, it is the relative brain volume (among species) that is interesting, hence taking the log (does that make sense?).

By taking the log you enhance the impact of differences in small values in a regression, and the opposite for larger values?

In another post it has been argued that logging a predictor can be approximated with a polynomial regression such that

$𝛽_{0}+𝛽_{1}log(𝑃)β‰ˆπ›½_{0}+𝛽_{1}(π‘ƒβˆ’1)βˆ’π›½_{1}(1/2)(π‘ƒβˆ’1)^2+𝛽_{1}(1/3)(π‘ƒβˆ’1)^3βˆ’π›½_{1}(1/4)(π‘ƒβˆ’1)^4\\=𝛽^βˆ—_0+𝛽^βˆ—_1𝑃+𝛽^βˆ—_2𝑃^2+𝛽^βˆ—_3𝑃^3+𝛽^βˆ—_4𝑃^4$

If this is correct it means that logging a predictor correspond to a certain hypothesis about the relationship between X and Y. And that’s all it means, or am I missing something?

I have been trying to illustrate this and this is the code I came up with. However, I was expecting the regression lines to be more similar. Am I doing it right?

x <- rlnorm(100, 1)
log.x <- log(x)
y <- rnorm(100, x, 5)

f1 <- lm(y ~ poly(x, 4))
f2 <- lm(y ~ log.x)

s <- seq(min(x), max(x), length.out=1000)
t <- predict(f1, newdata = data.frame(x = s))

plot(y ~ log.x)
lines(log(s), t, col = "red")

s <- seq(min(log.x), max(log.x), length.out=1000)
t <- predict( f2, newdata = data.frame(log.x = s))
lines(s, t, col = "blue")