# Understanding offsets for continuous variables

I'm currently trying to write a linear model with data from some behavioural experiments with termites.

I started to read Ben Bolker's "Ecological Models and Data in R", which has been a great help. My main independent variable is a measure of relatedness, and I'm interested in how behaviour between termites changes in response to relatedness. The response variable is continuous and consists of an aggression index, constructed by counts of differently weighted behaviours divided by the total amount of observed behaviours per experiment.

I realised that considering how the response variable is constructed, we would expect a value of 0.1 as the default, when termites are highly related. This would be at a relatedness value of 0.5, indicating full siblings. I was looking into how to specify the intercept in linear models with the offset function, and I found a solution to easily tell the model that the baseline response should be 0.1. However, this seems to apply to the idea that the intercept is specified for when all dependent variables are 0.

This might be a very trivial issue, but how would you specify an intercept for a specific value of a continuous dependent variable? 0 makes sense in many contexts, but with the relatedness measure we use, a value of 0 and it's effect is what we want to investigate, since it represents no relatedness, and it's not the default.

Or more exact: is there a way of writing the lm formula to specify that for a specific value of x, in this case 0.5, one would expect a response y of 0.1?

• An offset seems unnecessary here. Subtract 0.5 from x, 0.1 from y and then force the line through the origin. Having said that you are making some very strong assumptions as indicated by EdM in an answer so you would need to be prepared to justify your choice of model. – mdewey Jun 7 at 16:00
• the assumptions are based on the idea that 0.1 is the lowest possible number for the response variable, if any observations happen at all. it basically ranks interactions between individuals, and there is no 0 interaction rank, unless no observation was made – Leovar Jun 7 at 16:56

It's probably not a good idea to impose your a priori expectation about an intercept on a model, just like it's generally not a good idea to force a linear regression through the origin. It sounds like you have an hypothesis that your outcome measure will be 0.1 when your relatedness predictor has a value of 0.5. It would be much better to let the data help you test that hypothesis. Note that an offset() term models a predictor whose slope is fixed at 1, in any event.

There is, however, an important way that an offset could improve your model. You say:

The response variable is continuous and consists of an aggression index, constructed by counts of differently weighted behaviours divided by the total amount of observed behaviours per experiment.

It's often best to model as closely as possible to the original counts. When the total number of possible counts per observation can differ due to different areas sampled, time spans evaluated, or observed total behaviors (as in your case), including the log of the area/time/total_behaviors in an offset() term with a log-link Poisson generalized linear model lets you model the rate as a function of other predictors (as expressed in the regression coefficients) directly. That's nicely explained on this page. That said, an offset isn't always appropriate, as explained in this answer.

• Alright, I suppose there was a misunderstanding on my part regarding what an offset() term does. This whole idea came from the observation that the intercept given by the models I've tried so far does not really make sense, if it refers to a value of 0 for the independent variable. Thank you. I do not quite understand how the second part applies here though. From my understanding, a poisson glm works only on a discrete response? Technically the index is comprised of the sum of four different behaviours divided by the total amount of behaviours, so I'm not sure whether that would work. – Leovar Jun 7 at 16:48
• @Leovar both your "sum of 4 different behaviours" and the "total amount of behaviours" seem to be discrete count variables. What I'm suggesting is to model the count of "sum of four different behaviours" with a log-linked Poisson glm, using the log of the corresponding "total amount of behaviours" as the offset. That way, the coefficient for each of your predictors is its association with a change in your "aggression index"; the intercept will be the "aggression index" at baseline conditions, and you can test whether index = 0.1 when relatedness = 0.5, as you expect. – EdM Jun 7 at 16:58
• The "sum of 4 different behaviours" is not discrete, since each behaviour is weighted differently (a*0.1, b*0.2, c*0.5, d*1, a to d being the behaviours). Which is also why I thought that it would make sense to tell the model that 0.1 is the lowest value the response can be. This index was not constructed by me, but I do have to work with it, unfortunately. I do get the idea though, it sounds like a good approach. – Leovar Jun 7 at 17:07
• @Leovar do a through d encompass all the behaviors, or are there more behaviors contributing to the denominator of your index? – EdM Jun 7 at 17:16
• it's just those four, yes. They basically describe a range of four behaviours from non-aggressive to highly aggressive. – Leovar Jun 7 at 17:20