[R-sig-ME] corelated errors

Iasonas Lamprianou lamprianou at yahoo.com
Mon Nov 26 18:50:22 CET 2007

Dear friends, may we use lmer to estimate models where residuals can be correlated (no conditional independence


Dr. Iasonas Lamprianou
Department of Education
The University of Manchester
Oxford Road, Manchester M13 9PL, UK
Tel. 0044 161 275 3485
iasonas.lamprianou at manchester.ac.uk

----- Original Message ----
From: "r-sig-mixed-models-request at r-project.org" <r-sig-mixed-models-request at r-project.org>
To: r-sig-mixed-models at r-project.org
Sent: Saturday, 10 November, 2007 1:00:01 PM
Subject: R-sig-mixed-models Digest, Vol 11, Issue 7

Send R-sig-mixed-models mailing list submissions to
    r-sig-mixed-models at r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to
    r-sig-mixed-models-request at r-project.org

You can reach the person managing the list at
    r-sig-mixed-models-owner at r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-sig-mixed-models digest..."

Today's Topics:

  1. segmented regression mixed model? (Irene Mantzouni)
  2. Re: Nested Mixed Models in lme4 (Marco Chiarandini)
  3. lme4 is now on R-forge (Douglas Bates)


Message: 1
Date: Fri, 9 Nov 2007 16:59:27 +0100
From: "Irene Mantzouni" <ima at difres.dk>
Subject: [R-sig-ME] segmented regression mixed model?
To: <r-sig-mixed-models at r-project.org>
    <68E7981938EAF54F987AD3848A0A6416E5837E at ka-mail01.dfu.local>
Content-Type: text/plain;    charset="ISO-8859-7"

Hi all!

Is it possible to use a segmented regression model as the functional form of a linear (or maybe non-linear?) mixed model?



Message: 2
Date: Fri, 09 Nov 2007 17:41:34 +0100
From: Marco Chiarandini <marco at imada.sdu.dk>
Subject: Re: [R-sig-ME] Nested Mixed Models in lme4
To: Douglas Bates <bates at stat.wisc.edu>
Cc: r-sig-mixed-models at r-project.org
Message-ID: <47348DBE.1060407 at imada.sdu.dk>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Dear Prof. Bates,

>> I am trying to use the function lmer from lme4 to
>> analyse the following nested factorial design.
>> I have three treatment factors (neighborhood,
>> initial, k);
>> I have three group factors crossing (size, dens,
>> inst).
> Did you mean to write (size, dens, type) there?
> Also, by "factor" do you mean that you regard all of these variables
> as categorical?  If so, you should check the form of the size variable
> in the data frame.  It is being stored as a numeric variable, not as a
> factor.  If you want to interpret this  variable as a categorical
> factor you should convert it to a factor or, as seems likely in this
> case, an ordered factor.  (See ?factor and ?ordered)

yes, thank you a lot! All your corrections are 
appropriate! inst should have been type and all 
variables should have been categorical. My mistake.
Also: as you correctly pointed out, the data are 
from a computer experiment and perfectly balanced, 
and by group factors I meant blocking factors.

Your very clear explanation solved my concerns 
about the nesting! Thanks!

I've also redone the comparison with SAS and now 
results correspond.
The reason was mainly that I needed a quite 
different formula:

lmer(err~initial*neighborhood + initial*k + 
initial*type + initial*size + initial*dens + 
neighborhood*k + neighborhood*type + 
neighborhood*size + neighborhood*dens + k*type + 
k*size + k*dens + type*size + type*dens + 
size*dens + initial*neighborhood*k + 

True also that we were using lsmeans in SAS that 
you discourage.

To me it would remain only to understand how I 
could obtain the results in a cell means format 
like those in SAS. But this seems to be a problem 
also in lm and hence I must probably study better 
how things work to find the way. Trying something 
of the kind:

fmm1 <- 

does not seem to help much.

I left all the analysis I did, code + results, 
(SAS and R) at:


Thank you a lot very much for the help!

Best regards,


Marco Chiarandini 
Department of Mathematics          Email: 
marco at imada.sdu.dk
and Computer Science,              Phone: +45 6550 4031
University of Southern Denmark        Fax: +45 
6593 2691


Message: 3
Date: Fri, 9 Nov 2007 15:02:52 -0600
From: "Douglas Bates" <bates at stat.wisc.edu>
Subject: [R-sig-ME] lme4 is now on R-forge
To: R-SIG-Mixed-Models at r-project.org
    <40e66e0b0711091302h7ccb532bx94c7312526a774b6 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Users of the current version of the lme4 package have reported several
problems and, for some time, I have been unresponsive about such reports
or I have made reference to the development version of the package.   Let
me emphasize that I am grateful for the reports and, indeed, have fixed
several of these problems in the development version of the package.
However, I have held off releasing the development version because of
one small problem - it doesn't fit generalized linear mixed models correctly.

I have had to go back and reformulate the model from scratch so that I
can understand it and design the code.  As anyone who has developed
and maintained a large project can attest, the only way to build
trustworthy code (and to maintain your sanity) is to modularize the
code.  It goes without saying that before you can decide how to
modularize the code you must be able to decompose the steps in the
computation.  The development version is designed to handle linear
mixed models, generalized linear mixed models, nonlinear mixed models
and generalized nonlinear mixed models with nested or crossed or
partially crossed random factors.  It has taken me a long time to
decide how all those pieces fit together.  Only in the last couple of
weeks have I have managed to convince myself that I know how it all
fits together.  The task of convincing others remains, and is
decidedly non-trivial, but I feel that I can decompose the
computational steps now.

It will take a while to move from the equations in my lab notebook to
released code and, during that process, I will probably need to
reformulate the slots in the S4 classes.  My method of getting to the
final design of the data structures and algorithms is to keep doing it
wrong 'til I do it right.

So that others have easy access to the development version of the
package I have moved the repository for the development version of
the package to http://R-forge.R-project.org/packages/lme4

Martin and I had planned to do this move in a way that would preserve
the history of the changes from the current repository
but that is not easy to do because of the way that the Matrix and lme4
packages were merged then un-merged.  Thus I have made a clean break
and installed the development version (the one known as gappy-lmer) on
R-forge.  You can access it at the URL given above or as
http://lme4.r-forge.r-project.org/, at the expense of one additional click.

Starting tomorrow you should also be able to install the development
version of the package with

install.packages("lme4", repos = "http://r-forge.r-project.org")

Please be aware that the class representations can change so when
using the development version you should not count on being able to re-use
a fitted model after installing a new version.  You should retain the original
data so you can refit the model if necessary.


R-sig-mixed-models mailing list
R-sig-mixed-models at r-project.org

End of R-sig-mixed-models Digest, Vol 11, Issue 7

Want ideas for reducing your carbon footprint? Visit Yahoo! For Good  http://uk.promotions.yahoo.com/forgood/environment.html

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