[R] GLMMs & LMEs: dispersion parameters, fixed variances, design matrices

Simon Wood simon at stats.gla.ac.uk
Thu May 13 11:53:32 CEST 2004


Hi Mark,

> (2) Is there a way to tell lme (either in nlme or lme4) to just use a
> specified design matrix Z for the random effects, rather than
> constructing one itself from factors? Sometimes I would really like to
> use my own funny-looking Z matrix (e.g. with non-integer coefficients),
> and even with contrasts() I haven't managed to do this.

Here's a simple example showing a `standard' call to lme, and a
less standard one doing the same thing with a specified Z....

library(nlme)
data(Rail)
lme(travel~1,Rail,~1|Rail) # simple r.e. model example

## now repeat fit with home-made Z...
Rail$all<-factor(rep(1,18)) # all one group
## create a simple Z ...
Rail$Z<-model.matrix(~factor(Rail$Rail,ordered=FALSE)-1)
## use pdIdent to force r.e.s to be independent ...
lme(travel~1,Rail,list(all=pdIdent(~Z)))


best,
Simon




More information about the R-help mailing list