[R-sig-ME] More naive questions: Speed comparisons? what is a "stack imbalance" in lmer? does lmer center variables?

Emmanuel Charpentier charpent at bacbuc.dyndns.org
Thu Sep 24 00:43:05 CEST 2009


Le mercredi 23 septembre 2009 à 14:37 -0500, Douglas Bates a écrit, in a
very interesting thread :

[ Snip (for bandwidth's sake) ... ]

> [ ... ] If R was driven by marketing
> considerations it would be Excel.

With apologies to Pr Douglas M. Bates, I hereby take the liberty to
nominate this last sentence for immortalization as a fortune() data
point :-). (Hence the Cc to Achim Zeileis, which maintains the relevant

[ another Snip... ]

Now, to get back to the subject matter :

I'd like to "push" a bit the JAGS Gibbs sampler as a good example of
both the good and discutable points of free software development.

JAGS is essentially  reimplementation of the BUGS language, able to run
(almost) all of the $#!+load of tutorial/pedagogic material written for
WinBUGS. It does it independently of the original Object Pascal (?)
implementation of WinBUGS.

One of its strong points is the use of C++ as  source language, making
it compilable on any platform with  gcc-compatible C++ compiler, whereas
WinBUGS is still tied, glued, bolted, riveted and weld to Windows and
the curious Pascal compiler and toolbox (the attempts to create a Linux
or Mac OS/X version of OpenBUGS seem to be (currently) a  failure), thus
forcing its potential users on these "other" platforms to use either a
more or less shaky and incomplete reimplementation of the necessary
parts of the Windows libraries (i. e. Wine) or a virtual machine. In
this sense, JAGS is *practically* "freer" than WinBUGS, the restrictions
to the use of the latter coming not from its license (David
Spiegelhalter and his team did "the Right Thing" here) but from its

However, this "platform independence" came also at the cost of losing
the GUI. While I'm not quite fond of it (I tried it on a Windows
platform, found its objets incompatible with almost everything else in
common use on this platform (including graphics) and a distraction for
most of my work), I can understand that this GUI may be an useful ladder
while climbing (the first levels of) the learning curve of
Bayesian/multilevel/hierarchical modeling in R, which can be damnably
steep... A platform-specific reimplementation of such a GUI is probably
doable, a portable one is probably out of question.

Furthermore, Martyn Plummer, for good reasons (as far as I can tell),
did not implement some BUGS "features" (e.g. the I(,) introduced a
couple or two of small incompatibilities, which he duly flagged in a
section of the JAGS reference manual. Some limitations of the program
exist (e. g., you can have only as much parallel simulation chains as
there is random number generators).

Most of these incompatibilities are not a serious problem : for example,
if I needed a new random number generator, I could (if my C++ was not as
rusty as it is...) implement one and link it to the current
implementation of JAGS without too much difficulty.

However, some other (subtle) incompatibilities (probably) lie at the
root of the JAGS engine, and might be much more difficult to root out
(if possible at all). An example from the manual (sect 7.0.6 (sic...)) :

"Directed cycles are forbidden in JAGS. There are two important
instances where directed
cycles are used in BUGS.
. Defining autoregressive priors
. Defining ordered priors
For the first case, the GeoBUGS extension to WinBUGS provides some
convenient ways of defining autoregressive priors. These should be
available in a future version of JAGS."

Practically, this means that it is possible to write a model that will
run in WinBUGS but not in JAGS (and probably vice-versa...). I am not
competent enough to judge "which is Right", but I think that thes
incompatibilities might become a problem.

So, the freedom to reimplement comes with a (possibly not trivial)

While my vote goes mostly to JAGS, mostly due to its *effective*
freedom, I see points in the "more closed" approach of WinBUGS.

This issue is, IMHO, different of the free/proprietary issue so hotly
(ng lengthily... debated in various places, this thread excluded :-) : I
see it not as free vs proprietary, but as "which is the "right" use of
the freedom we buy by using/contributing to free software" ?

So my points are :
	1) JAGS should be mentioned as an alternative implementation of the
BUGS language, "somewhat freer" than WinBUGS, wherever Gibbs sampling
via this tool is mentioned ;
	2) Martyn Plummer should be commended for taking the pain of offering
this alternative (and much needed) implementation ;
	3)  care should be taken to point the incompatibilities between these
two dialects of the same language ;
	4) more generally, care should be given not only to *moral* freedom,
but also to *practical* freedom issues... 

(Aside note : I'm not really sure that the two underlying models are
indeed the same, i. e. describing the same set of fittable models. Any
lights ?).


					Emmanuel Charpentier

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