# How to choose between linear or nonlinear mixed model?

I don't really understand when it come to mixed model,
how do you know when to use linear or nonlinear model?

For example, when using R function lmer to build linear mixed model, my model may look like this:

lmer( Y ~ X1 + X2 + X1*X2 + (1|Z) )


where $Y$ is the response (from a repeated measured data), $X_1$ and $X_2$ are fixed effects and $Z$ is the random effect.

Does this means when you pick these effects up to see their relation separately, like Y~X1 and Y~X2, both has to be linear so than you can use linear mixed model?

What if Y~X1 is nonlinear and Y~X2 is linear? Should I use nonlinear mixed model when this is the case?

• what is the last term i.e.1/Z . and how do we compute Z here . What is Z ? Just for my understanding your model. ? – Subhash C. Davar Mar 14 '17 at 3:14

It's not exactly about whether the relationships between Y and the various X are linear or not; a linear model is one that is linear in the parameters (just like the case with nonmixed models). So

$Y = a + b_1X_1 + b_2X_2^2 + b_3X_3$

is linear, but if there are parameters (b) in the exponents, it is not.

Usually, nonlinear mixed models are used when Y is not continuous. They are used for the mixed versions of logistic regression, count regression and so on.

• Logistic regression (which is a generalized linear model) is usually considered to be a linear model and not a "nonlinear model". – amoeba says Reinstate Monica Dec 25 '16 at 13:55
• Yes, but to do a mixed logistic model, you need to use (in SAS) GLIMMIX or NLMIXED. The terminology is very confusing. Logistic regression is linear if you take the logit as the DV. It is not linear in the original DV. – Peter Flom - Reinstate Monica Dec 25 '16 at 14:09
• I agree that the terminology is confusing. But mixed logistic is a generalied linear mixed model (GLMM) and in my experience people usually do not call it "nonlinear". – amoeba says Reinstate Monica Dec 25 '16 at 14:12
• Right, but in R, there is the nlme package, where the N stands for nonlinear. In SAS you can't use MIXED (which is for linear). Anyway, we agree on the facts, it's just the terms that are confusing! I, for one, don't like the use of "mixed" because "fixed" and "random" also get confusing. Plus there's the general linear model and the generalized linear model! Oy vey! – Peter Flom - Reinstate Monica Dec 25 '16 at 14:42
• @amoeba, I would say that GLiMs are linear in a transformed space, but not in their 'native' space. I think the terminology here is rather fraught. – gung - Reinstate Monica Dec 28 '16 at 15:31

Linear mixed-effects model presumes that there are fixed -effeets and random effect. lmer does imply that Y tends to be linearly related with X1 as well as X2. In case X1 is nolnlinearly related to Y and X2 is linearily related to Y, non-linear mixed model is not recommended. You can log-tranform X1 the variable which is non-linearly related to Y and use lmer.