Hello everyone, Quick question...is there a way of specifying a y-intercept value within a lm statement. For example, if I wanted to specify the regression to pass through the origin I would enter lm(y~0+x). But can I specify an actual term such as 1,2,3,4, etc. as an intercept value? Thank you! -- Benjamin Zuckerberg Doctoral Candidate State University of New York College of Environmental Science and Forestry Illick 244A, 1 Forestry Drive Syracuse, New York 13210 Tele: (315) 470-6985 E-mail: bzuckerb at syr.edu
G'day Benjamin, On Mon, 6 Aug 2007 22:49:04 -0400 Benjamin Zuckerberg <bzuckerb at syr.edu> wrote:> Quick question...is there a way of specifying a y-intercept value > within a lm statement. For example, if I wanted to specify the > regression to pass through the origin I would enter lm(y~0+x). But > can I specify an actual term such as 1,2,3,4, etc. as an intercept > value? Thank you!Not tested, but lm(y-1~x+0) should work for an intercept value of 1. But I have to wonder why you are interested in this. Isn't regression through the intercept already bad enough? ;-) HTH. Cheers, Berwin
?offset : you can specify a different intercept for each case, or a common one. Or you could just use lm (y - 3 ~ 0 +x), but offset() works better for prediction. On Mon, 6 Aug 2007, Benjamin Zuckerberg wrote:> > Hello everyone, > > Quick question...is there a way of specifying a y-intercept value > within a lm statement. For example, if I wanted to specify the > regression to pass through the origin I would enter lm(y~0+x). But > can I specify an actual term such as 1,2,3,4, etc. as an intercept > value? Thank you! >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595