Skip to content

r: lm question

4 messages · Allan Clark, Roger Bivand, Ivar Herfindal +1 more

#
Hi all

this is a silly question since i should know the answer.

lm(y~x) perfroms linear regression with the intercept included.

How  do i estimate the equation without the intercept?

cheers
#
On Mon, 5 Jan 2004, allan clark wrote:

            
?formula:

"The '-' operator removes the specified terms, so that '(a+b+c)^2 - a:b'
is identical to 'a + b + c + b:c + a:c'.  It can also used to remove the
intercept term: 'y~x - 1' is a line through the origin.  A model with no
intercept can be also specified as 'y~x + 0' or '0 + y~x'."

Roger

  
    
#
I think this should work:

lm(y ~ x - 1)

Ivar

On Mon, 05 Jan 2004 11:30:39 +0200, allan clark <allan at stats.uct.ac.za> 
wrote:
#
allan clark <allan at stats.uct.ac.za> writes:
y ~ x - 1 (or y ~ x + 0)