Dear R-users: I am doing multiple regressions using the "lm" function and would like to force the intercept to be equal to a specific value (such as 4.3). I was able to find out how to force it through the origin but this does not work for other values. I am also interested in forcing the regression parameters obtained from one regression in another regression with a subset of the data. Are either of these possible in R? I have been searching the help guide for hours and have been unsuccessful. Many thanks, Heather
you can just subtract 4.3 from the independent variable and then do through zero. That will Give you a force through 4.3. I don't undersarand the second part of your statement. -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Heather Maughan Sent: Monday, November 13, 2006 6:31 PM To: r-help at stat.math.ethz.ch Subject: [R] Forcing the intercept Dear R-users: I am doing multiple regressions using the "lm" function and would like to force the intercept to be equal to a specific value (such as 4.3). I was able to find out how to force it through the origin but this does not work for other values. I am also interested in forcing the regression parameters obtained from one regression in another regression with a subset of the data. Are either of these possible in R? I have been searching the help guide for hours and have been unsuccessful. Many thanks, Heather ______________________________________________ R-help at 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. -------------------------------------------------------- This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}
On Mon, 13 Nov 2006, Heather Maughan wrote:> Dear R-users: > > I am doing multiple regressions using the "lm" function and would like to > force the intercept to be equal to a specific value (such as 4.3). I was > able to find out how to force it through the origin but this does not work > for other values.?offset, e.g 0+x1+x2+offset(rep(4.3, 127)) You could also use y-4.3 ~ rhs, but that gives problems for prediction.> I am also interested in forcing the regression parameters obtained from one > regression in another regression with a subset of the data.That makes no sense to me: do you just want to predict the fit on a subset? If so use predict() or fitted().> Are either of these possible in R? I have been searching the help guide for > hours and have been unsuccessful.Not sure what 'the help guide' is, but you need a book about doing statistics with R. -- 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