Type: | Package |
Title: | Complex Pearson Distributions |
Version: | 0.3.3 |
Date: | 2024-10-04 |
Maintainer: | Silverio Vilchez-Lopez <svilchez@ujaen.es> |
Description: | Probability mass function, distribution function, quantile function and random generation for the Complex Triparametric Pearson (CTP) and Complex Biparametric Pearson (CBP) distributions developed by Rodriguez-Avi et al (2003) <doi:10.1007/s00362-002-0134-7>, Rodriguez-Avi et al (2004) <doi:10.1007/BF02778271> and Olmo-Jimenez et al (2018) <doi:10.1080/00949655.2018.1482897>. The package also contains maximum-likelihood fitting functions for these models. |
Depends: | R (≥ 4.0.0) |
Imports: | hypergeo, Rdpack, dgof, graphics |
RdMacros: | Rdpack |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2024-10-04 11:10:40 UTC; UJA |
Author: | Silverio Vilchez-Lopez [aut, cre], Maria Jose Olmo-Jimenez [aut], Jose Rodriguez-Avi [aut] |
Repository: | CRAN |
Date/Publication: | 2024-10-04 13:30:06 UTC |
The Complex Triparametric Pearson (CTP) Distribution
Description
Probability mass function, distribution function, quantile function and random generation for the Complex Triparametric Pearson (CTP) and Complex Biparametric Pearson (CBP) distributions developed by Rodriguez-Avi et al (2003) doi:10.1007/s00362-002-0134-7, Rodriguez-Avi et al (2004) doi:10.1007/BF02778271 and Olmo-Jimenez et al (2018) doi:10.1080/00949655.2018.1482897. The package also contains maximum-likelihood fitting functions for these models.
Details
The Complex Triparametric Pearson (CTP) distribution with parameters a
, b
and \gamma
has pmf
f(x|a,b,\gamma) = C \Gamma(a+ib+x) \Gamma(a-ib+x) / (\Gamma(\gamma+x) x!), x=0,1,2,...
where i
is the imaginary unit, \Gamma(·)
the gamma function and
C = \Gamma(\gamma-a-ib) \Gamma(\gamma-a+ib) / (\Gamma(\gamma-2a) \Gamma(a+ib) \Gamma(a-ib))
the normalizing constant.
If a=0
the CTP is a Complex Biparametric Pearson (CBP) distribution, so the pmf of the CBP distribution is obtained.
If b=0
the CTP is an Extended Biparametric Waring (EBW) distribution, so the pmf of the EBW distribution is obtained.
In this case, a
is call \alpha
.
The mean and the variance of the CTP distribution are
E(X)=\mu=(a^2+b^2)/(\gamma-2a-1)
and Var(X)=E(X)·(E(X)+\gamma-1)/(\gamma-2a-2)
so \gamma>2a+2
.
It is underdispersed if a<-(\mu+1)/2
, equidispersed if a=-(\mu+1)/2
or overdispersed
if a>-(\mu+1)/2
. In particular, if a>=0
the CTP is always overdispersed.
Author(s)
Maintainer: Silverio Vilchez-Lopez svilchez@ujaen.es
Authors:
Maria Jose Olmo-Jimenez mjolmo@ujaen.es
Jose Rodriguez-Avi jravi@ujaen.es
References
Jose Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ (2003). “A new class of discrete distributions with complex parameters.” Stat. Pap., 44, 67–88. doi:10.1007/s00362-002-0134-7.
Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ, Olmo-Jimenez MJ (2004). “A triparametric discrete distribution with complex parameters.” Stat. Pap., 45, 81-95. doi:10.1007/BF02778271.
Olmo-Jimenez MJ, Rodriguez-Avi J, Cueva-Lopez V (2018). “A review of the CTP distribution: a comparison with other over- and underdispersed count data models.” Journal of Statistical Computation and Simulation, 88(14), 2684-2706. doi:10.1080/00949655.2018.1482897.
Cueva-Lopez V, Olmo-Jimenez MJ, Rodriguez-Avi J (2021). “An Over and Underdispersed Biparametric Extension of the Waring Distribution.” Mathematics, 9(170), 1-15. doi:10.3390/math9020170.
The Complex Biparametric Pearson (CBP) Distribution
Description
Probability mass function, distribution function, quantile function and random generation for the Complex Biparametric Pearson (CBP) distribution with parameters b
and \gamma
.
Usage
dcbp(x, b, gamma)
pcbp(q, b, gamma, lower.tail = TRUE)
qcbp(p, b, gamma, lower.tail = TRUE)
rcbp(n, b, gamma)
Arguments
x |
vector of (non-negative integer) quantiles. |
b |
parameter b (real) |
gamma |
parameter gamma (positive) |
q |
vector of quantiles. |
lower.tail |
if TRUE (default), probabilities are |
p |
vector of probabilities. |
n |
number of observations. If |
Details
The CBP distribution with parameters b
and \gamma
has pmf
f(x|b,\gamma) = C \Gamma(ib+x) \Gamma(-ib+x) / (\Gamma(\gamma+x) x!), x=0,1,2,...
where i
is the imaginary unit, \Gamma(·)
the gamma function and
C = \Gamma(\gamma-ib) \Gamma(\gamma+ib) / (\Gamma(\gamma) \Gamma(ib) \Gamma(-ib))
the normalizing constant.
The CBP is a particular case of the CTP when a=0
.
The mean and the variance of the CBP distribution are
E(X)=\mu=b^2/(\gamma-1)
and Var(X)=\mu(\mu+\gamma-1)/(\gamma-2)
so \gamma > 2
.
It is always overdispersed.
Value
dcbp
gives the pmf, pcbp
gives the distribution function, qcbp
gives the quantile function and rcbp
generates random values.
References
Jose Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ (2003). “A new class of discrete distributions with complex parameters.” Stat. Pap., 44, 67–88. doi:10.1007/s00362-002-0134-7.
See Also
Probability mass function, distribution function, quantile function and random generation for the CTP distribution: dctp
, pctp
, qctp
and rctp
.
Functions for maximum-likelihood fitting of the CBP distribution: fitcbp
.
Examples
# Examples for the function dcbp
dcbp(3,2,5)
dcbp(c(3,4),2,5)
# Examples for the function pcbp
pcbp(3,2,3)
pcbp(c(3,4),2,3)
# Examples for the function qcbp
qcbp(0.5,2,3)
qcbp(c(.8,.9),2,3)
# Examples for the function rcbp
rcbp(10,1,3)
Pearson's Chi-squared Test for Count Data
Description
chisq.test2
performs Pearson chi-squared goodness-of-fit test for count data
Usage
chisq.test2(obs, p.esp, npar = NULL, grouping = FALSE)
Arguments
obs |
a numeric vector with the counts |
p.esp |
a numeric vector with the expected probabilities of the same length of |
npar |
an integer specifying the number of parameters of the model. By default |
grouping |
a logical indicating whether to group in classes with expected frequency greater than or equal to 5. By default |
Value
A list with class "htest"
containing the following components:
-
statistic
: the value of the chi-squared test statistic. -
df
: the degrees of freedom of the approximate chi-squared distribution. -
p.value
: the p-value for the test. -
observed
: the observed counts. -
observed.grouped
: the observed counts grouped in classes with expected frequency greather or equal to 5. -
expected
: the expected counts under the null hypothesis. -
expected.grouped
: the expected counts under the null hypothesis grouped in classes with expected frequency greather or equal to 5. -
residuals
: the Pearson residuals computed as(observed - expected) / sqrt(expected)
.
Examples
set.seed(123)
x <- rctp(500, -1.5, 1, 2)
table(x)
obs <- c(172, 264, 57, 6, 0, 1)
fit <- fitctp(x)
p.esp <- c(dctp(0:(length(obs)-1),fit$coefficients[1],fit$coefficients[2],
fit$coefficients[3])[1:(length(obs)-1)],1-sum(dctp(0:(length(obs)-1),
fit$coefficients[1],fit$coefficients[2],fit$coefficients[3])[1:(length(obs)-1)]))
chisq.test2(obs, p.esp)
chisq.test2(obs, p.esp, grouping = TRUE)
chisq.test2(obs, npar= 3, p.esp)
The Complex Triparametric Pearson (CTP) Distribution
Description
Probability mass function, distribution function, quantile function and random generation for the Complex Triparametric Pearson (CTP) distribution with parameters a
, b
and \gamma
.
Usage
dctp(x, a, b, gamma)
pctp(q, a, b, gamma, lower.tail = TRUE)
qctp(p, a, b, gamma, lower.tail = TRUE)
rctp(n, a, b, gamma)
Arguments
x |
vector of (non-negative integer) quantiles. |
a |
parameter a (real) |
b |
parameter b (real) |
gamma |
parameter |
q |
vector of quantiles. |
lower.tail |
if TRUE (default), probabilities are |
p |
vector of probabilities. |
n |
number of observations. If |
Details
The CTP distribution with parameters a
, b
and \gamma
has pmf
f(x|a,b,\gamma) = C \Gamma(a+ib+x) \Gamma(a-ib+x) / (\Gamma(\gamma+x) x!), x=0,1,2,...
where i
is the imaginary unit, \Gamma(·)
the gamma function and
C = \Gamma(\gamma-a-ib) \Gamma(\gamma-a+ib) / (\Gamma(\gamma-2a) \Gamma(a+ib) \Gamma(a-ib))
the normalizing constant.
If a=0
the CTP is a Complex Biparametric Pearson (CBP) distribution, so the pmf of the CBP distribution is obtained.
If b=0
the CTP is an Extended Biparametric Waring (EBW) distribution, so the pmf of the EBW distribution is obtained.
The mean and the variance of the CTP distribution are
E(X)=\mu=(a^2+b^2)/(\gamma-2a-1)
and Var(X)=\mu(\mu+\gamma-1)/(\gamma-2a-2)
so \gamma > 2a + 2
.
It is underdispersed if a < - (\mu + 1) / 2
, equidispersed if a = - (\mu + 1) / 2
or overdispersed
if a > - (\mu + 1) / 2
. In particular, if a >= 0
the CTP is always overdispersed.
Value
dctp
gives the pmf, pctp
gives the distribution function, qctp
gives the quantile function and rctp
generates random values.
If a = 0
the probability mass function, distribution function, quantile function and random generation function for the CBP distribution arise.
If b = 0
the probability mass function, distribution function, quantile function and random generation function for the EBW distribution arise.
References
Jose Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ (2003). “A new class of discrete distributions with complex parameters.” Stat. Pap., 44, 67–88. doi:10.1007/s00362-002-0134-7.
Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ, Olmo-Jimenez MJ (2004). “A triparametric discrete distribution with complex parameters.” Stat. Pap., 45, 81-95. doi:10.1007/BF02778271.
Olmo-Jimenez MJ, Rodriguez-Avi J, Cueva-Lopez V (2018). “A review of the CTP distribution: a comparison with other over- and underdispersed count data models.” Journal of Statistical Computation and Simulation, 88(14), 2684-2706. doi:10.1080/00949655.2018.1482897.
Cueva-Lopez V, Olmo-Jimenez MJ, Rodriguez-Avi J (2021). “An Over and Underdispersed Biparametric Extension of the Waring Distribution.” Mathematics, 9(170), 1-15. doi:10.3390/math9020170.
See Also
Functions for maximum-likelihood fitting of the CTP, CBP and EBW distributions: fitctp
, fitcbp
and fitebw
.
Examples
# Examples for the function dctp
dctp(3,1,2,5)
dctp(c(3,4),1,2,5)
# Examples for the function pctp
pctp(3,1,2,3)
pctp(c(3,4),1,2,3)
# Examples for the function qctp
qctp(0.5,1,2,3)
qctp(c(.8,.9),1,2,3)
# Examples for the function rctp
rctp(10,1,1,3)
The Extended Biparametric Waring (EBW) Distribution
Description
Probability mass function, distribution function, quantile function and random generation for the Extended Biparametric Waring (EBW) distribution with parameters \alpha
and \gamma
(or \rho
).
Usage
debw(x, alpha, gamma, rho)
pebw(q, alpha, gamma, rho, lower.tail = TRUE)
qebw(p, alpha, gamma, rho, lower.tail = TRUE)
rebw(n, alpha, gamma, rho, lower.tail = TRUE)
Arguments
x |
vector of (non-negative integer) quantiles. |
alpha |
parameter alpha (real) |
gamma |
parameter |
rho |
parameter rho (positive) |
q |
vector of quantiles. |
lower.tail |
if TRUE (default), probabilities are |
p |
vector of probabilities. |
n |
number of observations. If |
Details
The EBW distribution with parameters \alpha
and \gamma
has pmf
f(x|a,\alpha,\gamma) = C \Gamma(\alpha+x)^2 / (\Gamma(\gamma+x) x!), x=0,1,2,...
where \Gamma(·)
is the gamma function and
C = \Gamma(\gamma-\alpha^2 / (\Gamma(\alpha)^2 \Gamma(\gamma-2a))
the normalizing constant.
There is an alternative parametrization in terms of \alpha
and \rho=\gamma-2\alpha>0
when \alpha>0
. So, introduce only \alpha
and \gamma
or \alpha
and \rho
,
depending on the parametrization you wish to use.
The mean and the variance of the EBW distribution are
E(X)=\mu=\alpha^2/(\gamma-2\alpha-1)
and Var(X)=\mu(\mu+\gamma-1)/(\gamma-2\alpha-2)
so \gamma > 2a + 2
.
It is underdispersed if \alpha < - (\mu + 1) / 2
, equidispersed if \alpha = - (\mu + 1) / 2
or overdispersed
if \alpha > - (\mu + 1) / 2
. In particular, if \alpha >= -0.5
the EBW is overdispersed, whereas if
\alpha < -1
the EBW is underdispersed. In the case -1 < \alpha <= -0.5
, the EBW may be under-, equi- or
overdispersed depending on the value of \gamma
.
Value
debw
gives the pmf, pebw
gives the distribution function, qebw
gives the quantile function and rebw
generates random values.
If \alpha > 0
the probability mass function, distribution function, quantile function and random generation function for the UGW(\alpha,\alpha,\rho)
distribution arise.
If \alpha < 0
the probability mass function, distribution function, quantile function and random generation function for the CTP(\alpha,0,\gamma)
distribution arise.
References
Jose Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ (2003). “A new class of discrete distributions with complex parameters.” Stat. Pap., 44, 67–88. doi:10.1007/s00362-002-0134-7.
Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ, Olmo-Jimenez MJ (2004). “A triparametric discrete distribution with complex parameters.” Stat. Pap., 45, 81-95. doi:10.1007/BF02778271.
Olmo-Jimenez MJ, Rodriguez-Avi J, Cueva-Lopez V (2018). “A review of the CTP distribution: a comparison with other over- and underdispersed count data models.” Journal of Statistical Computation and Simulation, 88(14), 2684-2706. doi:10.1080/00949655.2018.1482897.
See Also
Functions for maximum-likelihood fitting of the CTP and CBP distributions: fitctp
and fitcbp
.
Examples
# Examples for the function dctp
debw(3,1,rho=5)
debw(c(3,4),2,rho=5)
# Examples for the function pebw
pebw(3,2,rho=5)
pebw(c(3,4),2,rho=5)
# Examples for the function qebw
qebw(0.5,-2.1,gamma=0.1)
qebw(c(.8,.9),-2.1,gamma=0.1)
qebw(0.5,2,rho=5)
qebw(c(.8,.9),2,rho=5)
# Examples for the function rebw
rebw(10,2,rho=5)
rebw(10,-2.1,gamma=5)
Maximum-likelihood fitting of the CBP distribution
Description
Maximum-likelihood fitting of the Complex Biparametric Pearson (CBP) distribution with parameters b
and \gamma
. Generic
methods are print
, summary
, coef
, logLik
, AIC
, BIC
and plot
.
Usage
fitcbp(x, bstart = NULL, gammastart = NULL, method = "L-BFGS-B", control = list(), ...)
Arguments
x |
A numeric vector of length at least one containing only finite values. |
bstart |
A starting value for the parameter |
gammastart |
A starting value for the parameter |
method |
The method to be used in fitting the model. See 'Details'. |
control |
A list of parameters for controlling the fitting process. |
... |
Additional parameters. |
Details
If the starting values of the parameters b
and \gamma
are omitted (default option),
they are computing by the method of moments (if possible; otherwise they must be entered).
The default method is "L-BFGS-B"
(see details in optim
function),
but non-linear minimization (nlm
) or those included in the optim
function ("Nelder-Mead"
,
"BFGS"
, "CG"
and "SANN"
) may be used.
Standard error (SE) estimates for b
and \gamma
are provided by the default method;
otherwise, SE for \gamma_0
where \gamma=exp{(\gamma_0})
is computed.
Value
An object of class 'fitCBP'
is a list containing the following components:
-
n
, the number of observations, -
initialValues
, a vector with the starting values used, -
coefficients
, the parameter ML estimates of the CTP distribution, -
se
, a vector of the standard error estimates, -
hessian
, a symmetric matrix giving an estimate of the Hessian at the solution found in the optimization of the log-likelihood function, -
cov
, an estimate of the covariance matrix of the model coefficients, -
corr
, an estimate of the correlation matrix of the model estimates, -
loglik
, the maximized log-likelihood, -
aic
, Akaike Information Criterion, minus twice the maximized log-likelihood plus twice the number of parameters, -
bic
, Bayesian Information Criterion, minus twice the maximized log-likelihood plus twice the number of parameters, -
code
, a code that indicates successful convergence of the fitter function used (see nlm and optim helps), -
converged
, logical value that indicates if the optimization algorithms succesfull, -
method
, the name of the fitter function used.
Generic functions:
-
print
: The print of a'fitCBP'
object shows the ML parameter estimates and their standard errors in parenthesis. -
summary
: The summary provides the ML parameter estimates, their standard errors and the statistic and p-value of the Wald test to check if the parameters are significant. This summary also shows the loglikelihood, AIC and BIC values, as well as the results for the chi-squared goodness-of-fit test and the Kolmogorov-Smirnov test for discrete variables. Finally, the correlation matrix between parameter estimates appears. -
coef
: It extracts the fitted coefficients from a'fitCBP'
object. -
logLik
: It extracts the estimated log-likelihood from a'fitCBP'
object. -
AIC
: It extracts the value of the Akaike Information Criterion from a'fitCBP'
object. -
BIC
: It extracts the value of the Bayesian Information Criterion from a'fitCBP'
object. -
plot
: It shows the plot of a'fitCBP'
object. Observed and theoretical probabilities, empirical and theoretical cumulative distribution functions or empirical cumulative probabilities against theoretical cumulative probabilities are the three plot types.
References
Jose Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ (2003). “A new class of discrete distributions with complex parameters.” Stat. Pap., 44, 67–88. doi:10.1007/s00362-002-0134-7.
See Also
Plot of observed and theoretical frequencies for a CBP fit: plot.fitCBP
Maximum-likelihood fitting for the CTP distribution: fitctp
.
Maximum-likelihood fitting for the EBW distribution: fitebw
.
Examples
set.seed(123)
x <- rcbp(500, 1.75, 3.5)
fitcbp(x)
summary(fitcbp(x, bstart = 1.1, gammastart = 3))
Maximum-likelihood fitting of the CTP distribution
Description
Maximum-likelihood fitting of the Complex Triparametric Pearson (CTP) distribution with parameters a
, b
and \gamma
. Generic
methods are print
, summary
, coef
, logLik
, AIC
, BIC
and plot
.
Usage
fitctp(x, astart = NULL, bstart = NULL, gammastart = NULL,
method = "L-BFGS-B", control = list(), ...)
Arguments
x |
A numeric vector of length at least one containing only finite values. |
astart |
A starting value for the parameter |
bstart |
A starting value for the parameter |
gammastart |
A starting value for the parameter |
method |
The method to be used in fitting the model. See 'Details'. |
control |
A list of parameters for controlling the fitting process. |
... |
Additional parameters. |
Details
If the starting values of the parameters a
, b
and \gamma
are omitted (default option),
they are computing by the method of moments (if possible; otherwise they must be entered).
The default method is "L-BFGS-B"
(see details in optim
function),
but non-linear minimization (nlm
) or those included in the optim
function ("Nelder-Mead"
,
"BFGS"
, "CG"
and "SANN"
) may be used.
Standard error (SE) estimates for a
, b
and \gamma
are provided by the default method; otherwise, SE for \gamma_0
where \gamma=exp(\gamma_0)
is computed.
Value
An object of class 'fitCTP'
is a list containing the following components:
-
n
, the number of observations, -
initialValues
, a vector with the starting values used, -
coefficients
, the parameter ML estimates of the CTP distribution, -
se
, a vector of the standard error estimates, -
hessian
, a symmetric matrix giving an estimate of the Hessian at the solution found in the optimization of the log-likelihood function, -
cov
, an estimate of the covariance matrix of the model coefficients, -
corr
, an estimate of the correlation matrix of the model estimates, -
loglik
, the maximized log-likelihood, -
aic
, Akaike Information Criterion, minus twice the maximized log-likelihood plus twice the number of parameters, -
bic
, Bayesian Information Criterion, minus twice the maximized log-likelihood plus twice the number of parameters, -
code
, a code that indicates successful convergence of the fitter function used (see nlm and optim helps), -
converged
, logical value that indicates if the optimization algorithms succesfull, -
method
, the name of the fitter function used.
Generic functions:
-
print
: The print of a'fitCTP'
object shows the ML parameter estimates and their standard errors in parenthesis. -
summary
: The summary provides the ML parameter estimates, their standard errors and the statistic and p-value of the Wald test to check if the parameters are significant. This summary also shows the loglikelihood, AIC and BIC values, as well as the results for the chi-squared goodness-of-fit test and the Kolmogorov-Smirnov test for discrete variables. Finally, the correlation matrix between parameter estimates appears. -
coef
: It extracts the fitted coefficients from a'fitCTP'
object. -
logLik
: It extracts the estimated log-likelihood from a'fitCTP'
object. -
AIC
: It extracts the value of the Akaike Information Criterion from a'fitCTP'
object. -
BIC
: It extracts the value of the Bayesian Information Criterion from a'fitCTP'
object. -
plot
: It shows the plot of a'fitCTP'
object. Observed and theoretical probabilities, empirical and theoretical cumulative distribution functions or empirical cumulative probabilities against theoretical cumulative probabilities are the three plot types.
References
Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ, Olmo-Jimenez MJ (2004). “A triparametric discrete distribution with complex parameters.” Stat. Pap., 45, 81-95. doi:10.1007/BF02778271.
Olmo-Jimenez MJ, Rodriguez-Avi J, Cueva-Lopez V (2018). “A review of the CTP distribution: a comparison with other over- and underdispersed count data models.” Journal of Statistical Computation and Simulation, 88(14), 2684-2706. doi:10.1080/00949655.2018.1482897.
See Also
Plot of observed and theoretical frequencies for a CTP fit: plot.fitCTP
Maximum-likelihood fitting for the CBP distribution: fitcbp
.
Maximum-likelihood fitting for the EBW distribution: fitebw
.
Examples
set.seed(123)
x <- rctp(500, -0.5, 1, 2)
fitctp(x)
summary(fitctp(x, astart = 1, bstart = 1.1, gammastart = 3))
Maximum-likelihood fitting of the EBW distribution
Description
Maximum-likelihood fitting of the Extended Biparametric Waring (EBW) distribution with parameters \alpha
, \rho
and \gamma
. Generic
methods are print
, summary
, coef
, logLik
, AIC
, BIC
and plot
. The method to be used in fitting the
model is "L-BFGS-B" which allows constraints for each variable (see details in optim
funtion).
Usage
fitebw(x, alphastart = NULL, rhostart = NULL, gammastart = NULL,
method = "L-BFGS-B", control = list(),...)
Arguments
x |
A numeric vector of length at least one containing only finite values. |
alphastart |
A starting value for the parameter |
rhostart |
A starting value for the parameter |
gammastart |
A starting value for the parameter |
method |
The method to be used in fitting the model. The default method is "L-BFGS-B" (optim). |
control |
A list of parameters for controlling the fitting process. |
... |
Additional parameters. |
Details
If the starting value for \alpha
is positive, the parameterization (\alpha,\rho)
is used;
otherwise, the parameterization (\alpha,\gamma)
is used.
If the starting values of the parameters \alpha
, \gamma
or \rho
are omitted (default option),
they are computing by the method of moments (if possible; otherwise they must be entered).
The default method is "L-BFGS-B"
(see details in optim
function),
but non-linear minimization (nlm
) or those included in the optim
function
("Nelder-Mead"
, "BFGS"
, "CG"
and "SANN"
) may be used.
Standard error (SE) estimates for \alpha
, \gamma
or \rho
are provided by the default method;
otherwise, SE for \alpha_0
and \gamma_0
where \alpha=-exp(\alpha_0)
and \gamma=exp(\gamma_0)
(or for \alpha_0
and \rho_0
where \alpha=exp(\alpha_0)
and \rho=exp(\rho_0)
) are computed.
Value
An object of class 'fitEBW'
is a list containing the following components:
-
n
, the number of observations, -
initialValues
, a vector with the starting values used, -
coefficients
, the parameter ML estimates of the CTP distribution, -
se
, a vector of the standard error estimates, -
hessian
, a symmetric matrix giving an estimate of the Hessian at the solution found in the optimization of the log-likelihood function, -
cov
, an estimate of the covariance matrix of the model coefficients, -
corr
, an estimate of the correlation matrix of the model estimates, -
loglik
, the maximized log-likelihood, -
aic
, Akaike Information Criterion, minus twice the maximized log-likelihood plus twice the number of parameters, -
bic
, Bayesian Information Criterion, minus twice the maximized log-likelihood plus twice the number of parameters, -
code
, a code that indicates successful convergence of the fitter function used (see nlm and optim helps), -
converged
, logical value that indicates if the optimization algorithms succesfull. -
method
, the name of the fitter function used.
Generic functions:
-
print
: The print of a'fitEBW'
object shows the ML parameter estimates and their standard errors in parenthesis. -
summary
: The summary provides the ML parameter estimates, their standard errors and the statistic and p-value of the Wald test to check if the parameters are significant. This summary also shows the loglikelihood, AIC and BIC values, as well as the results for the chi-squared goodness-of-fit test and the Kolmogorov-Smirnov test for discrete variables. Finally, the correlation matrix between parameter estimates appears. -
coef
: It extracts the fitted coefficients from a'fitEBW'
object. -
logLik
: It extracts the estimated log-likelihood from a'fitEBW'
object. -
AIC
: It extracts the value of the Akaike Information Criterion from a'fitEBW'
object. -
BIC
: It extracts the value of the Bayesian Information Criterion from a'fitEBW'
object. -
plot
: It shows the plot of a'fitEBW'
object. Observed and theoretical probabilities, empirical and theoretical cumulative distribution functions or empirical cumulative probabilities against theoretical cumulative probabilities are the three plot types.
References
Cueva-Lopez V, Olmo-Jimenez MJ, Rodriguez-Avi J (2021). “An Over and Underdispersed Biparametric Extension of the Waring Distribution.” Mathematics, 9(170), 1-15. doi:10.3390/math9020170.
See Also
Plot of observed and theoretical frequencies for a EBW fit: plot.fitEBW
Maximum-likelihood fitting for the CTP distribution: fitctp
.
Maximum-likelihood fitting for the CBP distribution: fitcbp
.
Examples
set.seed(123)
x <- rebw(500, 2, rho = 5)
fitebw(x)
summary(fitebw(x, alphastart = 1, rhostart = 5))
Plot of observed and theoretical frequencies for a CBP fit
Description
Plot of observed and theoretical frequencies for a CBP fit
Usage
## S3 method for class 'fitCBP'
plot(x, plty = "FREQ", maxValue = NULL, ...)
Arguments
x |
An object of class |
plty |
Plot type to be shown. Default is |
maxValue |
maxValue you want to appear in the plot |
... |
Additional parameters. |
Examples
set.seed(123)
x <- rcbp(500, 1.75, 3.5)
fit <- fitcbp(x)
plot(fit)
plot(fit, plty = "CDF")
plot(fit, plty = "PP")
Plot of observed and theoretical frequencies for a CTP fit
Description
Plot of observed and theoretical frequencies for a CTP fit
Usage
## S3 method for class 'fitCTP'
plot(x, plty = "FREQ", maxValue = NULL, ...)
Arguments
x |
An object of class |
plty |
Plot type to be shown. Default is |
maxValue |
maxValue you want to appear in the plot |
... |
Additional parameters. |
Examples
set.seed(123)
x <- rctp(500, -0.5, 1, 2)
fit <- fitctp(x)
plot(fit)
plot(fit, plty = "CDF")
plot(fit, plty = "PP")
Plot of observed and theoretical frequencies for a EBW fit
Description
Plot of observed and theoretical frequencies for a EBW fit
Usage
## S3 method for class 'fitEBW'
plot(x, plty = "FREQ", maxValue = NULL, ...)
Arguments
x |
An object of class |
plty |
Plot type to be shown. Default is |
maxValue |
maxValue you want to appear in the plot |
... |
Additional parameters. |
Examples
set.seed(123)
x <- rebw(500, -0.25, 1)
fit <- fitebw(x)
plot(fit)
plot(fit, plty = "CDF")
plot(fit, plty = "PP")
Variance decomposition for a EBW fit
Description
One of the main drawbacks of the Univariate Generalized Waring (UGW) distribution with parameters a
,
k
and \rho
is that the first two parameters are interchangeable, so it is not possible to distinguish
the variance components 'liability' and 'proneness' without additional information. To solve this problem,
an EBW distribution (where these components are uniquely identifiable) can be used since,
given a UGW distribution, there always exists an EBW close to it.
Usage
varcomp(object, ...)
Arguments
object |
An object of class |
... |
Additional parameters. |
Value
A data frame with the variance components (randomness, liability and proneness) in absolute and relative terms.
Examples
set.seed(123)
x <- rebw(500, 2, rho = 5)
fit <- fitebw(x, alphastart = 1, rhostart = 5)
varcomp(fit)