ddnorm {dapper} | R Documentation |
The Discrete Gaussian Distribution
Description
The probability mass function and random number generator for the
discrete Gaussian distribution with mean mu
and scale parameter sigma
.
Usage
ddnorm(x, mu = 0, sigma = 1, log = FALSE)
rdnorm(n, mu = 0, sigma = 1)
Arguments
x |
vector of quantiles. |
mu |
location parameter. |
sigma |
scale parameter. |
log |
logical; if |
n |
number of random deviates. |
Details
Probability mass function
P[X = x] = \dfrac{e^{-(x - \mu)^2/2\sigma^2}}{\sum_{y \in \mathbb{Z}} e^{-(x-\mu)^2/2\sigma^2}}.
Value
ddnorm() returns a numeric vector representing the probability mass function of the discrete Gaussian distribution.
rdnorm() returns a numeric vector of random samples from the discrete Gaussian distribution.
References
Canonne, C. L., Kamath, G., & Steinke, T. (2020). The Discrete Gaussian for Differential Privacy. arXiv. doi:10.48550/ARXIV.2004.00010
Examples
# mass function
ddnorm(0)
# mass function is also vectorized
ddnorm(0:10, mu = 0, sigma = 5)
# generate random samples
rdnorm(10)
[Package dapper version 1.0.0 Index]