Just center the data accordingly and force the regression through the "source":
lm(y ~ I(x-x0)-1, offset=rep(y0,nrow(dat)) data=dat)
You may then need to adjust the capture ratio accordingly.
edited : offset should be a vector of the correct length. Another way to do this:
set.seed(1) d <- data.frame(x=1:10,y=rnorm(10,mean=1:10,sd=0.1)) x0 <- 3 y0 <- 3 (lm1 <- lm(y ~ I(x-x0)-1, offset=y0, data=data.frame(d,y0)))
This gives a slope of 1.005. I think the interception will be coef(lm1)*(-y0/x0) .
source share