DPO | R Documentation |
The function DPO()
defines the double Poisson distribution, a two parameters distribution, for a gamlss.family
object to be used in GAMLSS fitting using the function gamlss()
. The functions dDPO
, pDPO
, qDPO
and rPO
define the density, distribution function, quantile function and random generation for the double Poisson, DPO()
, distribution. The function get_C()
calculates numericaly the constant of proportionality needed for the pdf to sum up to 1.
DPO(mu.link = "log", sigma.link = "log")
dDPO(x, mu = 1, sigma = 1, log = FALSE)
pDPO(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)
qDPO(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE,
max.value = 10000)
rDPO(n, mu = 1, sigma = 1, max.value = 10000)
get_C(x, mu, sigma)
mu.link |
the link function for |
sigma.link |
the link function for |
x, q |
vector of (non-negative integer) quantiles |
p |
vector of probabilities |
mu |
the |
sigma |
the |
lower.tail |
logical; if |
log, log.p |
logical; if |
max.value |
a constant, set to the default value of 10000 for how far the algorithm should look for q |
n |
how many random values to generate |
The definition for the Double Poisson distribution first introduced by Efron (1986) is:
f(y|\mu,\sigma)=\left( \frac{1}{\sigma} \right)^{1/2} e^{- \mu / \sigma} \left( \frac{e^{-y} y^{y}}{y!}\right) \left(\frac{e \mu}{y} \right)^{y/\sigma} C
for y=0,1,2,\ldots,\infty
, \mu>0
and \sigma>0
where C
is the constant of proportinality which is calculated numerically using the function get_C
.
The function DPO
returns a gamlss.family
object which can be used to fit a double Poisson distribution in the gamlss()
function.
The distributons calculates the constant of proportionality numerically therefore it can be slow for large data
Mikis Stasinopoulos, Bob Rigby and Marco Enea
Efron, B., 1986. Double exponential families and their use in generalized linear Regression. Journal of the American Statistical Association 81 (395), 709-721.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R, Chapman and Hall/CRC, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1201/9780429298547")}. An older version can be found in https://www.gamlss.com/.
Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R. Journal of Statistical Software, Vol. 23, Issue 7, Dec 2007, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v023.i07")}.
Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1201/b21973")}
(see also https://www.gamlss.com/).
PO
DPO()
# overdisperse DPO
x <- 0:20
plot(x, dDPO(x, mu=5, sigma=3), type="h", col="red")
# underdisperse DPO
plot(x, dDPO(x, mu=5, sigma=.3), type="h", col="red")
# generate random sample
Y <- rDPO(100,5,.5)
plot(table(Y))
points(0:20, 100*dDPO(0:20, mu=5, sigma=.5)+0.2, col="red")
# fit a model to the data
# library(gamlss)
# gamlss(Y~1,family=DPO)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.