Title: | Poisson-Tweedie Exponential Family Models |
---|---|
Description: | Simulation of models Poisson-Tweedie. |
Authors: | David Pechel Cactcha, Laure Pauline Fotso and Celestin C Kokonendji |
Maintainer: | David Pechel Cactcha <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.2 |
Built: | 2024-12-01 08:34:55 UTC |
Source: | CRAN |
Let X be a non-negative random variable following . If a discrete random
variable Y is such that the conditional distribution of Y given X is Poisson with mean
X, then the EDM generated by the distribution of Y is of the Poisson-Tweedie class. For
individual probabilities of
when Y follows a Poisson-Tweedie Distributions are:
.
For p = 1, it is a Neyman type A distribution; for , then Poisson-compound Poisson distribution is obtained;
for p = 2,the Poisson-Tweedie model
correspond to the negative binomiale law
; and, for p = 3, it is the Sichel or Poisson-inverse
Gaussian distribution (e.g. Willmot, 1987). Also, when
,
and the
, the Poisson-Tweedie model
correspond to the poisson law
.
dpoistweedie(y, p, mu, lambda, theta0, log) densitept1(p, n, mu, lambda, theta0) densitept2(p, n, mu, lambda, theta0) dpt1(p, n, mu, lambda, theta0) dpt1Log(p, n, mu, lambda, theta0) dpt2(p, n, mu, lambda, theta0) dpt2Log(p, n, mu, lambda, theta0) dptp(p, n, mu, lambda, theta0) dptpLog(p, n, mu, lambda, theta0) gam1.1(y, lambda) gam1.2(y, lambda) imfx0(x0,p,mu,theta0) moyennePT(p,omega,theta0) omega(p,mu,theta0) testOmegaPT(p,n)
dpoistweedie(y, p, mu, lambda, theta0, log) densitept1(p, n, mu, lambda, theta0) densitept2(p, n, mu, lambda, theta0) dpt1(p, n, mu, lambda, theta0) dpt1Log(p, n, mu, lambda, theta0) dpt2(p, n, mu, lambda, theta0) dpt2Log(p, n, mu, lambda, theta0) dptp(p, n, mu, lambda, theta0) dptpLog(p, n, mu, lambda, theta0) gam1.1(y, lambda) gam1.2(y, lambda) imfx0(x0,p,mu,theta0) moyennePT(p,omega,theta0) omega(p,mu,theta0) testOmegaPT(p,n)
y |
vector of (non-negative integer) quantiles |
p |
is a real index related to a precise model |
n |
non-negative integer (length of y) |
x0 |
is a real index |
mu |
the mean |
omega |
is a real index. |
lambda |
the dispersion parameter |
theta0 |
the canonical parameter |
log |
logical; if TRUE, probabilities y are given as log(y). |
The Poisson-Tweedie distributions arethe EDMs with a variance of the form
,
where
a generally implicit, denotes the inverse of the increansing function
. omega(p,mu,theta0) is a function whose permit to determine the value of w.
density (dpoistweedie
),for the given Poisson-Tweedie distribution with parameters
Cactha David Pechel, Laure Pauline Fotso and Celestin C Kokonendji Maintainer: Cactha David Pechel ( <[email protected]>)
Dunn, Peter K and Smyth, Gordon K (To appear). Series evaluation of Tweedie exponential dispersion model densities Statistics and Computing.
Dunn, Peter K and Smyth, Gordon K (2001). Tweedie family densities: methods of evaluation. Proceedings of the 16th International Workshop on Statistical Modelling, Odense, Denmark, 2–6 July
Hougaard, P., Lee, M-L.T. and Whitmore, G.A. (1997). Analysis of overdispersed count data by mixtures of Poisson variables and Poisson processes, Biometrics 53, 1225–1238
Jorgensen, B. (1987). Exponential dispersion models. Journal of the Royal Statistical Society, B, 49, 127–162.
Kokonendji, C.C., Demeetrio, C.G.B. and Dossou-Gbete, S. (2004). Some discrete exponential dispersion models: Poisson-Tweedie and Hinde-Demetrio classes. SORT: Statistics and Operations Research Transactions 28 (2), 201–214.
## dpoistweedie(y, power, mu,lambda,theta0,log = FALSE) ## Plot dpois() and dpoistweedie() with log=FALSE layout(matrix(1 :1, 1, 1)) layout.show(2) power <- exp(10) mu <-10 lambda <- 10 theta0<--10 lambda1<-100 y <- 0:200 ## plot dpoistweedie function with log = FALSE d1<-dpoistweedie(y,power,mu,lambda,theta0,log = FALSE) d2<-dpois(y,lambda1,log=FALSE) erreure<-d1-d2 plot (y,d1,col='blue', type='h',xlab="y avec y=0:200, power=exp(30),mu=10, lambda=10, theta0=-10, lambda1=100", ylab="densite P(100)", main = "dpoistweedie(*,col='blue' log=FALSE) et dpois(*,col='red' log=FALSE)") lines(y,d2,type ="p",col='red',lwd=2) sum(abs(erreure)) ## Plot dnbinom() and dpoistweedie() layout(matrix(1 :1, 1, 1)) layout.show(2) power<-2 mu<-10 lambda <- 1 theta0<-0 prob<-1-(mu/(1+mu)) y <- seq(0,50, by =3) ## plot a dpoistweedie function with log=FALSE d1<-dpoistweedie(y,power,mu,lambda,theta0,log=FALSE) d2<-dnbinom(y,lambda,prob, log=FALSE) erreure<-d1-d2 plot (y,d1,col='blue', type='h',xlab="y avec y=seq(0,50,by=3), power=2,mu=10, lambda=1, thetao=0", ylab="densite NB(1,1/11)" ,main = "dnpoistweedie(*,col='blue' log=FALSE) et dnbinom(*,col='red' log=FALSE)") lines(y,d2,type ="p",col='red',lwd=2) abs(erreure)
## dpoistweedie(y, power, mu,lambda,theta0,log = FALSE) ## Plot dpois() and dpoistweedie() with log=FALSE layout(matrix(1 :1, 1, 1)) layout.show(2) power <- exp(10) mu <-10 lambda <- 10 theta0<--10 lambda1<-100 y <- 0:200 ## plot dpoistweedie function with log = FALSE d1<-dpoistweedie(y,power,mu,lambda,theta0,log = FALSE) d2<-dpois(y,lambda1,log=FALSE) erreure<-d1-d2 plot (y,d1,col='blue', type='h',xlab="y avec y=0:200, power=exp(30),mu=10, lambda=10, theta0=-10, lambda1=100", ylab="densite P(100)", main = "dpoistweedie(*,col='blue' log=FALSE) et dpois(*,col='red' log=FALSE)") lines(y,d2,type ="p",col='red',lwd=2) sum(abs(erreure)) ## Plot dnbinom() and dpoistweedie() layout(matrix(1 :1, 1, 1)) layout.show(2) power<-2 mu<-10 lambda <- 1 theta0<-0 prob<-1-(mu/(1+mu)) y <- seq(0,50, by =3) ## plot a dpoistweedie function with log=FALSE d1<-dpoistweedie(y,power,mu,lambda,theta0,log=FALSE) d2<-dnbinom(y,lambda,prob, log=FALSE) erreure<-d1-d2 plot (y,d1,col='blue', type='h',xlab="y avec y=seq(0,50,by=3), power=2,mu=10, lambda=1, thetao=0", ylab="densite NB(1,1/11)" ,main = "dnpoistweedie(*,col='blue' log=FALSE) et dnbinom(*,col='red' log=FALSE)") lines(y,d2,type ="p",col='red',lwd=2) abs(erreure)
Density, Log of density, variance for the Poisson-Tweedie family of distributions
poistweedie(x, n, p, mu, lambda, theta0, lower.tail = TRUE, log.p = FALSE, fonction = "PROBABILITE") poisson(x, n, p, lambda1, lower.tail = TRUE, log.p = FALSE, fonction = "PROBABILITE") nbinomiale(x, n, p, lambda1, p1, lower.tail = TRUE, log.p = FALSE, fonction = "PROBABILITE")
poistweedie(x, n, p, mu, lambda, theta0, lower.tail = TRUE, log.p = FALSE, fonction = "PROBABILITE") poisson(x, n, p, lambda1, lower.tail = TRUE, log.p = FALSE, fonction = "PROBABILITE") nbinomiale(x, n, p, lambda1, p1, lower.tail = TRUE, log.p = FALSE, fonction = "PROBABILITE")
x |
vector of (non-negative integer) quantiles. |
p |
is a real index related to a precise model. |
p1 |
is a real index related to a precise model. |
n |
non-negative integer |
mu |
the mean. |
lambda |
the dispersion parameter. |
lambda1 |
the dispersion parameter. |
theta0 |
the canonical parameter. |
log , log.p
|
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]. |
fonction |
is a string |
Density, Log of density, variance for the Poisson-Tweedie family of distributions
Cactha David Pechel, Laure Pauline Fotso and Celestin C Kokonendji Maintainer: Cactha David Pechel ( <[email protected]>)
## poistweedie(x, n, p, mu, lambda, theta0, lower.tail = TRUE, ## log.p = FALSE, fonction = "PROBABILITE") x <- 0:200 p <- 1.5 mu <-10 lambda <- 10 theta0<--10 d1<-poistweedie(x, n, p, mu, lambda, theta0, lower.tail = TRUE, log.p = FALSE, fonction = "PROBABILITE")
## poistweedie(x, n, p, mu, lambda, theta0, lower.tail = TRUE, ## log.p = FALSE, fonction = "PROBABILITE") x <- 0:200 p <- 1.5 mu <-10 lambda <- 10 theta0<--10 d1<-poistweedie(x, n, p, mu, lambda, theta0, lower.tail = TRUE, log.p = FALSE, fonction = "PROBABILITE")
Distribution function, for the Poisson-Tweedie family of distributions
ppoistweedie(q, p, mu, lambda, theta0, lower.tail, log.p)
ppoistweedie(q, p, mu, lambda, theta0, lower.tail, log.p)
q |
vector of quantiles. |
p |
is a real index related to a precise model. |
mu |
the mean. |
lambda |
the dispersion parameter. |
theta0 |
the canonical parameter. |
log , log.p
|
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]. |
The Poisson-Tweedie family of distributions belong to the class of exponential dispersion models (EDMs), famous for their role in generalized linear models.
probability (ppoistweedie
), for the given Poisson-Tweedie distribution with parameters
Cactha David Pechel, Laure Pauline Fotso and Celestin C Kokonendji Maintainer: Cactha David Pechel ( <[email protected]>)
## function ppoistweedie(q, power, mu,lambda,theta0, ## lower.tail = TRUE, log.p = FALSE) ## Plot ppois() et ppoistweedie() avec log.p=FALSE layout(matrix(1 :1, 1, 1)) layout.show(1) power<-exp(30) mu<-5 lambda <- 5 theta0<--5 prob<-1-(mu/(1+mu)) lambda1<-lambda^2 q <- 0:100 ## function ppoistweedie function with log=FALSE d1<-ppoistweedie(q,power,mu,lambda,theta0,lower.tail=TRUE,log.p=FALSE) d2<-ppois(q,lambda1,lower.tail=TRUE,log.p=FALSE) erreure<- d1-d2 plot (q,d1,col='blue', type='h',xlab="q avec q=0:100, power=exp(30),mu=5, lambda=5, theta0=-5, lambda1=25", ylab="fonction de repartition P(25)",main = "ppoistweedie(*,col='blue' log=FALSE) et ppois(*,col='red' log=FALSE)") lines(q,d2,type ="p",col='red',lwd=2) sum(abs(erreure))
## function ppoistweedie(q, power, mu,lambda,theta0, ## lower.tail = TRUE, log.p = FALSE) ## Plot ppois() et ppoistweedie() avec log.p=FALSE layout(matrix(1 :1, 1, 1)) layout.show(1) power<-exp(30) mu<-5 lambda <- 5 theta0<--5 prob<-1-(mu/(1+mu)) lambda1<-lambda^2 q <- 0:100 ## function ppoistweedie function with log=FALSE d1<-ppoistweedie(q,power,mu,lambda,theta0,lower.tail=TRUE,log.p=FALSE) d2<-ppois(q,lambda1,lower.tail=TRUE,log.p=FALSE) erreure<- d1-d2 plot (q,d1,col='blue', type='h',xlab="q avec q=0:100, power=exp(30),mu=5, lambda=5, theta0=-5, lambda1=25", ylab="fonction de repartition P(25)",main = "ppoistweedie(*,col='blue' log=FALSE) et ppois(*,col='red' log=FALSE)") lines(q,d2,type ="p",col='red',lwd=2) sum(abs(erreure))
Quantile function for the Poisson-Tweedie family of distributions
qpoistweedie(p1, p, mu, lambda, theta0, lower.tail, log.p)
qpoistweedie(p1, p, mu, lambda, theta0, lower.tail, log.p)
p1 |
vector of probabilities. |
p |
is a real index related to a precise model. |
mu |
the mean. |
lambda |
the dispersion parameter. |
theta0 |
the canonical parameter. |
log , log.p
|
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]. |
The Poisson-Tweedie family of distributions belong to the class of exponential dispersion models (EDMs), famous for their role in generalized linear models. T
quantile (qpoistweedie
)
for the given Poisson-Tweedie distribution with parameters
Cactha David Pechel, Laure Pauline Fotso and Celestin C Kokonendji Maintainer: Cactha David Pechel ( <[email protected]>)
## function qpoistweedie(p, power, mu,lambda,theta0, ## lower.tail = TRUE, log.p = FALSE) ## Plot qpois() and qpoistweedie() with log.p=FALSE layout(matrix(1 :1, 1, 1)) layout.show(1) power<-exp(30) mu<-10 lambda <- 10 theta0<--10 prob<-1-(mu/(1+mu)) lambda1<-100 p <- runif(50) p ## plot of qpoistweedie function with log=FALSE d1<-ppoistweedie(p,power,mu,lambda,theta0,lower.tail=TRUE,log.p=FALSE) d2<-ppois(p,lambda1,lower.tail=TRUE,log.p=FALSE) erreure<- d1-d2 plot (p,d1,col='blue', type='h',xlab="p avec p=runif(50), power=exp(30),mu=10, lambda=10, theta0=-10, lambda1=100, lower.tail=TRUE", ylab="quantile function P(100)",main = "qpoistweedie(*,col='blue' log.p=FALSE) et qpois(*,col='red' log.p=FALSE)") lines(p,d2,type ="p",col='red',lwd=2) sum(abs(erreure))
## function qpoistweedie(p, power, mu,lambda,theta0, ## lower.tail = TRUE, log.p = FALSE) ## Plot qpois() and qpoistweedie() with log.p=FALSE layout(matrix(1 :1, 1, 1)) layout.show(1) power<-exp(30) mu<-10 lambda <- 10 theta0<--10 prob<-1-(mu/(1+mu)) lambda1<-100 p <- runif(50) p ## plot of qpoistweedie function with log=FALSE d1<-ppoistweedie(p,power,mu,lambda,theta0,lower.tail=TRUE,log.p=FALSE) d2<-ppois(p,lambda1,lower.tail=TRUE,log.p=FALSE) erreure<- d1-d2 plot (p,d1,col='blue', type='h',xlab="p avec p=runif(50), power=exp(30),mu=10, lambda=10, theta0=-10, lambda1=100, lower.tail=TRUE", ylab="quantile function P(100)",main = "qpoistweedie(*,col='blue' log.p=FALSE) et qpois(*,col='red' log.p=FALSE)") lines(p,d2,type ="p",col='red',lwd=2) sum(abs(erreure))
Random generation for the Poisson-Tweedie family of distributions
rpoistweedie(n, p, mu, lambda, theta0)
rpoistweedie(n, p, mu, lambda, theta0)
n |
number of random values to return. |
p |
vector of probabilities. |
mu |
the mean. |
lambda |
the dispersion parameter. |
theta0 |
the canonical parameter. |
The Poisson-Tweedie family of distributions belong to the class of exponential dispersion models (EDMs), famous for their role in generalized linear models.
random sample (rpoistweedie
)
for the given Poisson-Tweedie distribution with parameters
Cactha David Pechel, Laure Pauline Fotso and Celestin C Kokonendji Maintainer: Cactha David Pechel ( <[email protected]>)
## --------------- function rpoistweedie()---------------- ## layout(matrix(2 :1, 2,1)) layout.show(2) power<-exp(30) mu<-10 lambda <- 10 theta0<--10 prob<-1-(mu/(1+mu)) lambda1<-100 n<-10 set.seed(123) x1<-rpoistweedie(n,power,mu,lambda,theta0) set.seed(123) x2<-rpois(n,lambda1) hist(x1, xlim = c(min(x1),max(x1)), probability = FALSE, col ='blue',xlab="modalit\'{e}s: x1",ylab="effectifs ", nclass = max(x1) - min(x1),main="Histogramme de x1 (lambda=100, n=10)") hist(x2, xlim = c(min(x2),max(x2)), probability = FALSE, col ='blue',xlab="modalit\'{e}s: x2 ",ylab="effectifs ", nclass = max(x2) - min(x2),main="Histogramme de x2 (lambda1=100, n=10)") sum(x2-x1)
## --------------- function rpoistweedie()---------------- ## layout(matrix(2 :1, 2,1)) layout.show(2) power<-exp(30) mu<-10 lambda <- 10 theta0<--10 prob<-1-(mu/(1+mu)) lambda1<-100 n<-10 set.seed(123) x1<-rpoistweedie(n,power,mu,lambda,theta0) set.seed(123) x2<-rpois(n,lambda1) hist(x1, xlim = c(min(x1),max(x1)), probability = FALSE, col ='blue',xlab="modalit\'{e}s: x1",ylab="effectifs ", nclass = max(x1) - min(x1),main="Histogramme de x1 (lambda=100, n=10)") hist(x2, xlim = c(min(x2),max(x2)), probability = FALSE, col ='blue',xlab="modalit\'{e}s: x2 ",ylab="effectifs ", nclass = max(x2) - min(x2),main="Histogramme de x2 (lambda1=100, n=10)") sum(x2-x1)
Variance for the Poisson-Tweedie family of distributions
varpt(mu, p, theta0)
varpt(mu, p, theta0)
p |
is a real index related to a precise model. |
mu |
the mean. |
theta0 |
the canonical parameter. |
variance for the Poisson-Tweedie family of distributions
Cactha David Pechel, Laure Pauline Fotso and Celestin C Kokonendji Maintainer: Cactha David Pechel ( <[email protected]>)
## plot of variance layout(matrix(1:1,1,1)) layout.show(1) mu <- seq(0.001,6,l=100) var <-varpt(mu,p=5000,theta0=-150) plot(mu, var, type = "l", col = "green", lwd=1,main="variance(p,mu,theta0=-150)") grid(nx=1,ny=1, lty=1,lwd=2) lines(mu,varpt(mu,p=1,theta0=-150), type = "l", col = "blue", lwd=1) lines(mu,varpt(mu,p=2,theta0=-150), type = "l", col = "black", lwd=1) lines(mu,varpt(mu,p=1.5,theta0=-150), type = "l", col = "yellow", lwd=1) lines(mu,varpt(mu,p=2.5,theta0=-150), type = "l", col = "cyan", lwd=1) lines(mu,varpt(mu,p=3,theta0=-150), type = "l", col = "magenta", lwd=1) segments(4,2.5,4.5,2.5,col="blue" ) text(5,2.5,"p=1",cex=0.8) segments(4,2,4.5,2,col="yellow" ) text(5,2,"1.5",cex=0.8) segments(4,1.5,4.5,1.5,col= "black") text(5, 1.5,"p=2",cex=0.8) segments(4,1,4.5,1,col="cyan" ) text(5, 1,"p=2.5" ,cex=0.8) segments(4,0.5,4.5,0.5,col="magenta" ) text(5, 0.5,"p=3" ,cex=0.8) segments(4,0,4.5,0,col= "green" ) text(5, 0,"p=5000",cex=0.8)
## plot of variance layout(matrix(1:1,1,1)) layout.show(1) mu <- seq(0.001,6,l=100) var <-varpt(mu,p=5000,theta0=-150) plot(mu, var, type = "l", col = "green", lwd=1,main="variance(p,mu,theta0=-150)") grid(nx=1,ny=1, lty=1,lwd=2) lines(mu,varpt(mu,p=1,theta0=-150), type = "l", col = "blue", lwd=1) lines(mu,varpt(mu,p=2,theta0=-150), type = "l", col = "black", lwd=1) lines(mu,varpt(mu,p=1.5,theta0=-150), type = "l", col = "yellow", lwd=1) lines(mu,varpt(mu,p=2.5,theta0=-150), type = "l", col = "cyan", lwd=1) lines(mu,varpt(mu,p=3,theta0=-150), type = "l", col = "magenta", lwd=1) segments(4,2.5,4.5,2.5,col="blue" ) text(5,2.5,"p=1",cex=0.8) segments(4,2,4.5,2,col="yellow" ) text(5,2,"1.5",cex=0.8) segments(4,1.5,4.5,1.5,col= "black") text(5, 1.5,"p=2",cex=0.8) segments(4,1,4.5,1,col="cyan" ) text(5, 1,"p=2.5" ,cex=0.8) segments(4,0.5,4.5,0.5,col="magenta" ) text(5, 0.5,"p=3" ,cex=0.8) segments(4,0,4.5,0,col= "green" ) text(5, 0,"p=5000",cex=0.8)