I'd like to know why my question (Quadratic terms in glmer) was closed here.

I think my question is not off-topic because it's about statistics and not about the programming itself. My question is regarding the quadratic and multiplication coefficients. So if I understand the theory, the programming is just putting those in the R function. In my question, it doesn't really matter if what package or function I'm using, because my question is regarding the logistic regression model coefficients!

My question was:

I'm looking for some references that explain step by step how to model logistic regression to longitudinal data (repeated measurements) in R. I know that I can use the "lme4" package and the function "glmer" for generalized linear mixed models, and I use it to add random effects. But I've read some stuff and sometimes people add quadratic terms and multiply and sometimes they don't. Can someone clarify me on this?

For example, on the book "Applied Longitudinal Analysis by Fitzmaurice", in chapter 14.7, he models the logistic regression for a dataset like this:

model1 <- glmer(y ~ time + time2 + trt.time + trt.time2 + (1 | id), family=binomial, nAGQ=50, na.action=na.omit)


$time2 <- time^2$

$trt.time <- trt \times time$

$trt.time2 <- trt*time2$

Why doesn't he simply use model1 <- glmer(y ~ time + trt+ (1 | id), family=binomial, nAGQ=50, na.action=na.omit) ??? I run this last model in R and the AIC and BIC are basically the same.

This is the type of questions that I'm having concerning the R code on this matter. I can't find many literature with R on logistic regression for longitudinal data, and this all very confusing. Can someone explain me when to use quadratic terms, or multiply/add them? Or recommend me a reference.

I also found this topic LINK but didn't help much.

Thanks in advance

  • $\begingroup$ Seems out-of-date. The question is not closed as I write. But emphasising again and again that you want advice on what to do in R was presumably what triggered any closure. The trick is to write a question without any reference to software whatsoever! Otherwise the question of when to add quadratic terms is fair, but a good answer is hard beyond whenever the data or theory seem to imply that they are a good idea. $\endgroup$
    – Nick Cox
    Dec 11, 2019 at 18:29
  • 5
    $\begingroup$ I'm voting to close this question as off-topic because the question concerned is no longer closed. $\endgroup$
    – Nick Cox
    Dec 11, 2019 at 18:30


Browse other questions tagged .