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-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Czerminski, Ryszard Sent: 22 October 2010 15:14 To: r-help@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}} ______________________________________________ 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.