Re: [Rd] About removing zlib from R-devel

2015-03-27 Thread Kasper Daniel Hansen
Related to this question:

I have installed bzip2 1.0.6 by hand, but configure still fails.  When I
look at config.log I get the following

configure:34150: /usr/bin/gcc -std=gnu99 -o conftest -g -O2 -march=amdfam10
 -g -O2 -march=amdfam10  -L/usr/local/lib64 confte
st.c -lbz2 -lz -lrt -ldl -lm  >&5
conftest.c: In function 'main':
conftest.c:250: warning: initialization discards qualifiers from pointer
target type
conftest.c:251: warning: implicit declaration of function 'exit'
conftest.c:251: warning: incompatible implicit declaration of built-in
function 'exit'
conftest.c:251: warning: implicit declaration of function 'strcmp'

for the program

| #ifdef HAVE_BZLIB_H
| #include 
| #endif
| int main() {
| char *ver = BZ2_bzlibVersion();
| exit(strcmp(ver, "1.0.6") < 0);
| }
|
configure:34167: result: no
configure:34173: checking whether bzip2 support suffices
configure:34180: error: bzip2 library and headers are required

To me, it seems as if the test might be broken.  I'll do some more
investigation, but thought I would report this. It works for libz which I
also had to install by hand.

Best,
Kasper


On Thu, Mar 26, 2015 at 2:49 PM, Dirk Eddelbuettel  wrote:

>
> On 26 March 2015 at 07:47, Gábor Csárdi wrote:
> | Dear All,
> |
> | zlib has been removed from R-devel src/extra recently, and building R
> | requires zlib >= 1.2.5. Ubuntu 12.04 LTS (also used on Travis CI) only
> has
> | 1.2.3.
> |
> | This means that the next version of R will probably not available on
> Ubuntu
> | 12.04. (Unless I am missing something of course.) Which is probably fine,
> | it is almost three years old now.
>
> I think Michael Rutter (who (re-)builds for 12.04 and other Ubuntu releases
> when I update the Debian package) can create a local backport of zlib.
>
> I somewhat recently started to (entirely locally) build some "backports"
> via
> https://launchpad.net/~edd/+archive/ubuntu/misc solely so that Travis can
> use
> them as binary.  It's good option to have.
>
> Dirk
>
> | I guess R-core is aware of this. Just wanted to be sure.
> |
> | Best Regads,
> | Gabor
> |
> |   [[alternative HTML version deleted]]
> |
> | __
> | R-devel@r-project.org mailing list
> | https://stat.ethz.ch/mailman/listinfo/r-devel
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] robust updating methods

2015-03-27 Thread Ben Bolker
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

  [Sorry to those who don't like it for top-posting]

  Thierry, I'm curious whether this addresses your problem (although
we don't have a hard timetable for the next release [it has to avoid
conflicts with the 3.2.0 release in 2.5 weeks at the very least], so
this might be problematic if your package needs to depend on it).

  I'm still curious whether there are any ideas/opinions from other
readers.  Has anyone else struggled with this?  Is there a canonical
solution?

 Ben Bolker


On 15-03-24 07:55 PM, Ben Bolker wrote:
> On 15-03-23 12:55 PM, Thierry Onkelinx wrote:
>> Dear Ben,
> 
>> Last week I was struggling with incorporating lme4 into a
>> package. I traced the problem and made a reproducible example ( 
>> https://github.com/ThierryO/testlme4).  It looks very simular to 
>> the problem you describe.
> 
>> The 'tests' directory contains the reproducible examples.
>> confint() of a model as returned by a function fails. It even
>> fails when I try to calculate the confint() inside the same
>> function as the glmer() call (see the fit_model_ci function).
> 
>> Best regards,
> 
>> Thierry
> 
> 
> Ugh.  I can get this to work if I also try searching up the call 
> stack, as follows (within update.merMod).  This feels like "code 
> smell" to me though -- i.e., if I have to hack this hard I must be 
> doing something wrong/misunderstanding how the problem *should* be
> done.
> 
> 
> if (evaluate) { ff <- environment(formula(object)) pf <-
> parent.frame()  ## save parent frame in case we need it sf <-
> sys.frames()[[1]] tryCatch(eval(call, env=ff), error=function(e) { 
> tryCatch(eval(call, env=sf), error=function(e) { eval(call, pf) }) 
> }) } else call
> 
> Here is an adapted even-more-minimal version of your code, which 
> seems to work with the version of update.merMod I just pushed to 
> github, but fails for glm():
> 
> 
> ##
> https://github.com/ThierryO/testlme4/blob/master/R/fit_model_ci.R 
> fit_model_ci <- function(formula, dataset, mfun=glmer){ model <-
> mfun( formula = formula, data = dataset, family = "poisson" ) ci <-
> confint(model) return(list(model = model, confint = ci)) }
> 
> library("lme4") set.seed(101) dd <-
> data.frame(f=factor(rep(1:10,each=100)), y=rpois(2,1000)) 
> fit_model_ci(y~(1|f),dataset=dd) 
> fit_model_ci(y~(1|f),dataset=dd,mfun=glm)
> 
> 
> 
> 
> 
>> ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / 
>> Research Institute for Nature and Forest team Biometrie & 
>> Kwaliteitszorg / team Biometrics & Quality Assurance
>> Kliniekstraat 25 1070 Anderlecht Belgium
> 
>> To call in the statistician after the experiment is done may be
>> no more than asking him to perform a post-mortem examination: he
>> may be able to say what the experiment died of. ~ Sir Ronald
>> Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner
>> The combination of some data and an aching desire for an answer
>> does not ensure that a reasonable answer can be extracted from a
>> given body of data. ~ John Tukey
> 
>> 2015-03-22 17:45 GMT+01:00 Ben Bolker :
> 
>> WARNING: this is long.  Sorry I couldn't find a way to compress 
>> it.
> 
>> Is there a reasonable way to design an update method so that it's
>>  robust to a variety of reasonable use cases of generating calls
>> or data inside or outside a function?  Is it even possible?
>> Should I just tell users "don't do that"?
> 
>> * `update.default()` uses `eval(call, parent.frame())`; this
>> fails when the call depends on objects that were defined in a
>> different environment (e.g., when the data are generated and the
>> model initially fitted within a function scope)
> 
>> * an alternative is to store the original environment in which
>> the fitting is done in the environment of the formula and use 
>> `eval(call, env=environment(formula(object)))`; this fails if the
>>  user tries to update the model originally fitted outside a 
>> function with data modified within a function ...
> 
>> * I think I've got a hack that works below, which first tries in 
>> the environment of the formula and falls back to the parent
>> frame if that fails, but I wonder if I'm missing something much
>> simpler ..
> 
>> Thoughts?  My understanding of environments and frames is still,
>>  after all these years, not what it should be ...
> 
>> I've thought of some other workarounds, none entirely 
>> satisfactory:
> 
>> * force evaluation of all elements in the original call *
>> printing components of the call can get ugly (can save the
>> original call before evaluating) * large objects in the call get
>> duplicated * don't use `eval(call)` for updates; instead try to
>> store everything internally * this works OK but has the same
>> drawback of potentially storing large extra copies * we could try
>> to use the model frame (which is stored already), but there are
>> issues with this (the basis of a whole separate rant) because the
>> model frame stores something in between predictor varia