Getting arm and lme4 running on the Mac

Our “arm” package in R requires Doug Bates’s “lme4” which fits multilevel models.

lme4 is currently having some problems on the Mac. But installation on the Mac can be done; it just takes a bit of work.

I have two sets of instructions below.

From Yu-Sung:

If you have MAC OS DVD, you should install developer X code packages from it. Otherwise, install them from here.

After this, do the following in R:

install.packages(“lme4”, type = “source”)

Then you will have lme4 in R and you can install arm without a problem.

And, from David Ozonoff:

I installed the lme4 package via the Package Installer but this didn’t work, of course. I then installed, via this link, gfortran which seemed to put the libraries in the right place (I had earlier installed via Fink the gcc42 compiler, so I’m not sure if this is required or not).

I then ran, in R, this:

install.packages(c(“Matrix”,”lme4″), repos=”http://R-Forge.R-project.org”)

This does not appear to work since it will say lme4 is not available, but since I already installed it and it was just looking for the fortran link in the right place, everything worked, as did arm.

To give credit where credit is due, I found the solution here.

5 thoughts on “Getting arm and lme4 running on the Mac

  1. This also can work on a Mac:
    install.packages("lme4",,"http://r.research.att.com/",
    type='mac.binary.untested')

    If one is willing to put a fair amount of work into it, one does not have to stop at arm and lme4. One can actually download WinBUGS and call it from R using R2WinBUGS — all on a Mac!

    To do so:
    Install Wine and WineBottler from here:
    http://winebottler.kronenberg.org/
    Use WineBottler to install WinBUGS.
    Then, you have to work with the wine options in the bugs call.

    First, get files and data set up as per here:
    http://www.stat.columbia.edu/~gelman/bugsR/runnin
    Then, modify the schools.sim bugs call. The below works for me:

    schools.sim = bugs(schools.data, schools.inits, schools.parameters,
    schools.bugsfile, n.chains=3, n.iter=2000, clearWD=TRUE,
    working.directory=mywd, debug=FALSE,
    WINE=myWINE, bugs.directory=my.bugs.dir)

    Before calling this, I set:

    mywd = "/Users/XXXXXXXXXX/R2WinBUGS_wd"

    myWINE = "WINEPREFIX="/Users/XXXXXXXXXX/Library/Application Support/Wine/prefixes/WinBUGS" /Applications/Wine.app/Contents/Resources/bin/wine"

    my.bugs.dir = "/Users/XXXXXXXXXX/Library/Application Support/Wine/prefixes/WinBUGS/drive_c/Program Files/WinBUGS14"

    where XXXXXXXXXX is your username (and you will have to first create the R2WinBUGS_wd folder on your Mac). Also, replace equal signs by the usual R assignment operator (less than sign then hypen; I use equal here because the usual messes up html).

    Good luck. This took me a few days to get running. With the benefit of the above, I hope it only takes you substantially fewer :-).

  2. Although with R 2.12 lme4 is again available from CRAN (due to lme4 0.999375-36 changing the failing test for Mac OS X 32 bit) there is still an underlying issue seemingly related to BLAS under Mac OS X R 32 bit that may lead to non-deterministic erroneous calculations.

    Hence I would either:

    1 – Only run R 64 bit on Mac OS X

    2 – Change away from vecLib BLAS to R Reference BLAS (http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#Which-BLAS-is-used-and-how-can-it-be-changed_003f) or compile ATLAS.

    It looks like that due to a combination of issues with vecLib BLAS this may not be the default in future versions of R.

Comments are closed.