[R-sig-ME] Structural zeros in lme4

Douglas Bates bates at stat.wisc.edu
Wed Oct 6 17:07:36 CEST 2010


On Wed, Oct 6, 2010 at 8:27 AM, Hadley Wickham <hadley at rice.edu> wrote:
>> I don't know of an easy way of doing that but, as you are the second
>> person in as many weeks to pose such a question, it is obviously a
>> situation that we should accommodate.
>
> Well, it's not easy, but you can do:
>
>  ra_age_sex <- interaction(ra, age, sex, drop = T)
>
> and then model with
>
>  success ~ ra_age_sex + (1|ind)
>
> The hard part is creating the contrasts that take you back to the
> questions you're interested in.

As you say, that's the hard part.

The fix I have in mind is to do a preliminary QR decomposition of the
model matrix for the fixed effects

qr(model.matrix(~ ra + age + sex))

and examine the rank.  If this matrix is rank-deficient there will be
a non-trivial permutation of the coefficients in the qr structure and
you simply extract the first r columns from the model matrix after
permutation.  The remaining p - r columns are the coefficients whose
estimates are NA in the coefficients table.




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