Terry Therneau
2013-Jun-04 13:51 UTC
[R] Mixed effects model with a phylogenetic tree/ distance, matrix as a random effect
Take a look at lmekin() in the coxme package. The motivating data set for my development of coxme was the Minnesota Family Breast Cancer project: 24050 subjects in 462 families. The random effect is an intercept per subject with sigma^2 K as its variance where K is the kinship matrix (1 for self-self, .5 for parent-child or sib-sib, .25 for uncle-neice, etc). lmekin is a linear models front end to the same underlying routines. I think you want lmekin(y ~ x1 + x2 + (1| subject), data=yourdata, varlist= D) or some such, where D is the similarity or "correlation" form of you distance matrix. A downside is that lmekin is sort of the poor cousin to comxe -- with finite time I've never gotton around to writing predict, residuals, plot, ... methods for it. The basic fit is fine though. Terry Therneau (In general I agree with Bert & Ben to try the other list, but I don't happen to read it.) On 06/04/2013 05:00 AM, r-help-request at r-project.org wrote:> Hi, > I'm trying to build a mixed-effects model in which I'd like to include > either a distance matrix or a phylogenetic tree as a random effect. > The troubles I've had are that: > 1. Function lmer() in package lme4 only accepts a data frame column as a > random factor and not a distance matrix. > 2. Function MCMCglmm() in package MCMCglmm only accepts a rooted and > ultrametric phylogenetic tree as a pedigree argument while my tree is > neither (and for various reasons I cannot construct one or coerce mine > to be a rooted, ultrametric tree). > > Is there any way around it? > I'd appreciate mostly a solution to problem 1. > > Roey