# [R-sig-ME] Random effect with two contributions for each record

Albart Coster albart at dairyconsult.nl
Mon May 31 15:49:19 CEST 2010

```Dear list,

I am working with genetic data and puzzling with the following problem.
An individual inherits one allele from each of his parents and both
alleles contribute an unknown quantity to its phenotype. If we want to
model his phenotype, we can write it as P = a0 + a1. Now, imagine that
we have 3 alleles, numbered 1, 2, and 3. Then, we can have the following
individuals:

i1: 11
i2: 12
i3: 13
i4: 22
i5: 23
i6: 33

if the order of the alleles does not matter. Now, I would like to fit
this in a model where the effect of the alleles is random and with a
single variance term for all the alleles. The problem is that each
individual can have 0, 1, or 2 copies of each allele while in the normal
(Z) matrix of a mixed model we can only have 0's and 1's. Fitting it as
follows in lme4 will not give the correct solutions:

lmer(P~1 + (1|a0) + (1|a1),data = df)

if I have a data.frame with three columns, P is the phenotype, a1 is the
first allele and a2 is the second allele.

Thanks in advance for considering this,

Albart Coster

```