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?


1 Answer 1


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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