[R-sig-ME] more comments and questions

Douglas Bates bates at stat.wisc.edu
Sun Jun 17 16:15:55 CEST 2007


As we agreed i am sending a copy of this reply to the R-SIG-Mixed-Models list

On 6/15/07, Robert Kushler <kushler at oakland.edu> wrote:

> Further follow-up:

> 1) "mcmcsamp.R" is in the R-ex directory of the lme4 libr.. oops package
>     (hey, it's stored under "library" and you have to call the "library"
>      function to load it - can Martin blame us for slipping up?  :-)

Ah, I see.  In that case it is easier to refer to it as being in

example(mcmcsamp)

>     Here's the line I was referencing:

> ## potentially useful approximate D.F. :
> (eDF <- mean(samp1[,"deviance"]) - deviance(fm1, REML=FALSE))

That statement refers to the Deviance Information Criterion (DIC) of
Spiegelhalter et al.  As I said in my earlier reply I am having my
doubts about the value of that criterion for this model - hence the
phrase "potentially useful".

> 2) Thanks for clarifying the "deprecation" of groupedData objects.  Here's
>     why I was surprised by the behavior of "lmList" (quote from lme4 help
>     page on lmList):

> Arguments

> formula For lmList, a linear formula object of the form y ~ x1+...+xn | g.
>          In the formula object, y represents the response, x1,...,xn the covariates,
>          and g the grouping factor specifying the partitioning of the data according
>          to which different lm fits should be performed. The grouping factor g may be
>          omitted from the formula, in which case the grouping structure will be obtained
>          from data, which must inherit from class groupedData.

Thanks for pointing that out.  The sources for the help page were
copied from the lmList function in the nlme package and insufficiently
edited.  I'll correct that.

> 3) I know you have many high-priority items on the to-do list, but I want to pitch
>     the idea of adding the "extensions" of chapter 5 of Pinheiro and Bates sooner
>     rather than later.  The AR1 structure in particular is a very plausible and
>     useful model that seems to occur fairly often in applications - the weights data
>     from the SAS mixed book (first edition) provides one example.

This is a case where the design, in the sense of deciding how these
add-on's should be specified by the user, is much more difficult than
the implementation.

One of the aspects of lmer and nlmer that I particularly like,
relative to lme and nlme ,is the model specification.  I think the new
specification is much simpler.  In the process of rethinking the model
specification I have eliminated the pdMat classes and all of the
methods associated with them.  At the same time the new formulation
allows for specification of models with crossed or partially crossed
random effects in what i feel is a simple and straightforward way.

My priorities now are to finish and document lmer, nlmer, glmer and
mcmcsamp.  The "documentation" part includes finishing a book with the
working title "Multilevel Modeling in R".

So I'm sorry to say that, barring unforeseen developments, having the
ability to specify and fit correlation structures in addition to those
induced by the random effects in not about to happen soon.

> 4) Can the "unstructured" model be fit using the current version of lmer?  I thought
>     I could do it (at least for balanced data) by using a factor version of the "inner"
>     data structure (i.e., the repeated measures) as a random effect, but I can't get
>     it to work.  Any advice you can offer would be appreciated.

I'm not sure what the "unstructured" model is.  If you are referring a
model for repeated measures data based on, say, factors "occasion" and
"subject", then I believe you want a random-effects term of the form

(occasion|subject)

or, equivalently,

(0+occasion|subject)

The parameterization of the random effects and the variance-covariance
matrix from the second specification may be easier to interpret.

By the way, the SAS-speak term "unstructured variance matrix" is
nonsense.  An "unstructured, symmetric, positive-definite matrix" is
an oxymoron.

My approach to mixed-model specification is different from that in SAS
and in many text books.  Instead of allowing for complex structures of
the variance-covariance matrix of the random effects or, even worse
from my point of view, the induced variance-covariance matrix of the
responses, I try to keep the variance-covariance matrix's structure
simple and move the complexity, when needed, to the structure of the
model matrices for the linear predictor.
Basically, if you can express the model in terms of model matrices
plus a variance-covariance structure for the random effects where
elements associated with different terms are independent as are
elements associated with different levels of the same term, then you
can write the model in lmer.

> 5) You may not want to answer this, but I'll ask anyway.  The listing produced by

>            getMethod(anova,signature="mer")

>     (or "lmer2") doesn't contain any commented out lines for denominator df.  Am I
>     looking in the wrong place?  Can you give me another hint?

Ah, I see I left out a couple of steps.  Let me be more specific.

Step 1: Take your Windows computer and install Linux on it.
Step 2: Install R under Linux.
Step 3: Download the source package for lme4 and expand the tar file.
Step 4: Find the commented lines in lme4/R/lmer.R and uncomment them.
Step 5: Install the lme4 package.

You could avoid step 1 if you go through the steps necessary to
compile an R source package, including C source files, under Windows.
Once you have done so you would probably agree that converting to
Linux is easier.

> Thanks again for your time (and for all the terrific software).

> Regards,    Rob Kushler




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