[R-sig-ME] Chapter 4 script hack [was Re: lmer formula syntax?]

Ben Bolker bbolker at gmail.com
Wed Feb 16 14:18:38 CET 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


   While it is probably still worth posting reference versions of lme4a
+ dependencies to the lme4 repository when I get a chance, I don't think
the problems people have been having with Chap4.R (or other chapters)
are caused by package problems.

  The function env() is used in every chapter, and I can't find a
definition for it anywhere.  Its purpose seems to be to extract the
random effects slot from a 'mer' object as an environment.

  I added this helper function to the beginning of Chap4.R

## chunk 0: BMB hack
env <- function(x) {
  z <- list()
  for (i in slotNames(x at re))
    z[[i]] <- slot(x at re,i)
  as.environment(z)
}

and got it to run fine with current versions of minqa, MatrixModels,
lme4a.  I was running with a bleeding-edge SVN release, but I think it
should work with a range of options (lme4 repos, r-forge, etc.)

  Doug, is this a helper function you defined elsewhere in your working
environment, or one that was defined in a long-lost previous version of
lme4?

  cheers
    Ben Bolker




===============
> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: i486-pc-linux-gnu (32-bit)

locale:
 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8
 [5] LC_MONETARY=C              LC_MESSAGES=en_CA.UTF-8
 [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] lme4a_0.999375-63  MatrixModels_0.2-1 minqa_1.1.13
[4] Rcpp_0.9.1         Matrix_0.999375-47 lattice_0.19-19

loaded via a namespace (and not attached):
[1] codetools_0.2-7 grid_2.12.1     nlme_3.1-97     stats4_2.12.1
[5] tools_2.12.1

On 11-02-15 10:36 PM, Dominick Samperi wrote:
> On Tue, Feb 15, 2011 at 10:28 PM, Ben Bolker <bbolker at gmail.com> wrote:
> On 11-02-15 10:24 PM, Dominick Samperi wrote:
>>>> On Wed, Feb 2, 2011 at 4:55 PM, Douglas Bates <bates at stat.wisc.edu> wrote:
>>>>> On Wed, Feb 2, 2011 at 3:43 PM, Colin Wahl <biowahl at gmail.com> wrote:
>>>>>> I too have found the Bate's book draft helpful, but I have not been able to
>>>>>> get the lme4a package installed. The best description I have found to do so
>>>>>> is:
>>>>>> http://kmyu.wordpress.com/2010/12/04/installing-lme4a-in-r-mac-osx-10-6-4/
>>>>>
>>>>>> I'm understanding that the lme4a package is dependent on a number of
>>>>>> packages: RcppArmadillo, minqa and MatrixModels (available on CRAN
>>>>>> respositories) and Rcpp version 0.8.8.1 or later (which is not; version
>>>>>> 0.8.6 is).
>>>>>
>>>>> (Actually it doesn't depend on RcppArmadillo).
>>>>>
>>>>> You must be using Mac OS X.  If you check at
>>>>> cran.r-project.org/web/packages/Rcpp you will see that the Windows
>>>>> binary and the source code packages are at version 0.9.0 but the Mac
>>>>> OS X version is only at 0.8.6, which is rather old.  I'm not sure what
>>>>> the problem is as Romain develops on a Mac OS X system and he can't
>>>>> reproduce the error.
>>>>>
>>>>> However, you don't really need lme4a for most of the examples in the
>>>>> book.  The lme4 package can't handle the profile-related material, but
>>>>> the rest of the examples should be okay.  The output looks slightly
>>>>> different but the parameter estimates should be essentially the same.
>>>>>
>>>>
>>>> FYI, I just tried the current R-Forge version of lme4a using Rcpp 0.9.0
>>>> and there is a problem in the print function when the first argument x
>>>> is an image() call. This happens while trying the script Ch4.R.
>>>>
>>>> I realize this is work in progress, and I tried to use lme4 first, but there
>>>> was a problem with that.
>>>>
>>>> Is there a recommended snapshot/version set for minqa, MatrixModels,
>>>> lme4a, etc. that will run the chapter scripts?
>>>>
>>>> Thanks,
>>>> Dominick
>>>>
> 
>  Have you tried the lme4a version posted at
> <http://lme4.r-forge.r-project.org> (see the last paragraph on that
> page)?  If that doesn't work, please let me know and I will try to fix
> it / resolve dependencies by making them available.
> 
>> Yes, that is where I fetched lme4a from, but there are dependencies
>> on Rcpp, minqa, MatrixModels, etc., and I downloaded those from CRAN.
>> I'm not sure if this combination will work.
> 
>> I tried the Linux source. I will try again using the Windows binaries...
> 
> 
>  Ben Bolker



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1bzq4ACgkQc5UpGjwzenNcdACaAwb/XF3DCBj2HY8aMIaSF/So
FEAAnR3oomZn7BhIv1pSU5ltLZ7m9EFS
=jehV
-----END PGP SIGNATURE-----




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