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
lm(y~x-1) -----Original Message----- From: allan clark [mailto:allan@stats.uct.ac.za] Sent: 05 January 2004 09:31 To: r-help@stat.math.ethz.ch Subject: [R] r: lm question 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@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help KSS Ltd Seventh Floor St James's Buildings 79 Oxford Street Manchester M1 6SS England Company Registration Number 2800886 Tel: +44 (0) 161 228 0040 Fax: +44 (0) 161 236 6305 mailto:kssg@kssg.com http://www.kssg.com The information in this Internet email is confidential and m...{{dropped}}
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