| Type: | Package |
| Title: | Discrete Laplace Exponential Family |
| Version: | 1.5.1 |
| Author: | Mikkel Meyer Andersen and Poul Svante Eriksen |
| Maintainer: | Mikkel Meyer Andersen <mikl@math.aau.dk> |
| Description: | The discrete Laplace exponential family for use in fitting generalized linear models. |
| License: | GPL-2 |
| LazyLoad: | yes |
| NeedsCompilation: | no |
| Packaged: | 2022-01-27 11:48:54 UTC; mikl |
| Repository: | CRAN |
| Date/Publication: | 2022-01-27 12:10:09 UTC |
Discrete Laplace Family
Description
Discrete Laplace Family for models such as a generalized linear model.
Details
DiscreteLaplace() ddisclap(x, p) pdisclap(x, p, lower.tail = TRUE) rdisclap(n, p)
Author(s)
Mikkel Meyer Andersen and Poul Svante Eriksen
Maintainer: Mikkel Meyer Andersen <mikl@math.aau.dk>
See Also
DiscreteLaplace
ddisclap
pdisclap
rdisclap
Probability mass function, distribution function, and random generation for the discrete Laplace distribution with parameter 0 <= p < 1.
Description
Calculates the mass of observations from the discrete Laplace distribution.
Usage
ddisclap(x, p)
pdisclap(x, p, lower.tail = TRUE)
rdisclap(n, p)
Arguments
x |
vector of observations |
p |
the parameter with 0 <= p < 1 |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]. |
n |
number of observations to generate |
Details
The probability mass function for the discrete Laplace distribution with parameter 0 < p < 1 is given by P(X = x) = \frac{1-p}{1+p} p^x for x \in \mathbf{Z}.
If x is a vector, then p must have either length 1 or the same length as x. If p has length 1, then the value will be reused for all values in x.
Value
'ddisclap' gives the probability mass, 'pdisclap' gives the distribution function, and 'rdisclap' generates random deviates.
Author(s)
Mikkel Meyer Andersen <mikl@math.aau.dk> and Poul Svante Eriksen
See Also
Examples
p <- 0.3
xs <- (-4):4
probd <- ddisclap(xs, p)
data.frame(xs, probd)
plot(xs, probd, type = "l", xlab = "x", ylab = "P(X = x; p)")
Discrete Laplace exponential family
Description
Discrete Laplace exponential family for models such as a generalized linear model.
Usage
DiscreteLaplace()
Details
This family can be used in for example fitting a generalized linear model using the glm or glm.fit function.
Value
Author(s)
Mikkel Meyer Andersen <mikl@math.aau.dk> and Poul Svante Eriksen
See Also
glm
glm.fit
ddisclap
binomial
poisson
Examples
xs <- abs(rdisclap(100, 0.1))
fit <- glm(xs ~ 1, family = DiscreteLaplace())
summary(fit)
theta <- as.numeric(coef(fit)[1])
mu <- DiscreteLaplace()$linkinv(theta)
p <- (sqrt(1 + mu^2) - 1) / mu
p