[R] how fit linear model with fixed slope?
Masca, Nicholas
nm180 at leicester.ac.uk
Fri Oct 22 16:23:58 CEST 2010
Hi,
It looks to me like you want to fit x as an offset (i.e. a variable with a fixed gradient of 1). If so, simply do:
lm(y~1+offset(x)) #for a model with an intercept
or
lm(y~-1+offset(x)) #for a model with no intercept
Cheers,
Nick
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Czerminski, Ryszard
Sent: 22 October 2010 15:14
To: r-help at r-project.org
Subject: [R] how fit linear model with fixed slope?
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()?
Regards,
Ryszard
--------------------------------------------------------------------------
Confidentiality Notice: This message is private and may ...{{dropped:9}}
More information about the R-help
mailing list