# Linear mixed effects model - I can't seem to avoid either convergence errors or messy residuals

I am attempting to run a linear mixed effects regression using the lme4qtl R package. This is a package very similar to lme4, but it allows you to specify a kinship matrix so that you can account specifically for family structure in the model.

The variable I want to predict is a measure of connectivity between two brain regions. The predictor is a measure of alcohol intake over the past 7 days, with additional covariates being gender, age in years, and years in education. I have just under 1200 participants. The model looks like this:

    relmatLmer(Brain_Connection ~ Drinks_7days +
Age_in_Yrs + Gender + Yrs_in_Education +
(1|Family_ID) + (1|Subject), data = df, relmat =
list(myID = kinship_matrix))


When I run this with the raw data I get convergence errors like this:

    Model failed to converge: degenerate  Hessian with 1
negative eigenvalues


To get around this I have tried many ways to transform the data. I have tried scaling the data, using log, inverse log, sqrt, or cube transforms. However with the exception of the scaling method (either for the drinking variable, or the brain connectivity one), these still give me convergence errors. After getting through this stage, when I then run residual diagnostics they are not normally distributed.

My question is - is there a more sensible way to figure out what may be happening other than transforming the variables in different ways and hoping for the best. Second, if the scaling method is the only one that doesn't lead to convergence errors, but the residuals are still not normal, does this mean that this model is simply incorrect or not appropriate? If so, how can I go about assessing a relationship between the variables?

The raw drinking data looks like this:

The raw connectivity data looks like this:

The residuals from the 'successful' scaled model look like this:

As you can probably tell I am quite new to this so please forgive me if this is a silly question.

Sam

• Have you taken a look at this? rstudio-pubs-static.s3.amazonaws.com/…
– mkt
Jul 12 '19 at 14:51
• Also relevant, possibly not duplicates: stats.stackexchange.com/questions/164457/… and stats.stackexchange.com/questions/242109/…
– mkt
Jul 12 '19 at 14:52
• Two approaches: 1. Write the model mathematically and check if the model has problem. 2. Fit the simplest model first (model with fixed effects only), then add the random effect piece by piece to isolate where the not convergence come from. Jul 12 '19 at 15:51
• @mkt Sadly the linked article (and many other online solutions) don't use R packages that work with lme4qtl. I tried running a simpler model, but the convergence errors went away. However, after speaking to a colleague, we discovered that excluding the (1|Family_ID) term, as well as inv log transforming the dependent variable, got rid of the convergence errors and also produced normally distributed residuals. I think this worked because family structure was already being modelled by the kinship matrix. Thank you for your input, if you have further comments please feel free to let me know.
– S B
Jul 15 '19 at 15:04
• @mkt Okay, I have done so. Thanks again for your help and feedback, much appreciated as a new user.
– S B
Jul 16 '19 at 17:35

Turns out that excluding the (1|Family_ID) term, as well as inv-log transforming the dependent variable, got rid of the convergence errors and also produced normally distributed residuals. I think this worked because family structure was already being modelled by the kinship matrix. Many thanks to the other users for your helpful and kind input.

It seems that the model fitting code should be as follows.

relmatLmer(Brain_Connection ~ Drinks_7days +
Age_in_Yrs + Gender + Yrs_in_Education +
(1|Family_ID) + (1|Subject), data = df, relmat =
list(Subject = kinship_matrix))


ID variables in formula of RE and relmat argument need to be the same. In this example the ID variable is Subject, so the kinship matrix is associated with Subject rather than MyID.

I also created the issue and updated the code to version 0.2.2. Now the users at least get a warning when ID variables are not married.

• I did catch this issue in the end, but thank you for pointing this out and creating a warning - it did cause me some confusion for a while :)
– S B
Sep 6 '19 at 12:41