Displaying 6 results from an estimated 6 matches for "rf_logspace_sub".
2013 Nov 07
1
R interface to C API Rf_logspace_{add,sub}?
Is there an R-language interface to the R API C-language functions Rf_logspace_add()
and Rf_logspace_sub()? I don't see one but I may not looking under the
right name.
Various packages have functions which do that same sort
of thing (log(exp(x)+exp(y)) and log(exp(x)-exp(y)) without unnecessary
floating point errors). They have names like
matrixStats::logSumExp(lx, na.rm=FALSE, ...) (the ....
2019 Jun 24
2
Calculation of e^{z^2/2} for a normal deviate z
...from logs of terms, i.e.,
> *
> * log (exp (logx) + exp (logy))
> * or log (exp (logx) - exp (logy))
> *
> * without causing overflows or throwing away too much accuracy:
> */
> double Rf_logspace_add(double logx, double logy);
> double Rf_logspace_sub(double logx, double logy);
> double Rf_logspace_sum(const double *logx, int nx);
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
Yes, indeed, thank you, Bill!
But they *have* been in use by core R functions for a long time
in pgamma, pbeta and related functions....
2019 Jun 24
1
Calculation of e^{z^2/2} for a normal deviate z
...t;> *
>> * log (exp (logx) + exp (logy))
>> * or log (exp (logx) - exp (logy))
>> *
>> * without causing overflows or throwing away too much accuracy:
>> */
>> double Rf_logspace_add(double logx, double logy);
>> double Rf_logspace_sub(double logx, double logy);
>> double Rf_logspace_sum(const double *logx, int nx);
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
> Yes, indeed, thank you, Bill!
> But they *have* been in use by core R functions for a long time
>...
2019 Jun 23
0
Calculation of e^{z^2/2} for a normal deviate z
...ctions that call them.
/* Compute the log of a sum or difference from logs of terms, i.e.,
*
* log (exp (logx) + exp (logy))
* or log (exp (logx) - exp (logy))
*
* without causing overflows or throwing away too much accuracy:
*/
double Rf_logspace_add(double logx, double logy);
double Rf_logspace_sub(double logx, double logy);
double Rf_logspace_sum(const double *logx, int nx);
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Sun, Jun 23, 2019 at 1:40 AM Ben Bolker <bbolker at gmail.com> wrote:
>
> I agree with many the sentiments about the wisdom of computing very
> small...
2019 Jun 23
2
Calculation of e^{z^2/2} for a normal deviate z
I agree with many the sentiments about the wisdom of computing very
small p-values (although the example below may win some kind of a prize:
I've seen people talking about p-values of the order of 10^(-2000), but
never 10^(-(10^8)) !). That said, there are a several tricks for
getting more reasonable sums of very small probabilities. The first is
to scale the p-values by dividing the
2019 Jun 24
0
Calculation of e^{z^2/2} for a normal deviate z
...from logs of terms, i.e.,
> *
> * log (exp (logx) + exp (logy))
> * or log (exp (logx) - exp (logy))
> *
> * without causing overflows or throwing away too much accuracy:
> */
> double Rf_logspace_add(double logx, double logy);
> double Rf_logspace_sub(double logx, double logy);
> double Rf_logspace_sum(const double *logx, int nx);
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
Yes, indeed, thank you, Bill!
But they *have* been in use by core R functions for a long time
in pgamma, pbeta and related functions....