# Non-normal random effects in a logistic GAM

I have estimated the following GAM using the mgcv package:

sex ~ factor + s(x0, by = factor, bs = "ps", k = 20) +
s(x1, bs = "ps", k = 20) + s(x2, bs = "ps",
k = 20) + s(x3, bs = "ps", k = 20) + s(x4, bs = "ps",
k = 20) + s(x5, bs = "ps", k = 20) + s(x6, bs = "ps",
k = 20) + s(mun, bs = "re") + s(region, bs = "mrf",
xt = xt)


However, when plotting the results, the random effect does not seem to follow a Gaussian distribution. Is there a way to correct that to improve the model?

• What information, coming out of the model, are you hoping to improve? – whuber Nov 22 '18 at 15:08
• @whuber: I am guessing he would like the distribution of the random effects for municipalities (mun) to look closer to normal? 🤔 – Isabella Ghement Nov 22 '18 at 15:15
• Yes, that is exactly what I am looking for. Thanks Isabella – Johny Arm Nov 22 '18 at 15:17
• This article - albeit about GLMMs not GAMMs - may come in handy: arxiv.org/pdf/1201.1980.pdf. – Isabella Ghement Nov 22 '18 at 18:07
• For more reading, see also: niasra.uow.edu.au/content/groups/public/@web/@inf/@math/…. – Isabella Ghement Nov 22 '18 at 18:23

## 1 Answer

You may not want or need to worry about the departure from the normality assumption. Wood (2013) shows (in the Supplementary Materials, and mentioned in the text) that the test of the random effect term (as shown/performed in a call of summary() on the estimated GAM) is quite robust to failures of the normality assumption for the random effects.

So, if you are wanting to improve the distribution of the random effects to better meet the assumptions of the test of the variance component, you may not need to, except at quite small sample sizes (Simon mentions some loss of power at a sample size of 100, for example).

Should you (we) even care about the distribution? If you are just including this in the model to account for clustering in the data, perhaps we could simply appeal to Hodges (2016) and consider the penalized spline version of random effects as a convenient computational trick to estimate the things we want to estimate?

References:

• Hodges, J. S. 2016. Richly Parameterized Linear Models: Additive, Time Series, and Spatial Models Using Random Effects, CRC Press.
• Wood, S. N. 2013. A simple test for random effects in regression models. Biometrika 100: 1005–1010. doi:10.1093/biomet/ast038