problem-3.30
problem-3.30
The slope appears in the output of lm(). The scatterplot
shows a linear trend between the transformed variables that is not
apparent in a scatterplot of the original variables.
> library(MASS) # loads data set and lqs()
> names(Animals)
[1] "body" "brain"
> plot(log(brain) ~ log(body), data = Animals)
> res = lm(log(brain) ~ log(body), data = Animals)
> res
Call:
lm(formula = log(brain) ~ log(body), data = Animals)
Coefficients:
(Intercept) log(body)
2.555 0.496
To compare to the output of lqs().
> lqs(log(brain) ~ log(body), data = Animals)
Call:
lqs.formula(formula = log(brain) ~ log(body), data = Animals)
Coefficients:
(Intercept) log(body)
1.816 0.776
Scale estimates 0.464 0.463
There are three influential points in the scatterplot of the
log-transformed data causing the big change in the slope of the
regression line.