Re: [Rd] Suggested change to integrate.Rd (was: Re: 0.5 != integrate(dnorm, 0, 20000) = 0)

2010-12-07 Thread David Scott
If changes are to be made to integrate it would be nice if the following was fixed: > integrate(dnorm, -Inf, -Inf) 1 with absolute error < 9.4e-05 Note that integrate manages ok when not dealing with Inf or -Inf: > integrate(dnorm, -500, -500) 0 with absolute error < 0 David Scott On 8/12/2

Re: [Rd] Suggested change to integrate.Rd (was: Re: 0.5 != integrate(dnorm, 0, 20000) = 0)

2010-12-07 Thread John Nolan
R developers understand intimately how things work, and terse descriptions are sufficient. However, most typical R users would benefit from clearer documentation. In multiple places I've found the R documentation to be correct and understandable AFTER I've figured a function out. And to be

[Rd] Suggested change to integrate.Rd (was: Re: 0.5 != integrate(dnorm, 0, 20000) = 0)

2010-12-07 Thread Spencer Graves
What do you think about changing the verbiage with that example in "integrate.Rd" from "fails on many systems" to something like "gives wrong answer without warning on many systems"? If I had write access to the core R code, I'd change this myself: I'm probably not the only user w

Re: [Rd] Wait for user input with readline()

2010-12-07 Thread Greg Snow
Part of the problem seems to be that R is set up to run in 1 of 2 modes (I may be over generalizing or over simplifying here), the modes are interactive where you type in a command, R processes it and gives results, you type in another command, etc. The other is Batch mode where everything is p

Re: [Rd] Wait for user input with readline()

2010-12-07 Thread Simon Urbanek
On Dec 7, 2010, at 12:19 PM, Petr Savicky wrote: > On Mon, Dec 06, 2010 at 08:25:39AM -0800, Alexandre wrote: >> >> Hi, >> >> I have a similar problem as the one of Nate. The point is that I want to >> design an interactive script that need the value of two variables (x and y). >> >> So my scr

Re: [Rd] Wait for user input with readline()

2010-12-07 Thread Petr Savicky
On Mon, Dec 06, 2010 at 08:25:39AM -0800, Alexandre wrote: > > Hi, > > I have a similar problem as the one of Nate. The point is that I want to > design an interactive script that need the value of two variables (x and y). > > So my script as designed for the moment is : > > x <- as.numeric (re

Re: [Rd] 0.5 != integrate(dnorm,0,20000) = 0

2010-12-07 Thread John Nolan
Putting in Inf for the upper bound does not work in general: all 3 of the following should give 0.5 > integrate( dnorm, 0, Inf ) 0.5 with absolute error < 4.7e-05 > integrate( dnorm, 0, Inf, sd=10 ) Error in integrate(dnorm, 0, Inf, sd = 1e+05) : the integral is probably divergent > integ

Re: [Rd] 0.5 != integrate(dnorm,0,20000) = 0

2010-12-07 Thread Pierre Chausse
The warning about "absolute error == 0" would not be sufficient because if you do > integrate(dnorm, 0, 5000) 2.326323e-06 with absolute error < 4.6e-06 We get reasonable absolute error and wrong answer. For very high upper bound, it seems more stable to use "Inf". In that case, another .Ext

Re: [Rd] 0.5 != integrate(dnorm,0,20000) = 0

2010-12-07 Thread John Nolan
I have wrestled with this problem before. I think correcting the warning to "absolute error ~<= 0" is a good idea, and printing a warning if subdivisions==1 is also helpful. Also, including a simple example like the one that started this thread on the help page for integrate might make the issue

Re: [Rd] Terminology clarification (Re: GPL and R Community Policies (Rcpp)

2010-12-07 Thread Michael Sumner
Well, I'm very sorry for the outburst, it was completely inappropriate. I don't actually mind the inconvenience - it's rather instructive as to how badly things can go. I was lasshing out as it's really just ironic that you want to stamp out references to yourself in a package (how many on this li

Re: [Rd] Wait for user input with readline()

2010-12-07 Thread Alexandre
Hi, I have a similar problem as the one of Nate. The point is that I want to design an interactive script that need the value of two variables (x and y). So my script as designed for the moment is : x <- as.numeric (readline(prompt="What is the value of x? ")) y <- as.numeric (readline(prompt="

Re: [Rd] 0.5 != integrate(dnorm,0,20000) = 0

2010-12-07 Thread Martin Maechler
> Prof Brian Ripley > on Tue, 7 Dec 2010 07:41:16 + (GMT) writes: > On Mon, 6 Dec 2010, Spencer Graves wrote: >> Hello: >> >> >> The example "integrate(dnorm,0,2)" says it "fails on many systems". >> I just got 0 from it, when I should have gotten ei

Re: [Rd] 0.5 != integrate(dnorm,0,20000) = 0

2010-12-07 Thread baptiste auguie
Hi, I was recently given some interesting tips on a similar issue, see R-help "puzzle with integrate over infinite range" Maybe "fails" can be a bit misleading here (fails to produce the actual result vs. returning an error message). As a result of this