Type: | Package |
Title: | The p-Generalized Normal Distribution |
Version: | 2.0 |
Date: | 2015-11-23 |
Author: | Steve Kalke |
Maintainer: | Steve Kalke <steve.kalke@googlemail.com> |
Description: | Evaluation of the pdf and the cdf of the univariate, noncentral, p-generalized normal distribution. Sampling from the univariate, noncentral, p-generalized normal distribution using either the p-generalized polar method, the p-generalized rejecting polar method, the Monty Python method, the Ziggurat method or the method of Nardon and Pianca. The package also includes routines for the simulation of the bivariate, p-generalized uniform distribution and the simulation of the corresponding angular distribution. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
LazyData: | true |
NeedsCompilation: | no |
Packaged: | 2015-11-24 07:39:02 UTC; Steve |
Repository: | CRAN |
Date/Publication: | 2015-11-24 15:08:34 |
The p
-Generalized Normal Distribution
Description
The pgnorm-package includes routines to evaluate (cdf,pdf) and simulate the univariate p
-generalized normal distribution with form parameter p
, expectation mean
and standard deviation \sigma
. The pdf of this distribution is given by
f(x,p,mean,\sigma)=(\sigma_p/ \sigma) \, C_p \, \exp \left( - \left( \frac{\sigma_p}{\sigma } \right)^p \frac{\left| x-mean \right|^p}{p} \right) ,
where C_p=p^{1-1/p}/2/\Gamma(1/p)
and \sigma_p^2=p^{2/p} \, \Gamma(3/p)/\Gamma(1/p)
, which becomes
f(x,p,mean,\sigma)=C_p \, \exp \left( - \frac{\left| x \right|^p}{p} \right),
if \sigma=\sigma_p
and mean=0
. The random number generation can be realized with one of five different simulation methods including the p
-generalized polar method, the p
-generalized rejecting polar method, the Monty Python method, the Ziggurat method and the method of Nardon and Pianca. Additionally to the simulation of the p-generalized normal distribution, the related p
-generalized uniform distribution on the p
-generalized unit circle and the corresponding angular distribution can be simulated by using the functions "rpgunif" and "rpgangular", respectively.
Details
Package: | pgnorm |
Type: | Package |
Version: | 2.0 |
Date: | 2015-11-23 |
License: | GPL (>= 2) |
LazyLoad: | yes |
Author(s)
Steve Kalke <steve.kalke@googlemail.com>
References
S. Kalke and W.-D. Richter (2013)."Simulation of the p-generalized Gaussian distribution." Journal of Statistical Computation and Simulation. Volume 83. Issue 4.
Examples
y<-rpgnorm(10,3)
Dataset 1 of the Monty Python method
Description
The dataset contains tail algorithm constants for sampling from the tail of the p
-generalized normal distribution in context of a simulation of the p
-generalized normal distribution with the Monty Python method.
Usage
data(datasetpgnmp1)
Examples
data(datasetpgnmp1)
Dataset 2 of the Monty Python method
Description
The dataset contains optimal rectangle widths in context of a simulation of the p
-generalized normal distribution with the Monty Python method.
Usage
data(datasetpgnmp2)
Examples
data(datasetpgnmp2)
Dataset of the Ziggurat method
Description
The dataset contains tail algorithm constants for sampling from the tail of the p
-generalized normal distribution in context of a simulation of the p
-generalized normal distribution with the Ziggurat method.
Usage
data(datasetpgnzig)
Examples
data(datasetpgnzig)
A function to evaluate the p
-generalized normal density
Description
The function evaluates the density f(x,p,mean,sigma)
of the univariate p
-generalized normal distribution according to
f(x,p,mean,\sigma)=(\sigma_p/ \sigma) \, C_p \, \exp \left( - \left( \frac{\sigma_p}{\sigma } \right)^p \frac{\left| x-mean \right|^p}{p} \right) ,
where C_p=p^{1-1/p}/2/\Gamma(1/p)
and \sigma_p^2=p^{2/p} \, \Gamma(3/p)/ \Gamma(1/p)
.
Usage
dpgnorm(y, p, mean, sigma)
Arguments
y |
The real argument of the function. |
p |
A positive number expressing the form parameter of the distribution. The default is 2. |
mean |
A real number expressing the expectation of the distribution. The default is 0. |
sigma |
A positive number expressing the standard deviation of the distribution. The default is |
Value
A real number.
Author(s)
Steve Kalke
References
S. Kalke and W.-D. Richter (2013)."Simulation of the p-generalized Gaussian distribution." Journal of Statistical Computation and Simulation. Volume 83. Issue 4.
Examples
y<-dpgnorm(0,3,1,2)
A function to evaluate the p
-generalized normal cdf
Description
The function evaluates the cdf of the univariate p
-generalized normal distribution according to the density
f(x,p,mean,\sigma)=(\sigma_p/ \sigma) \, C_p \, \exp \left( - \left( \frac{\sigma_p}{\sigma } \right)^p \frac{\left| x-mean \right|^p}{p} \right) ,
where C_p=p^{1-1/p}/2/\Gamma(1/p)
and \sigma_p^2=p^{2/p} \, \Gamma(3/p)/\Gamma(1/p)
.
Usage
ppgnorm(y, p, mean, sigma)
Arguments
y |
A real number, the argument of the function. |
p |
A positive number expressing the form parameter of the distribution. The default is 2. |
mean |
A real number expressing the expectation of the distribution. The default is 0. |
sigma |
A positive number expressing the standard deviation of the distribution. The default is |
Value
A real number.
Author(s)
Steve Kalke
References
S. Kalke and W.-D. Richter (2013)."Simulation of the p-generalized Gaussian distribution." Journal of Statistical Computation and Simulation. Volume 83. Issue 4.
Examples
y<-ppgnorm(2,p=3)
A random number generator for the angular distribution
Description
The function simulates the univariate angular distribution corresponding to the p
-generalized uniform distribution on the p
-generalized unit circle.
Usage
rpgangular(n,p)
Arguments
n |
The natural number of random variables to be simulated. |
p |
A positive number expressing the form parameter of the distribution. The default is 2. |
Value
An n
-dimensional, real vector.
Author(s)
Steve Kalke
References
S. Kalke and W.-D. Richter (2013)."Simulation of the p-generalized Gaussian distribution." Journal of Statistical Computation and Simulation. Volume 83. Issue 4.
Examples
y<-rpgangular(10000,3)
A random number generator for the p
-generalized normal distribution
Description
The function simulates the univariate p
-generalized normal distribution by using one of the following methods: the p
-generalized polar method (pgenpolar), the p
-generalized rejecting polar method (pgenpolarrej), the Monty Python method (montypython), the Ziggurat method (ziggurat) and the method of Nardon and Pianca (nardonpianca).
Usage
rpgnorm(n, p, mean, sigma, method)
Arguments
n |
The natural number of random variables to be simulated. |
p |
A positive number expressing the form parameter of the distribution. The default is 2. In case of the Monty Python method and the Ziggurat method, p can be chosen from |
mean |
A real number expressing the expectation of the distribution. The default is 0. |
sigma |
A positive number expressing the standard deviation of the distribution. The default is |
method |
A string expressing the method to be used for the simulation ("pgenpolar", "pgenpolarrej", "montypython", "ziggurat" or "nardonpianca"). The default is "nardonpianca". |
Value
An n
-dimensional, real vector.
Author(s)
Steve Kalke
References
S. Kalke and W.-D. Richter (2013)."Simulation of the p-generalized Gaussian distribution." Journal of Statistical Computation and Simulation. Volume 83. Issue 4.
Examples
y<-rpgnorm(10000,3,method="pgenpolar")
A random number generator for the p
-generalized normal distribution
Description
The function simulates the univariate, central, p
-generalized normal distribution by using the Monty Python method.
Usage
rpgnorm_montypython(n,p)
Arguments
n |
The natural number of random variables to be simulated. |
p |
A positive number expressing the form parameter of the distribution. The default is 2. In case of the Monty Python method, p can be chosen from |
Value
An n
-dimensional, real vector.
Author(s)
Steve Kalke
References
S. Kalke and W.-D. Richter (2013)."Simulation of the p-generalized Gaussian distribution." Journal of Statistical Computation and Simulation. Volume 83. Issue 4.
Examples
y<-rpgnorm_montypython(10000,3)
A random number generator for the p
-generalized normal distribution
Description
The function simulates the univariate, central, p
-generalized normal distribution by using the method of Nardon and Pianca.
Usage
rpgnorm_nardonpianca(n,p)
Arguments
n |
The natural number of random variables to be simulated. |
p |
A positive number expressing the form parameter of the distribution. The default is 2. |
Value
An n
-dimensional, real vector.
Author(s)
Steve Kalke
References
S. Kalke and W.-D. Richter (2013)."Simulation of the p-generalized Gaussian distribution." Journal of Statistical Computation and Simulation. Volume 83. Issue 4.
Examples
y<-rpgnorm_nardonpianca(10000,3)
A random number generator for the p
-generalized normal distribution
Description
The function simulates the univariate, central, p
-generalized normal distribution by using the p
-generalized polar method.
Usage
rpgnorm_pgenpolar(n,p)
Arguments
n |
The natural number of random variables to be simulated. |
p |
A positive number expressing the form parameter of the distribution. The default is 2. |
Value
An n
-dimensional, real vector.
Author(s)
Steve Kalke
References
S. Kalke and W.-D. Richter (2013)."Simulation of the p-generalized Gaussian distribution." Journal of Statistical Computation and Simulation. Volume 83. Issue 4.
Examples
y<-rpgnorm_pgenpolar(10000,3)
A random number generator for the p
-generalized normal distribution
Description
The function simulates the univariate, central, p
-generalized normal distribution by using the p
-generalized rejecting polar method.
Usage
rpgnorm_pgenpolarrej(n,p)
Arguments
n |
The natural number of random variables to be simulated. |
p |
A positive number expressing the form parameter of the distribution. The default is 2. |
Value
An n
-dimensional, real vector.
Author(s)
Steve Kalke
References
S. Kalke and W.-D. Richter (2013)."Simulation of the p-generalized Gaussian distribution." Journal of Statistical Computation and Simulation. Volume 83. Issue 4.
Examples
y<-rpgnorm_pgenpolarrej(10000,3)
A random number generator for the p
-generalized normal distribution
Description
The function simulates the univariate, central, p
-generalized normal distribution by using the Ziggurat method.
Usage
rpgnorm_ziggurat(n,p,x)
Arguments
n |
The natural number of random variables to be simulated. |
p |
A positive number expressing the form parameter of the distribution. The default is 2. In case of the Ziggurat method, p can be chosen from |
x |
(optional) A real vector containing the |
Value
An n
-dimensional, real vector.
Author(s)
Steve Kalke
References
S. Kalke and W.-D. Richter (2013)."Simulation of the p-generalized Gaussian distribution." Journal of Statistical Computation and Simulation. Volume 83. Issue 4.
Examples
y<-rpgnorm_ziggurat(10000,3)
A random number generator for the p
-generalized uniform distribution
Description
The function simulates the bivariate, p
-generalized uniform distribution on the p
-generalized unit circle.
Usage
rpgunif(n,p)
Arguments
n |
The natural number of random vectors to be simulated. |
p |
A positive number expressing the form parameter of the distribution. The default is 2. |
Value
A real n \times 2
matrix.
Author(s)
Steve Kalke
References
S. Kalke and W.-D. Richter (2013)."Simulation of the p-generalized Gaussian distribution." Journal of Statistical Computation and Simulation. Volume 83. Issue 4.
Examples
y<-rpgunif(10000,3)
A function for setting up the Ziggurat.
Description
The function approximates the rightmost x-coordinates of the first n-1 rectangles defining the Ziggurat in case of the central, p
-generalized normal distribution.
Usage
zigsetup(p, n, tol)
Arguments
p |
A positive number expressing the form parameter of the distribution. The default is 2. In case of the Ziggurat method, p can be chosen from |
n |
The number of rectangles that build up the Ziggurat. The default is |
tol |
A positive number expressing the approximation accuracy of the function. The default is |
Value
An (n-1)
-dimensional, real vector.
Author(s)
Steve Kalke
References
S. Kalke and W.-D. Richter (2013)."Simulation of the p-generalized Gaussian distribution." Journal of Statistical Computation and Simulation. Volume 83. Issue 4.
Examples
y<-zigsetup(3,20,10^(-6))