On Fri, Oct 22, 2010 at 9:13 AM, Czerminski, Ryszard
<ryszard.czermin...@astrazeneca.com> wrote:
> I want to fit a linear model with fixed slope e.g. y = x + b
> (instead of general: y = a*x + b)

> Is it possible to do with lm()?

Yes.  The simplest way is to fit

lm(y - a*x ~ 1)

which will give you the estimate of b, its standard error, etc.

An alternative is to use an offset argument or an offset() expression
in the model formula

lm(y ~ 1 + offset(a*x))

______________________________________________
R-help@r-project.org 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.

Reply via email to