Compound {GB2} | R Documentation |
Compound Distribution based on the Generalized Beta Distribution of the Second Kind
Description
Mixture distribution based on the compounding property of the GB2, in short "compound GB2". Decomposition of the GB2 distribution with respect to the left and right tail of the distribution. Calculation of the component densities and cumulative distribution functions. Calculation of the compound density function and the compound cumulative distribution function.
Usage
fg.cgb2(x, shape1, scale, shape2, shape3, pl0, decomp="r")
dl.cgb2(x, shape1, scale, shape2, shape3, pl0, decomp="r")
pl.cgb2(y, shape1, scale, shape2, shape3, pl0, decomp="r", tol=1e-05)
dcgb2(x, shape1, scale, shape2, shape3, pl0, pl, decomp="r")
pcgb2(y, shape1, scale, shape2, shape3, pl0, pl, decomp="r")
prcgb2(y1, y2, shape1, scale, shape2, shape3, pl0, pl, decomp="r", tol=1e-08,
debug=FALSE)
Arguments
x |
numeric; can be a vector. The value(s) at which the compound density and the component densities are calculated, |
y |
numeric; can be a vector. The value(s) at which the compound distribution function and the component distribution functions are calculated. |
y1 , y2 |
numeric values. |
shape1 , scale , shape2 , shape3 |
numeric; positive parameters of the GB2 distribution. |
pl0 |
numeric; a vector of initial proportions defining the number of components and the weight of each component density in the decomposition. Sums to one. |
pl |
numeric; a vector of fitted proportions. Sums to one. If |
decomp |
string; specifying if the decomposition of the GB2 is done with respect to the right tail ("r") or the left tail ("l") of the distribution.
By default, |
debug |
logical; By default, |
tol |
numeric; tolerance with default 0, meaning to iterate until additional terms do not change the partial sum. |
Details
The number of components L
is given by the length of the vector pl0
. In our examples L=3
. Let N
denote the length of the vector x
. Function fg.cgb2
calculates the L
gamma factors which multiply the GB2 density in order to obtain the component density f_\ell
. These component densities are calculated using the function dl.cgb2
. Function pl.cgb2
calculates the corresponding L
cumulative component distribution functions. Function dcgb2
calculates the resulting compound density function. Function pcgb2
calculates the compound cumulative distribution function for a vector of values y
and function prcgb2
, given 2 arguments y1
and y2
, calculates the probability P(min(y1,y2) < Y < max(y1,y2))
, where the random variable Y
follows a compound GB2 distribution.
Value
fg.cgb2
returns a matrix of size N \times L
of the Gamma factors, dl.cgb2
returns a matrix of size N \times L
of component densities, pl.cgb2
returns a matrix containing the L
component cdfs, dcgb2
returns a matrix of size N \times 1
of the GB2 compound density function, pcgb2
returns a matrix of size N \times 1
of the GB2 compound distribution function and prcgb2
returns a probability between 0 and 1.
Author(s)
Monique Graf and Desislava Nedyalkova
References
Graf, M., Nedyalkova, D., Muennich, R., Seger, J. and Zins, S. (2011) AMELI Deliverable 2.1: Parametric Estimation of Income Distributions and Indicators of Poverty and Social Exclusion. Technical report, AMELI-Project.
Examples
#\dontrun{
#\library{cubature}
# GB2 parameters
af <- 5
bf <- 20000
pf <- 0.45
qf <- 0.75
p0 <- rep(1/3,3)
p1 <- c(0.37,0.43,0.2)
# a vector of values
x <- rep(20000*seq(1,2,length.out=9))
#Gamma components
fg.cgb2(20000,af,bf,pf,qf,p0)
fg.cgb2(Inf,af,bf,pf,qf,p0,"l")
#Component densities
dl.cgb2(x,af,bf,pf,qf,p0)
dl.cgb2(20000,af,bf,pf,qf,p0,"l")
#Component cdf
pl.cgb2(25000,af,bf,pf,qf,p0)
#Compound cdf
pcgb2(x,af,bf,pf,qf,p0,p1)
prcgb2(37000,38000,af,bf,pf,qf,p0,p1,"l")
#}