# Modeling Serial Values with Mixed-Effects Logistic Regression

My data has 264 subjects with their serial measurements. Event is death and sataset has 67 dead, 197 alive observations.

I'm trying to model repeated x and y measurements along with age and gender characteristics via Mixed - Effects Logistic Regression Model. My R code is below:

mel <- glmer(status ~ x + y + age + gender + (1 | time)+ (1|id), data = mydata, family = binomial, control = glmerControl(optimizer = "bobyqa"))

When I use this code, I encounter overfitting (I'm not sure this word is the best one to explain the situation). I mean, before modelling I have 67 events, after modelling, I have again 67 events, as predicted probabilities suggest.

On the other hand, when I try to model these repeated values via this other code below, it gave me an error like this:

mel <- glmer(status ~ x + y+age+gender+ (1 | time), data = mydata, family = binomial, control = glmerControl(optimizer = "bobyqa"))

Warning message: In checkConv(attr(opt, "derivs"), optpar,ctrl=controlpar,ctrl=controlcheckConv, : Model is nearly unidentifiable: very large eigenvalue - Rescale variables?

I'd like to know, if I'm missing something or doing it wrong.

• Can you provide a sample of the data? Have you checked that the numeric variables are considered numeric by R, and the factors are factors? – Nakx Nov 20 '17 at 10:57

Part of my data looks like this:

id time age gender x y

1 0 61 1 3,814621015 1,961307217

1 1 61 1 3,63347795 2,044523568

1 2 61 1 3,421073664 2,037971697

1 5 61 1 3,148801558 2,359346485

2 0 60 1 4,180261483 3,695965805

2 3 60 1 3,421073664 1,758059625

2 4 60 1 4,363847995 0,827560091

2 5 60 1 5,335078126 2,799822309

3 0 61 0 2,988464864 -2,037793335

3 2 61 0 2,967471914 -1,722773861

3 3 61 0 2,410342633 -1,59529577

When I check the numeric and factor variables, R again gave another error:

Warning messages: 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : unable to evaluate scaled gradient 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge: degenerate Hessian with 1 negative eigenvalues

I got confused. Any help would be greatly appreciated.

• Try to rewrite the data as.factor or as.numeric before you launch the glmer, by using: mydata$id <- as.factor(mydata$id) – Nakx Nov 21 '17 at 6:10