Package rpgm

Discuss about R packages.
Post Reply
Nicolas
Posts: 13
Joined: 25 Apr 2015, 08:56

Package rpgm

Post by Nicolas » 12 Mar 2017, 10:27

PGM Solutions provides the package rpgm which aim is to provide simulation and numerical tools with very high performance. The first version on the CRAN (0.1.3.) provides the main function :

Code: Select all

rpgm.rnorm(n, mean = 0, sd = 1)
This function do exactly the same thing as rnorm() but is faster. For example, on my device :

Code: Select all

n <- 10^8
system.time({x <- rpgm.rnorm(n)})
returns an execution time of 2.13 while

Code: Select all

n <- 10^8
system.time({x <- rnorm(n)})
returns an execution time of 8.02.

The algorithm used is the Ziggurat method (https://en.wikipedia.org/wiki/Ziggurat_algorithm). It also works when mean and sd arguments are vectors.

Three other functions are also present:

Code: Select all

skewness(x)
kurtosis(x)
jarque.bera(x)
The skewness is the three-order central and reduced moment while the kurtosis is the four-order central and reduced. The Jarque Bera test provides a normality test based on the skewness and the kurtosis.

For the next version :
Based on rpgm.rnorm() efficiency, rpgm.lnorm() and rpgm.rt() (student distribution) ;
Simulation of Stochastic Differential Equations (Itô type, using rpgm.rnorm() when relevent) ;
Introduction of rpgm.rexp() based (like rpgm.rnorm()) on Ziggurat method and also rpgm.rgeom (integer part of rpgm.rexp() ).

Post Reply