[R-sig-ME] Development version of lme4

Gang Chen gangchen at mail.nih.gov
Tue Oct 2 20:27:54 CEST 2007


Dr. Bates,

I have successfully compiled the development version of lme4 package  
on my computer, but have encountered some problem while trying out  
the approach you suggested a while ago. The line I'm having trouble  
with is

> fm at ZtXy <- fm at Zt %*% Xy

It gives me the following error message:

Error in checkSlotAssignment(object, name, value) :
         assignment of an object of class "dgeMatrix" is not valid  
for slot "ZtXy" in an object of class "lmer"; is(value, "matrix") is  
not TRUE

The previous matrix stored in

> fm at ZtXy

is

 > fm at ZtXy
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
[1,]   12    6    6    4    4    3    2    2    2     2     1     1
[2,]   12    6    6    4    4    3    2    2    2     2     1     1
[3,]   12    6    6    4    4    3    2    2    2     2     1     1
[4,]   12    6    6    4    4    3    2    2    2     2     1     1
[5,]   12    6    6    4    4    3    2    2    2     2     1     1
[6,]   12    6    6    4    4    3    2    2    2     2     1     1
[7,]   12    6    6    4    4    3    2    2    2     2     1     1
[8,]   12    6    6    4    4    3    2    2    2     2     1     1
             [,13]
[1,]  0.001770365
[2,]  0.017938064
[3,]  0.003173793
[4,]  0.008991505
[5,] -0.007523851
[6,]  0.040761106
[7,]  0.013619571
[8,]  0.010122583

while the new matrix at the right-hand side has the same size:

> fm at Zt %*% Xy

8 x 13 Matrix of class "dgeMatrix"
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
[1,]   12    6    6    4    4    3    2    2    2     2     1     1
[2,]   12    6    6    4    4    3    2    2    2     2     1     1
[3,]   12    6    6    4    4    3    2    2    2     2     1     1
[4,]   12    6    6    4    4    3    2    2    2     2     1     1
[5,]   12    6    6    4    4    3    2    2    2     2     1     1
[6,]   12    6    6    4    4    3    2    2    2     2     1     1
[7,]   12    6    6    4    4    3    2    2    2     2     1     1
[8,]   12    6    6    4    4    3    2    2    2     2     1     1
              [,13]
[1,]  0.0122570704
[2,]  0.0201602195
[3,]  0.0064441410
[4,]  0.0001785527
[5,] -0.0021326855
[6,]  0.0596808494
[7,]  0.0128992660
[8,]  0.0108945209

Did I do something inappropriate?

 > sessionInfo()
R version 2.5.1 (2007-06-27)
i386-apple-darwin8.9.1

locale:
C

attached base packages:
[1] "stats"     "graphics"  "grDevices" "utils"     "datasets"   
"methods"
[7] "base"

other attached packages:
         lme4       Matrix      lattice
"0.999375-0" "0.999375-2"    "0.15-11"

Thanks,
Gang


> If you look at the lmer function in the development version of the  
> lme4 package (currently at
> https://svn.r-project.org/R-packages/branches/gappy-lmer, soon to be
> at http://r-forge.r-project.org/projects/lme4 for some value of
> "soon") you will see that it follows the equations in my useR
> presentation fairly closely.  The Xy array is n by (p + 1) with X in
> the first p columns and y in the p + 1st column.  The object of class
> "lmer" has slots named y, Zt (Z-transpose), ZtXy (Zt %*% Xy), and
> XytXy (crossprod(Xy)). After fitting the model to the first simulated
> response, producing the object 'fm',  the only operations needed to
> update the model are
>
>  fm at y <- newy
>  Xy <- cbind(fm at X, fm at y)
>  fm at ZtXy <- fm at Zt %*% Xy
>  fm at XytXy <- crossprod(Xy)
>  lme4:::mer_finalize(fm, verbose)
>
> where 'verbose' is a logical scalar indicating if you want verbose
> output during the optimization phase.  Once you get things working on
> a small example you would probably want to turn that off.
>
> Please note that this code applies to the development version of the
> lme4 package.




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