MLfullGB2 {GB2}R Documentation

Maximum Likelihood Estimation of the GB2 Based on the Full Log-likelihood

Description

Performs maximum pseudo-likelihood estimation through the general-purpose optimisation function optim from package stats. Two methods of optimization are considered: BFGS and L-BFGS-B (see optim documentation for more details). Initial values of the parameters to be optimized over (a, b, p and q) are given from the Fisk distribution and p=q=1. The function to be maximized by optim is the negative of the full log-likelihood and the gradient is equal to the negative of the scores, respectively for the case of a sample of persons and a sample of households.

Usage

ml.gb2(z, w=rep(1, length(z)), method=1, hess=FALSE) 
mlh.gb2(z, w=rep(1, length(z)), hs=rep(1, length(z)), method=1, hess = FALSE)

Arguments

z

numeric; vector of data values.

w

numeric; vector of weights. Must have the same length as z. By default w is a vector of 1.

hs

numeric; vector of household sizes. Must have the same length as z. By default hs is a vector of 1.

method

numeric; the method to be used by optim. By default, codemethod = 1 and the used method is BFGS. If method = 2, method L-BFGS-B is used.

hess

logical; By default, hess = FALSE, the hessian matrix is not calculated.

Details

Function ml.gb2 performs maximum likelihood estimation through the general-purpose optimization function optim from package stats, based on the full log-likelihood calculated in a sample of persons. Function mlh.gb2 performs maximum likelihood estimation through the general-purpose optimization function optim from package stats, based on the full log-likelihood calculated in a sample of households.

Value

ml.gb2 and mlh.gb2 return a list with 1 argument: opt1 for the output of the BFGS fit or opt2 for the output of the L-BFGS fit. Further values are given by the values of optim.

Author(s)

Monique Graf

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.

See Also

optim for the general-purpose optimization and fisk for the Fisk distribution.

Examples

## Not run: 
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 full log-likelihood
fitf <- ml.gb2(inc, w)

# Fitted GB2 parameters
af <- fitf$par[1]
bf <- fitf$par[2]
pf <- fitf$par[3]
qf <- fitf$par[4]

# Likelihood
flik <- fitf$value

# If we want to compare the indicators

# GB2 indicators
indicf <- round(main.gb2(0.6,af,bf,pf,qf), digits=3)
# Empirical indicators
indice <- round(main.emp(inc,w), digits=3)

# Plots
plotsML.gb2(inc,af,bf,pf,qf,w)

## End(Not run)

[Package GB2 version 2.1.1 Index]