fromo-package | R Documentation |
Fast, numerically robust moments computations, along with computation of cumulants, running means, etc.
Welford described a method for 'robust' one-pass computation of the standard deviation. By 'robust', we mean robust to round-off caused by a large shift in the mean. This method was generalized by Terriberry, and Bennett et. al. to the case of higher-order moments. This package provides those algorithms for computing moments.
Generally we should find that the stock implementations of sd
,
skewness
and so on are already robust and likely using
these algorithms under the hood. This package was written for a few
reasons:
As an exercise to learn Rcpp.
Often I found I needed the first k
moments. For example,
when computing the Z-score, the standard deviation and mean must be
computed separately, which is inefficient. Similarly Merten's correction
for the standard error of the Sharpe ratio uses the first four moments.
These are all computed as a side effect of computation of the kurtosis,
but discarded by the standard methods.
fromo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
The moment computations provided by fromo are numerically robust, but will often not provide the same results as the 'standard' implementations, due to differences in roundoff. We make every attempt to balance speed and robustness. User assumes all risk from using the fromo package.
This package was developed as an exercise in learning Rcpp.
Steven E. Pav shabbychef@gmail.com
Maintainer: Steven E. Pav shabbychef@gmail.com (ORCID)
Terriberry, T. "Computing Higher-Order Moments Online." https://web.archive.org/web/20140423031833/http://people.xiph.org/~tterribe/notes/homs.html
J. Bennett, et. al., "Numerically Stable, Single-Pass, Parallel Statistics Algorithms," Proceedings of IEEE International Conference on Cluster Computing, 2009. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1109/CLUSTR.2009.5289161")}
Cook, J. D. "Accurately computing running variance." https://www.johndcook.com/standard_deviation/
Cook, J. D. "Comparing three methods of computing standard deviation." https://www.johndcook.com/blog/2008/09/26/comparing-three-methods-of-computing-standard-deviation/
Useful links:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.