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
r: lm question
4 messages · Allan Clark, Roger Bivand, Ivar Herfindal +1 more
On Mon, 5 Jan 2004, allan clark wrote:
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?
?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
cheers
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: Roger.Bivand at nhh.no
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:
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
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
allan clark <allan at stats.uct.ac.za> writes:
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?
y ~ x - 1 (or y ~ x + 0)
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907