[R] less precision, please!

Duncan Murdoch
Fri, 09 Sep 2005 23:55:23 -0000

On 9/9/2005 7:41 PM, Paul MacManus wrote:
> I need to run qbeta on a set of 500K different parameter pairs (with a
fixed quantile). For most pairs qbeta finds the solution very quickly but for a
substantial minority of the cases qbeta is very slow. This occurs when the
solution is very close to zero. qbeta is getting answers to a precision of about
16 decimal places. I don't need that accuracy. Is there any way to set the
precision of R's calculations to, say, 9 decimal places and so speed up the
whole process?
>
> I could, of course, avoid this problem by not running qbeta when I know the
solution is going to be sufficiently small but I'm more interested in ways
to adjust the precision of calculations in R.

There's no general way to do this.  The function that implements qbeta
may have some tuning parameters (I haven't looked), but they aren't
usually needed, and aren't exposed in R.

If you want a quick approximation, I'd suggest doing your calculation on
a grid of values and using approx() to interpolate.

Duncan Murdoch