Learn R Programming

GB2 (version 1.0)

MLprofGB2: Maximum Likelihood Estimation of the GB2 Based on the Profile Log-likelihood

Description

profml.gb2 performs maximum likelihood estimation based on the profile log-likelihood through the general-purpose optimization function optim from package stats.

Usage

profml.gb2(z, w=1, method=1)

Arguments

z
vector of data values.
w
corresponding weights.
method
the method to be used for optim. By default, the used method is BFGS. If method =2, methods BFGS and L-BFGS-B are used.

Value

  • A list with 1 or 2 arguments: opt1 output of BFGS fit and opt2 output of L-BFGS fit. Further values are given by the values of optim.

Details

Two methods are considered: BFGS and L-BFGS-B (see optim documentation for more details). Initial values of the parameters to be optimized over ($a$ and $b$) are given from the Fisk distribution. The function to be maximized by optim is the negative of the profile log-likelihood (proflogl.gb2) and the gradient is equal to the negative of the scores (profscores.gb2).

References

Graf, M. and Nedyalkova, D. (2010) The Generalized Beta Distribution of the Second Kind as an Income Distribution: Properties, Likelihood and Estimation. working paper, SFSO.

See Also

optim for the general-purpose optimization and link{ml.gb2} for the full log-likelihood.

Examples

Run this code
library(laeken)
data(eusilc)

# Income
inc <- as.vector(eusilc$eqIncome)

# Weights
w <- eusilc$rb050

# Data set
d <- data.frame(inc,w)
d <- d[!is.na(d$inc),]
   
# Truncate at 0
inc <- d$inc[d$inc > 0]
w   <- d$w[d$inc > 0]

# Fit using the profile log-likelihood
fitp <- profml.gb2(inc, w)$opt1

# Fitted GB2 parameters
ap <- fitp$par[1]
bp <- fitp$par[2]
pp <- prof.gb2(inc, ap, bp, w)[3]
qp <- prof.gb2(inc, ap, bp, w)[4]

# Profile log-likelihood
proflik <- fitp$value

# If we want to compare the indicators
# GB2 indicators
indicp <- round(main.gb2(0.6,ap,bp,pp,qp), digits=3)
# Empirical indicators
indice <- round(main.emp(inc,w), digits=3)

# Plots
plotsML.gb2(inc,ap,bp,pp,qp,w)

Run the code above in your browser using DataLab