Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
lme.1.combo <- lme(ComboRate ~ p_w, random = ~1 | Rat,data=x)

The line above will return a fitted intercept term, and a fitted beta (slope) term given these variables (allowing for random intercepts for each rat).

What I would like to do, is run the same regression, but with a FIXED slope. That is, if I keep the slope at a given value, what is the best fitting intercept going to be? So my output would be the best intercept value, given the slope value I assigned.

Is there a way to do this using lme or any other function in R?

share|improve this question

Yes. If you know that the slope is, for example, 1.5, then you just subtract 1.5 * p_w from the outcome and refit the model with just the intercept term. So, in your example:

x$ComboRate.adj <- x$ComboRate - 1.5 * x$p_w
lme.2.combo <- lme(ComboRate.adj ~ 1, random = ~1 | Rat,data=x)

This is the same as using an offset in your model.

To check that this works, first try using the actual slope estimate you got from the lme.1.combo model to make sure you get the same intercept estimate from the offset model.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.