On Tue, 14 Aug 2007, [EMAIL PROTECTED] wrote: > > Hi there, am trying to run a linear regression with a slope of 0. > > I have a dataset as follows > > t d > 1 303 > 2 302 > 3 304 > 4 306 > 5 307 > 6 303 > > I would like to test the significance that these points would lie on a > horizontal straight line. > > The standard regression lm(d~t) doesn't seem to allow the slope to be set.
lm(d ~ 1) does, though, to zero. More generally you can use offset(), e.g. lm(d ~ offset(7*t)) forces a slope of 7. -- Brian D. Ripley, [EMAIL PROTECTED] 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 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.