[R-sig-ME] How to specify user-defined matrix Z?

Zhengyang Zhou Zhengyang.Zhou at UTSouthwestern.edu
Fri Sep 29 21:48:22 CEST 2017

Hi Ron,

Thank you for your reply. nlme can fit the model using:

fit_full = try(lme(y~-1+X, random=list(group=pdIdent(~-1+Z))))

I think it takes the Z to be the matrix of the random effects, and the group level is 1 for all observations. But I don't know how it works exactly.

I need to use lme4 because I want to test for the fixed effects (ie., beta), and the packages which can do it (eg, pbkrtest) is based on lme4.

From: Crump, Ron <R.E.Crump at warwick.ac.uk>
Sent: Friday, September 29, 2017 5:28 AM
To: r-sig-mixed-models at r-project.org; Zhengyang Zhou
Subject: Re: How to specify user-defined matrix Z?

Hi Zhengyang,

> In genetic studies, we sometimes include the genetic relatedness matrix as a variance component, so we have this following model:
> Y~Xbeta+Zb+error,
> where beta are the fixed effects, b~N(0,sigma^2*I) are the random effects, error are the random error, Z is the cholesky decomposition of the known genetic relatedness matrix. So how to use lme4 to fit this model if we know X and Z beforehand? I can use the package "nlme" to do it using the code like
> lme(y~-1+X, random=list(group=pdIdent(~-1+Z))),
> but how to do it using lme4?

I think, assuming you are using I to indicate an identity matrix, that
in neither case are you specifying a genetic relationship matrix, unless
you are somehow incorporating it into Z (in which case I'd like to see how).

I don't believe that either lme4 or nlme will allow you to do what you
want. (Somebody might correct me on this).

Within R you could certainly use MCMCglmm or INLA to do analysis of
quantitative genetics data to obtain genetic parameters (or the asremlr
interface to ASREML). I've not used it, but the pedigreemm package also
looks like it would help you and there may be others. Outside of R,
Karin Meyer's wombat program will also do the job.



UT Southwestern

Medical Center

The future of medicine, today.

More information about the R-sig-mixed-models mailing list