Displaying 1 result from an estimated 1 matches for "lm_xy".
Did you mean:
lm_pw
2008 Oct 21
0
Major Axis residuals
..., but I'd
prefer not to have to do that.
Any advice would be appreciated!
--tim
Sample code illustrating the situation follows:
library(smatr)
par(mfrow = c(1, 3), pty = "s")
x <- 1:100 + 50 * runif(100)
y <- 1:100 + 50 * runif(100)
z <- data.frame(x = x, y = y)
plot(z)
lm_xy <- lm(z$y ~ z$x)
abline(lm_xy, col = "blue")
z$lm_resid <- z$y - (z$x * coef(lm_xy)[2]) - coef(lm_xy)[1]
ma_xy <- line.cis(y = z$y, x = z$x, method = 2)
abline(ma_xy[1,1], ma_xy[2,1], col = "red")
z$ma_resid <- (z$y - (ma_xy[2,1] * z$x) - ma_xy[1,1])/
sqrt((ma_xy[...