[R] Factorial, L-moments, and overflows

jim holtman jholtman at gmail.com
Mon Sep 17 01:21:43 CEST 2007


It sounds like you are using 'integers'.  Have you considered
'numeric' (floating point)?  You can always look at the function
'samlmu' to see what it does in this case.

On 9/16/07, Pedro.Rodriguez at sungard.com <Pedro.Rodriguez at sungard.com> wrote:
> Hi everyone,
>
> In the package POT, there is a function that computes the L-moments of a given sample (samlmu). However, to compute those L-moments, one needs to obtain the total number of combinations between two numbers, which, by the way, requires the use of a factorial. See, for example, Hosking (1990 , p. 113).
>
> How does the function "samlmu" in the package POT avoids overflows?
>
> I was trying to build from scratch a R function similar to "samlmu" and ran into overflows (Just for my educational purposes :o) ). Is there a trick that I am missing to avoid overflows in the factorial function?
>
> Thank you very much for your time.
>
> Pedro N. Rodriguez
> SSRN Homepage: http://ssrn.com/author=412141/
> Homepage: http://www.pnrodriguez.com/
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list