Re: [R] Mixed effects model with a phylogenetic tree/ distance, matrix as a random effect

2013-06-04 Thread Terry Therneau
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-requ...@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


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Mixed effects model with a phylogenetic tree/ distance matrix as a random effect

2013-06-03 Thread Ben Bolker
Bert Gunter  gene.com> writes:

> 
> Recommendation: Post this to the R-sig-mixed-models  list, not here.
> 
> Cheers,
> Bert

  Seconded.  Alternatively you could try the r-sig-ph...@r-project.org
mailing list, although I think I would try R-s-m-m first.

> 
> On Mon, Jun 3, 2013 at 9:27 AM, Roey Angel 
>mpi-marburg.mpg.de> 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.

  This is not going to change in the near future, although
there is a 'pedigreemm' package built on lme4 that 
might do what you want.

  You might be able to use MASS::glmmPQL in conjunction with
the corStruct structures from nlme (for classical geostatistical
correlation models); ape (for phylogenetic models); or ramps (other
choices).

  INLA might ??? allow tree correlation structures:
http://arxiv.org/abs/1210.4908

  Ives and Garland have some MATLAB code for phylogenetic 
logistic regression ...

> > 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
> >
> > --
> > Dr. Roey Angel
> >
> > Max-Planck-Institute for Terrestrial Microbiology
> > Karl-von-Frisch-Strasse 10
> > D-35043 Marburg, Germany
> >
> > Office: +49 (0)6421/178-832
> > Mobile: +49 (0)176/612-785-88
> >
> >
> > __
> > R-help  r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Mixed effects model with a phylogenetic tree/ distance matrix as a random effect

2013-06-03 Thread Bert Gunter
Recommendation: Post this to the R-sig-mixed-models  list, not here.

Cheers,
Bert

On Mon, Jun 3, 2013 at 9:27 AM, Roey Angel  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
>
> --
> Dr. Roey Angel
>
> Max-Planck-Institute for Terrestrial Microbiology
> Karl-von-Frisch-Strasse 10
> D-35043 Marburg, Germany
>
> Office: +49 (0)6421/178-832
> Mobile: +49 (0)176/612-785-88
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.