Solved – Include a distance matrix as a random effect in a mixed-effects model

lme4-nlmematrixmixed modelrrandom-effects-model

I am trying to construct a mixed effects model and to include in it a measure of the (genetic) distance between observations, so that closer observation from different main effect levels will outweigh distant observations from different main effect levels.
I have constructed a similarity matrix for this purpose but the question now is how to incorporate it (or a transformation of it) in the model. From my understanding of the lmer function in R, random effects can only be a data frame column not a matrix.

Any ideas how to get that incorporated?

Best Answer

Two ways are apparently possible: Function MCMCglmm() in package MCMCglmm accepts both a (var-covar) matrix as well as a phylogenetic tree as an argument and function lmekin() in package coxme also accepts a var-covar matrix.