Learn R Programming

GB2 (version 2.1.2)

CompoundQuantiles: Quantiles and random generation of the Compound Distribution based on the GB2

Description

Calculation of the quantiles of a compound GB2 random variable. Random generation of compound GB2 variables.

Usage

qcgb2(prob, shape1, scale, shape2, shape3, pl0, pl, decomp="r", tol=1e-08, ff=1.5, 
debug=FALSE, maxiter=50)
rcgb2(n, shape1, scale, shape2, shape3, pl0, pl, decomp="r", tol=1e-02, maxiter=100,
debug = FALSE)

Value

qcgb2 returns a vector of quantiles and rcgb2 return a vector of size n of GB2 compound random deviates.

Arguments

prob

numeric; vector of probabilities between 0 and 1.

shape1,scale,shape2,shape3

numeric; positive parameters of the GB2 distribution.

n

numeric; number of observations. If length(n) > 1, the length is taken to be the number required.

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 mixture probabilities. Sums to one. If \(pl=pl0\) we obtain the GB2 distribution.

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, decomp = "r" - right tail decomposition.

ff

numeric; a tuning parameter.

debug

logical; By default, debug = FALSE.

maxiter

numeric; maximum number of iterations to perform.

tol

numeric; tolerance with default 0, meaning to iterate until additional terms do not change the partial sum.

Author

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

Run this code
#\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)

#Quantiles

qcgb2(0.5,af,bf,pf,qf,p0,p1)
qcgb2(1,af,bf,pf,qf,p0,p1)
qcgb2(c(0.5,0.8),af,bf,pf,qf,p0,p1)

#Random generation
rcgb2(10,af,bf,pf,qf,p0,p1)

#}

Run the code above in your browser using DataLab