# Can I use a non-linear mixed model for data containing both linear and quadratic relationship?

I have dataset with both linear and quadratic relationships for my response variable among individuals. My dataset includes individuals sampled from two populations (9 individuals from population A and 8 from population B). For each individual I have measured stable nitrogen-isotopes from 9 sequentially grown wing feathers (time series).

I have two hypotheses:

1. their are differences in the mean isotope values across the wing for individuals between the two regions
2. their differences in the variation of the isotope values across the wing for individuals between the two regions

I must admit I am a novice to mixed models. Originally I had falsely assumed that my data for each individual were 'linear'. Thanks to Ben Bolker I now know how to test these assumptions and have discover one individual from the 17 has a quadratic relationship. I had built the following GLMMs using the 'nlme' package in 'R' before discovering my error:

model1 <- lme(Delta15N ~ factor(Population), method = "REML", data = Data, random = ~ 1 | Individual, correlation = corAR1(form = ~ 1 | Individual))

model2 <- lme(Delta15N ~ factor(Population)*Feather, method = "REML", data = Data, random = ~ 1 | Individual, correlation = corAR1(form = ~ 1 | Individual))


Can you please suggest a reference or example code that I might use to correctly model my data?

I think you may be confusing nonlinearity in the parameters with nonlinearity in the variables. As in ordinary least squares, you can have quadratic terms in a linear model. A nonlinear mixed model usually refers to a dependent variable that is not continuous.

Just as an OLS model can be represented as

$Y = X\beta + \epsilon$

so a linear mixed model can be represented as

$Y = X\beta + Z\gamma + \epsilon$

and so you can have quadratic terms.

• When I plot my data (feather isotopes by feather position), one of my individuals shows a nice "U"-shaped curve. I am not sure how to rephrase my question more clearly. Delta15N is my dependent variable. – Keith Larson Feb 12 '13 at 11:44
• No, I don't think you do. But it may be tricky to handle a quadratic relations for just ONE person (just as it would for an OLS model). – Peter Flom - Reinstate Monica Feb 12 '13 at 11:46
• I understand, but it hardly seems reasonable to throw out one individual because they did not do what everyone else did! – Keith Larson Feb 12 '13 at 11:49