# NOT RUN {
# GB2 parameters:
a <- 4
b <- 1950
p <- 0.8
q <- 0.6
# Proportions defining the component densities:
pl0 <- rep(1/3,3)
# Mixture probabilities
pl <- c(0.1,0.8,0.1)
# Random generation:
n <- 10000
set.seed(12345)
x <- rcgb2(n,a,b,p,q,pl0,pl,decomp="l")
# Factors in component densities
fac <- fg.cgb2(x,a,b,p,q, pl0,decomp="l")
# Estimate the mixture probabilities:
estim <- ml.cgb2(fac,pl0)
# estimated mixture probabilities:
estim[[1]]
#[1] 0.09724319 0.78415797 0.11859883
# }
Run the code above in your browser using DataLab