Linear Regression with explicit intercept in R?

You could subtract the explicit intercept from the regressand and then fit the intercept-free model.

You could subtract the explicit intercept from the regressand and then fit the intercept-free model: > intercept fit summary(fit) The 0 + suppresses the fitting of the intercept by lm. Edit To plot the fit, use > abline(intercept, coef(fit)) P.S. The variables in your model look the wrong way round: it's usually y ~ x, not x ~ y (i.e. The regressand should go on the left and the regressor(s) on the right).

2 or I(x - 1.0)~ y-1 surpresses the fitting of the intercept as well. – Joris Meys Sep 7 at 11:47 2 @Joris Meys: Yes. I believe the two ways are synonymous.

I chose the other way to avoid having two -1 terms and having to explain which is which. – aix Sep 7 at 11:48 But when I plot the regression-curve abline(regExp, col="green"), it does not go through 1. I have not figured out how to extract the slope (and/or intercept) from the lm ouput.

For mee it seems that you always have to know the position of the values in the coef-array, and than extract in (and hope that the position is right). So, is the following code the "golden way" to plot the correct regression curve? Abline(b=coef(regExp)1, a= explicitIntercept, col="green") – Sven Sep 7 at 12:20 @Sven: abline(1.0, coef(fit)) plots the fit (here, 1.0 is the explicit intercept).

I've updated the answer to include this. – aix Sep 7 at 12:36 2 See also the offset argument. – Aaron Sep 7 at 13:20.

I see that you have accepted a solution using I(). I had thought that an offset() based solution would have been more obvious, but tastes vary and after working through the offset solution I can appreciate the economy of the I() solution: with(lin, plot(y,x) lm_shift_up.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions