Re: [Rd] Rmpfr: build vector sequentially -- c(.) not working

2018-10-27 Thread Jerry Lewis
Thank you for your detailed response. I subsequently noticed that sapply(vec,fn) also fails if the function fn returns an mpfr object. Will the next version of Rmpfr also fix this usage? I do enjoy using Rmpfr, and appreciate all that you have done in bringing this capability to the R comm

Re: [Rd] Wish List: Extensions to the derivatives table

2017-02-17 Thread Jerry Lewis
Lewis; r-devel@r-project.org Subject: Re: [Rd] Wish List: Extensions to the derivatives table On 17/02/2017 1:59 PM, Jerry Lewis wrote: > The derivative table resides in the function D. In S+ that table is > extensible because it is written in the S language. R is faster but less > flexib

Re: [Rd] Wish List: Extensions to the derivatives table

2017-02-17 Thread Jerry Lewis
), quote(pi)), make.call("^", make.call("cospi", expr[[2]]), 2)), Jerry From: Avraham Adler [mailto:avraham.ad...@gmail.com] Sent: Friday, February 17, 2017 4:16 PM To: Jerry Lewis; r-devel@r-project.org Subject: Re: [Rd] Wish List: Extensions to the derivatives table Hi. Un

[Rd] Wish List: Extensions to the derivatives table

2017-02-17 Thread Jerry Lewis
The derivative table resides in the function D. In S+ that table is extensible because it is written in the S language. R is faster but less flexible, since that table is programmed in C. It would be useful if R provided a mechanism for extending the derivative table, or barring that, provide

[Rd] pchisq accuracy (PR#14216)

2010-02-19 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.10.1 OS: Windows XP Professional Submission from: (NULL) (166.186.168.21) Since pchisq(x,df,ncp,lower.tail,TRUE) is calculated as log(pchisq(x,df,ncp,lower.tail)) it looses accuracy when pchisq(x,df,ncp,lower.tail) is near 1. Accuracy can be maintained in

[Rd] qpois Help problems (PR#14200)

2010-01-30 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.10.1 OS: Windows XP Professional Submission from: (NULL) (198.180.131.21) In the line "The quantile is right continuous: qpois(q, lambda) is the smallest integer x such that P(X <= x) >= q." "q" is used as a probability when the Arguments section defines it

Re: [Rd] dchisq tail accuracy (PR#14105)

2010-01-03 Thread jerry . lewis
The issue seems to be that the infinite sum is truncated too early when x is in the extreme upper tail. An easily validated improvement to to dnchisq.c would be to add an additional requirement in the upper tail while condition, that the summation should continue while the additive term remain

[Rd] qpois errors for degenerate distribution (PR#14135)

2009-12-14 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.10.0 OS: XP Professional Submission from: (NULL) (96.237.55.233) For a degenerate Poisson distribution (lambda==0), qpois(p,0,lower.tail) should return 0 for any valid p, but qpois(1,0) and qpois(0,0,F) incorrectly return Inf.

Re: [Rd] dchisq tail accuracy (PR#14105)

2009-12-03 Thread jerry . lewis
The undefined variables in the original post are d2 <- df/2-1 sxn <- sqrt(x*ncp) Jerry [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] dchisq tail accuracy (PR#14105)

2009-12-03 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.10.0 OS: Windows XP Professional Submission from: (NULL) (198.180.131.16) dchisq is inaccurate in the extreme tails. For instance, dchisq(1510,2,952) returns 4.871004e-18 which is almost 15 times smaller than the correct value of 7.053889e-17. A better appro

[Rd] pt not monotonic with large noncentrality (PR#14069)

2009-11-18 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.10.0 OS: Windows XP Professional Submission from: (NULL) (96.237.55.233) pt(0,3,200) # correctly returns 0 pt(-1000,3,200) # erroniously returns 0.003116595 Since pt(0,df,nc) = pnorm(-nc), there is an easily computed upper bound for pt(-t,df,nc) where t

[Rd] (PR#14020) trigamma for very large arguments

2009-10-23 Thread jerry . lewis
More generally, the accuracy and working range of psigamma(x,deriv) can be improved by having it return the leading term of the asymptotic expansion (-1)^(deriv-1)*factorial(deriv-1)/x^deriv whenever deriv>=1 and x>=1e15 [[alternative HTML version deleted]] _

[Rd] trigamma for very large arguments (PR#14020)

2009-10-22 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.9.2 OS: Windows XP Professional Submission from: (NULL) (96.237.55.233) trigamma(x) returns 0 for x>1e152, yet trigamma <- function(x) 1/x gives machine accuracy for any x>1e16 __ R-devel@r-project.org mailing lis

[Rd] qpois documentation (PR#13743)

2009-06-02 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.9.0 OS: Windows XP Professional Submission from: (NULL) (166.186.168.103) Quantiles for discrete distributions are consitently implemented, but inconsitently documented. Help for qpois incorrectly states in the Details section that "The quantile is left con

[Rd] besselI inaccurate for negative integer order (PR#13556)

2009-02-26 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.8.1 OS: Windows XP Professional Submission from: (NULL) (198.180.131.16) It should be the case that besselI(x,-nu) == besselI(x,nu) == besselI(x,abs(nu)) for integer nu, yet R currently can return ridiculous values when nu is a negative integer. For instanc

[Rd] erf calculation (PR#13271)

2008-11-11 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.8.0 OS: Windows XP Professional Submission from: (NULL) (71.184.139.210) On p.1202 of the Reference manual, calculating erf(x) is given as an example using the code erf <- function(x) 2 * pnorm(x * sqrt(2)) - 1 A numerically better (avoiding cancellation for

Re: [Rd] solve cdf for noncentrality (PR#11527)

2008-10-14 Thread jerry . lewis
R implementations of Student's t, chi-squared, F, and beta distributions all support noncentrality parameters. There is often a need (for example in sample size problems) to invert the cdf to obtain the noncentrality parameter given the quantile, instead of to obtain the quantile given the non

[Rd] solve cdf for noncentrality (PR#11527)

2008-10-11 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.7.0 OS: Windows XP Professional Submission from: (NULL) (198.180.131.16) If you are saying that there is no need to solve for the noncentrality parameter, please justify this amazing assertion. If you are saying that this need is already adequately addressed

[Rd] Incomplete documentation for Long Input Lines (PR#13147)

2008-10-11 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.7.2 OS: Windows XP Professional Submission from: (NULL) (198.180.131.16) Section 1.8 of "An Introduction to R" states "Command lines entered at the console are limited to about 1024 bytes (not characters)" and indicates that incomplete lines may be continued o

[Rd] solve cdf for noncentrality (PR#11527)

2008-05-27 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.7.0 OS: Windows XP Professional Submission from: (NULL) (198.180.131.16) The current distribution function naming convention inherited from S (d*, p*, q*, r* for pdf/pmf, cdf, quantile, & random numbers) is inadequate for noncentral distributions, where there

[Rd] choose fails a fundamental property of binomial coefficients (PR#11035)

2008-03-26 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.7.0 (2008-03-23 r44847) OS: Windows XP Professional Submission from: (NULL) (71.184.230.48) choose(n,k) = choose(n,n-k) is not satisfied if either 1. n is a negative integer with k a positive integer (due to automatically returning 0 for n-k<0) 2. n is not a

[Rd] wishlist: add functions to calculate noncentrality parameters (PR#11033)

2008-03-25 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.6.2 OS: Windows XP Professional Submission from: (NULL) (198.180.131.16) Some methods (sample size calculations, for instance) are based upon calculating the noncentrality parameter needed to achieve a pre-specified value of the noncentral cdf. None of the di

[Rd] choose incorrect for fractional and some negative integer values (PR#10766)

2008-03-19 Thread jerry . lewis
choose(-5,-7) uses integer arguments (as specified in Help) and returns a numeric value that is incorrect. Either the function or the documentation should be fixed. If the function is not fixed, a warning or an error would be helpful. The fact that choose(n,k) usually returns choose(n,round(

[Rd] choose incorrect for fractional and some negative integer values (PR#10766)

2008-02-15 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.6.2 OS: Windows XP Professional Submission from: (NULL) (198.180.131.16) choose() returns incorrect values for all fractional arguments, regardless of sign. It returns 0 when both arguments are negative integers, which is not always correct (as in some formul

[Rd] pt inaccurate when x is close to 0 (PR#9945)

2008-02-15 Thread jerry . lewis
While I agree that the reported results from Mathematica have only 10-13 correct digits, that does not mean that pt() in R is any better for these calculations. For instance the following three calculations are mathematically equivalent, but pt() disagrees at the 13th figure in R v2.6.2 pt(1

[Rd] Overly restrictive conditions to evaluate beta (PR#10763)

2008-02-15 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.6.2 OS: Windows XP Professional Submission from: (NULL) (96.233.108.117) Currently, beta(a,b) returns NaN if either a or b is negative, but the current calculation beta(a,b) = gamma(a)*gamma(b)/gamma(a+b) works equally well if either or both arguments are n

[Rd] chi-squared with zero df (PR#10551)

2008-01-06 Thread Jerry . Lewis
Full_Name: Jerry W. Lewis Version: 2.6.1 OS: Windows XP Professional Submission from: (NULL) (24.147.191.250) pchisq(0,0,ncp=lambda) returns 0 instead of exp(-lambda/2) pchisq(x,0,ncp=lambda) returns NaN instead of exp(-lambda/2)*(1 + SUM_{r=0}^infty ((lambda/2)^r / r!) pchisq(x, df + 2r)) qchi