Type: | Package |
Title: | Two Parameter Xgamma & Poisson Xgamma: Regression & Distribution Functions |
Version: | 1.0 |
Date: | 2025-03-12 |
Author: | Nikolaos Kontemeniotis [aut, cre], Michail Tsagris [aut] |
Maintainer: | Nikolaos Kontemeniotis <kontemeniotisn@gmail.com> |
Depends: | R (≥ 4.0) |
Imports: | Rfast2, stats |
Suggests: | Rfast |
Description: | The two-parameter Xgamma and Poisson Xgamma distributions are analyzed, covering standard distribution and regression functions, maximum likelihood estimation, quantile functions, probability density and mass functions, cumulative distribution functions, and random number generation. References include: "Sen, S., Chandra, N. and Maiti, S. S. (2018). On properties and applications of a two-parameter XGamma distribution. Journal of Statistical Theory and Applications, 17(4): 674–685. <doi:10.2991/jsta.2018.17.4.9>." "Wani, M. A., Ahmad, P. B., Para, B. A. and Elah, N. (2023). A new regression model for count data with applications to health care data. International Journal of Data Science and Analytics. <doi:10.1007/s41060-023-00453-1>." |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-03-17 11:59:31 UTC; nikolask |
Repository: | CRAN |
Date/Publication: | 2025-03-18 15:10:09 UTC |
Cumulative Density Function of the TPXG Distribution
Description
Computes the cumulative density function of the Two-Parameter Xgamma distribution for given values.
Usage
ptpxg(x, alpha = 1, theta = 1)
Arguments
x |
A numeric vector with strictly positive values. |
alpha |
A positive real number. |
theta |
A positive real number. |
Details
Let X \sim \text{TPXG}(\alpha,\theta)
. Then the cumulative distribution function of X is given by:
F(x)=1-\frac{(\alpha+\theta+\alpha \theta x+\frac{1}{2}\alpha \theta^2 x^2)}{(\alpha+\theta)}e^{-\theta x}
\quad x,\theta,\alpha > 0
Value
A numeric vector containing the cumulative density function values of the TPXG distribution for each of the given values of x.
Author(s)
Nikolaos Kontemeniotis.
R implementation and documentation: Nikolaos Kontemeniotis kontemeniotisn@gmail.com and Michail Tsagris mtsagris@uoc.gr.
References
"Sen, S., Chandra, N. and Maiti, S. S. (2018). On properties and applications of a two-parameter XGamma distribution. Journal of Statistical Theory and Applications, 17(4): 674–685."
See Also
Examples
x <- ptpxg(100)
ptpxg(x, 1, 1)
Cumulative Mass Function of the TPPXG Distribution
Description
Computes the cumulative mass function of the Two Parameter Poisson Xgamma distribution for given values.
Usage
ptppxg(x , alpha = 1, theta = 1)
Arguments
x |
A numeric vector containg non-negative integer values. |
alpha |
A positive real number. |
theta |
A positive real number. |
Details
The cumulative distribution function of the Two Parameter Poisson Xgamma is given by:
F(x)=1-\frac{1}{2(\alpha+\theta)(1+\theta)^{x+3}}\left((x^2+5x+6)\alpha \theta^2+2(x+3)\alpha \theta
+2(1+\theta)^2+2\alpha \right)
Value
A numeric vector containing the cumulative mass function of the TPPXG distribution for each of the given values of x.
Author(s)
Nikolaos Kontemeniotis.
R implementation and documentation: Nikolaos Kontemeniotis kontemeniotisn@gmail.com and Michail Tsagris mtsagris@uoc.gr.
References
"Wani, M. A., Ahmad, P. B., Para, B. A. and Elah, N. (2023). A new regression model for count data with applications to health care data. International Journal of Data Science and Analytics."
See Also
Examples
x <- rtppxg(100)
ptppxg(x, 1, 1)
Inverse Cumulative Density Function of the TPXG Distribution
Description
Computes the inverse cumulative density function of the Two-Parameter Xgamma distribution for given probabilities.
Usage
qtpxg(p, alpha = 1, theta = 1 , tol = 1e-5)
Arguments
p |
A numeric vector containing values in [0,1]. |
alpha |
A positive real number. |
theta |
A positive real number |
tol |
A positive real number specifying the tolerance level for the convergence of the Newton-Raphson algorithm. |
Details
This function uses the Newton-Raphson algorithm in order to estimate the inverse cumulative density function.
Value
A numeric vector containing the inverse cumulative density function values of the TPXG distribution for each of the given values of x.
Author(s)
Nikolaos Kontemeniotis.
R implementation and documentation: Nikolaos Kontemeniotis kontemeniotisn@gmail.com and Michail Tsagris mtsagris@uoc.gr.
References
"Sen, S., Chandra, N. and Maiti, S. S. (2018). On properties and applications of a two-parameter XGamma distribution. Journal of Statistical Theory and Applications, 17(4): 674–685."
See Also
Examples
p <- runif(100)
qtpxg(p, 1, 1)
Inverse Cumulative Mass Function of the TPPXG Distribution
Description
Computes the inverse cumulative mass function (quantile function) of the Two Parameter Poisson Xgamma distribution for given probability values.
Usage
qtppxg(p, alpha = 1, theta = 1, tol = 1e-5)
Arguments
p |
A numeric vector containg values in [0,1]. |
alpha |
A positive real number. |
theta |
A positive real number. |
tol |
A positive real number specifying the tolerance level for the convergence of the Newton-Raphson algorithm. |
Details
This function uses the Newton-Raphson algorithm in order to estimate the inverse cumulative mass function.
Value
A numeric vector containing the inverse cumulative mass function of the TPPXG distribution at the given values of p.
Author(s)
Nikolaos Kontemeniotis.
R implementation and documentation: Nikolaos Kontemeniotis kontemeniotisn@gmail.com and Michail Tsagris mtsagris@uoc.gr.
References
"Wani, M. A., Ahmad, P. B., Para, B. A. and Elah, N. (2023). A new regression model for count data with applications to health care data. International Journal of Data Science and Analytics."
See Also
Examples
p <- runif(100)
qtppxg(p, 1, 1)
Maximum likelihood estimation of the TPPXG distribution parameters.
Description
Estimation of \alpha
and \theta
parameters of Two Parameter Poisson Xgamma distribution using maximum likelihood.
Usage
tppxg.mle(x)
Arguments
x |
A numeric vector containg non-negative integer values. |
Details
The log-likelihood function of the TPPXG distribution is given by:
\ln L(\alpha,\theta)=2n\ln \theta-n\ln(\alpha+\theta)-\left(3n+\sum_{i=1}^n x_i\right)\ln(1+\theta)+
\sum_{i=1}^n\ln \left((1+\theta)^2+\frac{\alpha \theta}{2}(x_i+1)(x_i+2)\right)
Value
A named numeric vector containing the estimated values for \alpha
, \theta
and maximum likelihood.
Author(s)
Nikolaos Kontemeniotis.
R implementation and documentation: Nikolaos Kontemeniotis kontemeniotisn@gmail.com and Michail Tsagris mtsagris@uoc.gr.
References
"Wani, M. A., Ahmad, P. B., Para, B. A. and Elah, N. (2023). A new regression model for count data with applications to health care data. International Journal of Data Science and Analytics."
See Also
Examples
x <- rtppxg(1000)
tppxg.mle(x)
Estimation of the TPPXG regression coefficients.
Description
This function estimates the Two Parameter Poisson Xgamma regression coefficients as well as the
\alpha
parameter of the Two Parameter Poisson Xgamma distribution using the maximum likelihood method.
Usage
tppxg.reg(y, x)
Arguments
y |
A numeric vector containg non-negative integer values. |
x |
A matrix or a data.frame with the predictor variables. |
Details
The \theta
parameter has been transformed as a function of the expected value of the response variable Y
in the following manner:
\theta=\frac{1-\alpha \mu +\sqrt{(\alpha \mu -1)^2+12\alpha \mu}}{2\mu}
Given that the response variable satisfies Y_i \sim \text{TPPXG}(\alpha, \mu_i)
, then the
i^{\text{th}}
mean of Y is related to the predictor variables using the log link function:
\mu_i=e^{x_i^T \beta} \quad i=1,2,3,\dots n
For more details, see the paper referenced below.
Value
A named list containing \alpha
parameter, a vector containing the \beta
coefficients and the maximum likelihood value.
Author(s)
Nikolaos Kontemeniotis.
R implementation and documentation: Nikolaos Kontemeniotis kontemeniotisn@gmail.com and Michail Tsagris mtsagris@uoc.gr.
References
"Wani, M. A., Ahmad, P. B., Para, B. A. and Elah, N. (2023). A new regression model for count data with applications to health care data. International Journal of Data Science and Analytics."
See Also
Examples
x <- matrix( rnorm(100 * 2), ncol = 2 )
y <- rtppxg(100)
tppxg.reg(y, x)
Maximum likelihood estimation of the TPXG distribution parameters.
Description
Estimation of \alpha
and \theta
parameters of Two Parameter Xgamma distribution using maximum likelihood.
Usage
tpxg.mle(x)
Arguments
x |
A numeric vector containg strictly positive values. |
Details
The log-likelihood functiono of the TPXG distribution is given by:
\ln L(\alpha, \theta|x) = 2n \ln \theta - n \ln (\alpha + \theta) - \theta \left(\sum_{i=1}^{n} x_i\right)
+ \sum_{i=1}^{n} \ln \left(1 + \frac{\alpha\theta}{2}x_i^2\right)
Value
A named numeric vector containing the estimated values for \alpha
, \theta
and maximum likelihood.
Author(s)
Nikolaos Kontemeniotis.
R implementation and documentation: Nikolaos Kontemeniotis kontemeniotisn@gmail.com and Michail Tsagris mtsagris@uoc.gr.
References
"Sen, S., Chandra, N. and Maiti, S. S. (2018). On properties and applications of a two-parameter XGamma distribution. Journal of Statistical Theory and Applications, 17(4): 674–685."
See Also
Examples
x <- rtpxg(1000)
tpxg.mle(x)
Estimation of log-link TPXG regression coefficients.
Description
This function estimates the Two Parameter Xgamma regression coefficients as well as the
\alpha
parameter of the Two Parameter Xgamma distribution using the maximum likelihood method.
Usage
tpxg.reg(y,x)
Arguments
y |
A numeric vector containg strictly positive values. |
x |
A matrix or a data.frame with the predictor variables. |
Details
This implementation employs a logarithmic link function to relate the \theta
parameter of the
Two-Parameter Xgamma distribution to the predictor variables.
Specifically, the relationship is defined as:
\theta=e^{X\beta}
where X is a matrix whose columns represent the predictor variables, and
\beta
is a column vector of corresponding regression coefficients.
Value
A named list containing \alpha
parameter, a vector containing the \beta
coefficients and the maximum likelihood value.
Author(s)
Nikolaos Kontemeniotis.
R implementation and documentation: Nikolaos Kontemeniotis kontemeniotisn@gmail.com and Michail Tsagris mtsagris@uoc.gr.
References
"Sen, S., Chandra, N. and Maiti, S. S. (2018). On properties and applications of a two-parameter XGamma distribution. Journal of Statistical Theory and Applications, 17(4): 674–685."
See Also
Examples
x <- matrix( rnorm(100 * 2), ncol = 2 )
y <- rtpxg(100)
tpxg.reg(y, x)
Probability Density Function of TPPXG Distribution
Description
Computes the probability density function of the Two Parameter Xgamma distribution for a given set positive real values.
Usage
dtpxg(x, alpha = 1, theta = 1)
Arguments
x |
A numeric vector containing strictly positive values. |
alpha |
A positive real number. |
theta |
A positive real number. |
Details
Let U\sim \text{TPXG}(\alpha,\theta)
.Then the probability density function of U is given by:
f(u;\alpha,\theta)=\frac{\theta^2}{\alpha+\theta}(1+\frac{\alpha \theta}{2}u^2)e^{-\theta u}
\quad \theta,\alpha > 0 , u > 0
Value
A numeric vector containing the probability density function value of the TPXG distribution for each of the given values of x.
Author(s)
Nikolaos Kontemeniotis.
R implementation and documentation: Nikolaos Kontemeniotis kontemeniotisn@gmail.com and Michail Tsagris mtsagris@uoc.gr.
References
"Sen, S., Chandra, N. and Maiti, S. S. (2018). On properties and applications of a two-parameter XGamma distribution. Journal of Statistical Theory and Applications, 17(4): 674–685."
See Also
Examples
x <- rtpxg(100)
dtpxg(x, 1, 1)
Probability Mass Function of the TPPXG Distribution
Description
Computes the probability mass function of the Two Parameter Poisson Xgamma distribution for a given set of non-negative integer values.
Usage
dtppxg(x, alpha = 1, theta = 1)
Arguments
x |
A numeric vector containing non-negative integer values. |
alpha |
A positive real number. |
theta |
A positive real number. |
Details
Assume a random variable X follows the two-parameter Poisson-Xgamma distribution, which has the following stochastic representation:
X|\lambda \sim \text{Poisson}(\lambda)
\lambda|\alpha,\theta \sim \text{TPXG}(\alpha,\theta)
Then the probability mass function of X is given by:
P(X=x)=\frac{\theta^2}{(\alpha+\theta)(1+\theta)^{x+3}}
\left\{(1+\theta)^2+\frac{\alpha \theta}{2}(x+1)(x+2)\right\}; x = 0, 1, 2, 3, \dots
Value
A numeric vector containing the probability mass function value of the TPPXG distribution for each of the given values of x.
Author(s)
Nikolaos Kontemeniotis.
R implementation and documentation: Nikolaos Kontemeniotis kontemeniotisn@gmail.com and Michail Tsagris mtsagris@uoc.gr.
References
"Wani, M. A., Ahmad, P. B., Para, B. A. and Elah, N. (2023). A new regression model for count data with applications to health care data. International Journal of Data Science and Analytics."
See Also
Examples
x <- rtppxg(100)
dtppxg(x, 1, 1)
Random Numbers from the TPGX Distribution
Description
Generates random numbers form the Two Parameter Xgamma distribution.
Usage
rtpxg(n, alpha = 1, theta = 1)
Arguments
n |
An integer indicating the desired sample size. |
alpha |
A positive real number. |
theta |
A positive real number. |
Details
The TPXG distribution is a mixture of exponential(\theta)
and gamma(3,\theta)
with mixing proportions
\frac{\theta}{\alpha+\theta}
and \frac{\alpha}{\alpha+\theta}
respectively.
Value
A numeric vector of size n containing random values from the TPXG distribution.
Author(s)
Nikolaos Kontemeniotis.
R implementation and documentation: Nikolaos Kontemeniotis kontemeniotisn@gmail.com and Michail Tsagris mtsagris@uoc.gr.
References
"Sen, S., Chandra, N. and Maiti, S. S. (2018). On properties and applications of a two-parameter XGamma distribution. Journal of Statistical Theory and Applications, 17(4): 674–685."
See Also
Examples
x <- rtpxg(100)
Random Numbers from the TPPGX Distribution
Description
Generates random numbers form the Two Parameter Poisson Xgamma distribution.
Usage
rtppxg(n, alpha = 1, theta = 1)
Arguments
n |
An integer indicating the desired sample size. |
alpha |
A positive real number. |
theta |
A positive real number. |
Details
In order to obtain random numbers from the TPPXG distribution this function works in two parts. First it
generates n random \lambda
values where \lambda|\alpha,\theta \sim \text{TPXG}(\alpha,\theta)
. Given
this, it generates n numbers X where X|\lambda \sim \text{Poisson}(\lambda)
.
Value
A numeric vector of size n containing random values from the TPPXG distribution.
Author(s)
Nikolaos Kontemeniotis.
R implementation and documentation: Nikolaos Kontemeniotis kontemeniotisn@gmail.com and Michail Tsagris mtsagris@uoc.gr.
References
"Wani, M. A., Ahmad, P. B., Para, B. A. and Elah, N. (2023). A new regression model for count data with applications to health care data. International Journal of Data Science and Analytics."
See Also
Examples
x <- rtppxg(100)
Two Parameter Xgamma & Poisson Xgamma: Regression & Distribution Functions.
Description
The two-parameter Xgamma and Poisson Xgamma distributions are analyzed, covering standard distribution and regression functions, maximum likelihood estimation, quantile functions, probability density and mass functions, cumulative distribution functions, and random number generation.
Details
Package: | tpxg |
Type: | Package |
Version: | 1.0 |
Date: | 2025-03-12 |
License: | GPL-2 |
Maintainers
Nikolaos Kontemeniotis kontemeniotisn@gmail.com.
Author(s)
Nikolaos Kontemeniotis kontemeniotisn@gmail.com and Michail Tsagris mtsagris@uoc.gr.
References
"Wani, M. A., Ahmad, P. B., Para, B. A. and Elah, N. (2023). A new regression model for count data with applications to health care data. International Journal of Data Science and Analytics."
"Sen, S., Chandra, N. and Maiti, S. S. (2018). On properties and applications of a two-parameter XGamma distribution. Journal of Statistical Theory and Applications, 17(4): 674–685."