Re: [Rd] methods package: A _R_CHECK_LENGTH_1_LOGIC2_=true error

2019-06-24 Thread Henrik Bengtsson
**Maybe this bug needs to be understood further before applying the patch because patch is most likely also wrong** Because, from just looking at the expressions, I think neither the R 3.6.0 version: omittedSig <- omittedSig && (signature[omittedSig] != "missing") nor the patched version (I prop

Re: [Rd] methods package: A _R_CHECK_LENGTH_1_LOGIC2_=true error

2019-06-24 Thread Martin Maechler
> Henrik Bengtsson via R-core > on Sun, 23 Jun 2019 11:29:58 -0700 writes: > Thank you. > To correct myself, I can indeed reproduce this with R --vanilla too. > A reproducible example is: > $ R --vanilla > R version 3.6.0 Patched (2019-05-31 r76629) -- "Planting o

Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z

2019-06-24 Thread jing hua zhao
Hi Martin, Thanks for another tips -- it will be hard for me to comprehend fully your implementation of Rmpfr. I will look at these instead. I realised what I thought was a difficult problem turned to be a popular one. I managed to get a Python version here for information. # http://bayesjumpi

Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z

2019-06-24 Thread Martin Maechler
> jing hua zhao > on Mon, 24 Jun 2019 08:51:43 + writes: > Hi All, > Thanks for all your comments which allows me to appreciate more of these in Python and R. > I just came across the matrixStats package, > ## EXAMPLE #1 > lx <- c(1000.01, 1000.02) > y0

Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z

2019-06-24 Thread jing hua zhao
Hi All, Thanks for all your comments which allows me to appreciate more of these in Python and R. I just came across the matrixStats package, ## EXAMPLE #1 lx <- c(1000.01, 1000.02) y0 <- log(sum(exp(lx))) print(y0) ## Inf y1 <- logSumExp(lx) print(y1) ## 1000.708 and > ly <- lx*10 > ly

Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z

2019-06-24 Thread Martin Maechler
> William Dunlap via R-devel > on Sun, 23 Jun 2019 10:34:47 -0700 writes: > William Dunlap via R-devel > on Sun, 23 Jun 2019 10:34:47 -0700 writes: > include/Rmath.h declares a set of 'logspace' functions for use at the C > level. I don't think there are core R f

Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z

2019-06-24 Thread Serguei Sokol
On 22/06/2019 00:58, jing hua zhao wrote: Hi Peter, Rui, Chrstophe and Gabriel, Thanks for your inputs -- the use of qnorm(., log=TRUE) is a good point Another approach could be simply to note that a function defined as f(p)=exp(-z(p)^2/2) is regular around p=0 with f(0)=0. It has roughly the