[R-sig-ME] Package for GLMM with correlation matrix

Ben Bolker bbolker at gmail.com
Fri Oct 22 23:53:45 CEST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

   Hmmm.
   Hard-coding your correlation matrix into glmmPQL by way of corSymm
should
be possible, but I think it could be quite tricky -- you would have to
read and understand
the Pinheiro and Bates paper referenced in ?corSymm, and really
understand the way that
corStruct objects are created and manipulated in nlme, in order to
have a shot at doing
this.
   There are several existing tools for pedigree-based mixed model
estimation (pedigreemm,
kinship, MCMCglmm), and some tools in R's phylogenetic packages (ape)
for integrating phylogenetic
information with glmmPQL (the methods section in the paper that
introduces the EMMA package
refers to these phylogenetic frameworks, which is why I mention this);
I would see if any of them
will serve your purpose ...

  good luck
    Ben Bolker


On 10-10-22 01:18 PM, wong wrote:
> Hi Ben,
>
> I want to test the association between non-normal response y and
> fixed effect predictor x with a correction for relatedness between
> indivdiuals (through incorporation of an individual-level random
> effect). The correlation matrix is already known or can be
> directly estimated from other means. Thers is no grouping of
> individuals here. There is a R package called EMMA that can fit
> such correlated random effect model for normally distributed
> response. However, EMMA can't handle non-normal response data.
>
> Thanks for your help.
>
> Alex
>
> 2010/10/22 Ben Bolker <bbolker at gmail.com>:
>> Reading the description of your problem more carefully: you want
>> a correlation structure but no random effect (or equivalently an
>> individual-level random effect, with no grouping)?  You may have
>> a hard time doing this: * gls (nlme package) fits generalized
>> least-squares problem (no ['G-side'] random effect, but
>> ['R-side'] correlation models) -- but 'generalized' here means
>> 'non-trivial correlations', not 'non-normal responses in the
>> exponential family' * glmer (lme4 package) allows
>> individual-level random effects in GLMMs, but not R-side
>> structures (the package author isn't sure how they would be
>> formulated sensibly in a GLMM context) * You could create an
>> individual-level random effect and use it in glmmPQL, but I would
>> proceed with great caution, e.g.:
>>
>> library(MASS) bacteria$ind <- 1:nrow(bacteria) g1 <- glmmPQL(y ~
>> trt + week + offset(week), random = ~ 1 | ind, family=binomial,
>> data=bacteria)
>>
>> Are you saying you have a fixed, known correlation matrix?  That
>> seems surprising, but if you want to do so you will probably have
>> quite a bit of work in front of you -- read the appropriate
>> chapter of Pinheiro and Bates 2000, then probably also read some
>> of their papers on defining correlation structures.
>>
>> I'm sorry this isn't easier, but it's not a common task.
>>
>> On 10-10-22 11:26 AM, wong wrote:
>>> Thanks ben.
>>>
>>> The argument correlation in glmmPQL is an optional corStruct
>>> object describing the within-group correlation structure.
>>> However, in my dataset, there is no grouping among individuals.
>>> Also, each individual has only one observation for response y.
>>> I don't know how to create a corStruct object from an existing
>>> n*n correlation matrix (n = the number of indivdiuals = length
>>> of y). What can I do now? The documentation for corClasses is
>>> not quite explicit.
>>>
>>> Alex
>>>
>>> 2010/10/22 Ben Bolker <bbolker at gmail.com>: See the
>>> documentation for lme (nlme package), specifically ?lme and
>>> ?corClasses . Beyond that, see Pinheiro and Bates 2000
>>> (Springer).
>>>
>>> On 10-10-22 05:35 AM, wong wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I'm looking for a R package for fitting a generalized
>>>>>> linear mixed model g(E[y])=X²+Zu where g is a link
>>>>>> function, ² is a p vector of fixed effects, u is a vector
>>>>>> of random effects, X is design matrix, Z is an identity
>>>>>> matrix. In our data, each individual has only one
>>>>>> observation for response y. Because individuals may be
>>>>>> correlated in some way, leading to similar reponses,
>>>>>> random effect u is employed to correct for individual
>>>>>> background effect. The variance of u is assumed to be
>>>>>> Var[u]=G*Ã^2, in which G is a correlation matrix.
>>>>>>
>>>>>> glmmPQL in MASS has an argument for correlation. However,
>>>>>> I encountered an error of invalid formula when using a
>>>>>> n*n dimension matrix G (n is the number of individuals,
>>>>>> and also the length of y) for argument 'correlation' in
>>>>>> glmmPQL. For example:
>>>>>>
>>>>>>>
>>>
>>>
y=sample(c(1,0),48,replace=T);x=sample(1:4,48,replace=T);id=1:48;covMat=matrix(rnorm(48*48),nrow=48)
>>>
>>>
>>>
>>>>>>
>>>>>>>
>>>
>>>
glmmPQL(y~x,random=~1|id,family=binomial,correlation=covMat)
>>>>>> iteration 1 Error in formula.default(object) : invalid
>>>>>> formula
>>>>>>
>>>>>> The R help documentation for glmmPQL is very compact. No
>>>>>> detailed explanation. Does anybody know how to use
>>>>>> correlation matrix in glmmPQL? Is it good to use glmmPQL
>>>>>> for fitting my model?
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> Alex
>>>>>>
>>>>>> _______________________________________________
>>>>>> R-sig-mixed-models at r-project.org mailing list
>>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>
>>>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>>
>>
>>
>>
>
>
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzCB+kACgkQc5UpGjwzenPzwgCfW7OWexFazDXlGjiW+QGtKVN4
MvIAnRA+NQK0j6LS7FNka6pA6In/yCWb
=R9AB
-----END PGP SIGNATURE-----




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