# control for non-linear effect in a model with two continuous predictors and one categorical DV

Suppose I ask subjects to rate foods from very sour to very sweet, on a scale of from -10 to +10.

They say things like A (lemon) is very sour, -10, but B (bread) is pretty sweet, +5.

Now I say 'ok pick one' of A or B - a choice between lemon and bread. They pick one.

I want to model how their valuation of the foods predicts which one they pick (e.g. if they prefer higher valued foods, they like sweet food; if they prefer lower valued foods, they prefer sour foods).

For this, I will use: glm(food~difference, data=data, family=binomial)

...where 'difference' is the value assigned to food A minus the value assigned to food B.

However, I want to add a control to ensure that it is the direction of the difference (e.g. they prefer sour, or they prefer sweet), rather than the 'extremeness' of the values that predicts which food they pick. For example, it could be the case that subjects like very sweet food and very sour food, but don't really like medium foods. In other words, a non-linear effect.

This is what I was thinking of doing:

i) calculate the absolute value of the A ratings, and the absolute value of the B ratings

ii) calculate the difference between these, A-B; let's call this "abs.diff"

iii) use abs.diff as a fixed-effect in the model, giving me:

glm(food~difference+abs.diff, data=data, family=binomial)

If difference is significant, but abs.diff is not, then I've ruled out that it is the extremeness of the rating that produces the effect, but instead it must be that they prefer either very sweet or very sour.

Is this correct?

Thanks for any insights!

## 1 Answer

I would suggest using glm(Y ~ x + y + (x+y)^2, family = binomial(link = "logit")) This will allow you to capture the linear effect between the ratings, any interaction terms and some higher order effects.

Because glm will find your coefficients you can interpret it as the differences $$X-Y$$ and $$(X-Y)^{2}=X^{2}-XY+Y^{2}$$. Note that when you plug the model into the glm you should pre-specify the higher order terms and maybe use poly(x,2) to get orthogonal arrays so you don't get too much multicollinearity.

• Thanks! However I prefer difference conceptually as main measure (and worry about reducing power by splitting the measures). What I’m asking is if my second measure - abs.diff - makes sense as a measure for the non linear affect? – cathalcom Feb 10 at 6:25