optimization

Rcpp: Using C++ to improve performance in R

Rcpp is an R library allowing for easy integration of C++ code in your R workflow. It allows you to create optimized functions for when R just isn’t fast enough. It can also be used as a bridge between R and C++ giving you the ability to access the existing C++ libraries. Why use Rcpp? There are many use cases for Rcpp, and of course many of them assume that you are interested in primarily working in R.

optimizeAPA Tutorial (Arbitrary Precision Optimization)

optimizeAPA is an R package which allows for multi-parameter optimization. That means you can use it to find the maximum (or the minimum) value of a function with many input values. What makes optimizeAPA unique? It works with arbitrary precision arithmetic. Why use optimizeAPA? 1) works with both APA and NAPA optimization 2) works with both single parameter and multi-parameter functions 3) save an output file at each iteration 4) allows you to keep every value and input visited 5) easily plot the convergence path with a single function call Note: APA stands for “arbitrary precision arithmetic”, while NAPA stands for “non arbitrary precision arithmetic”

An RMPFR Tutorial (Arbitrary Precision Probability Densities)

Working on a likelihood function that relies on the Poisson distribution with large mean \(\lambda\), I ran into the problem of underflow! Underflow occurs when a number is too small to be stored in memory, and so it is truncated to be equal to zero. In my case, the probabilities are so small in the tails of the distribution, that the probabilities return as 0 (although there is a non-zero probability in those tails).