Learn R Programming

GB2 (version 2.1.2)

MLfitGB2: Fitting the GB2 by the Method of Maximum Likelihood Estimation and Comparison of the Fitted Indicators with the Empirical Indicators

Description

The function mlfit.gb2 makes a call to ml.gb2 and profml.gb2. Estimates of the GB2 parameters are calculated using maximum likelihood estimation based on the full and profile log-likelihoods. Empirical estimates of the set of primary indicators of poverty and social inclusion are calculated using the function main.emp (see package laeken) and these estimates are compared with the indicators calculated with the GB2 fitted parameters using the function main.gb2.

Usage

main.emp(z, w=rep(1, length(z)))
mlfit.gb2(z, w=rep(1, length(z)))

Value

A list containing three different objects. The first is a data frame with the values of the fitted parameters for the full log-likelihood and the profile log-likelihood, the values of the two likelihoods, the values of the GB2 estimates of the indicators and the values of the empirical estimates of the indicators. The second and third objects are, respectively, the fit using the full log-likelihood and the fit using the profile log-likelihood.

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.

Author

Monique Graf and Desislava Nedyalkova

See Also

optim , ml.gb2, profml.gb2

Examples

Run this code
# An example of using the function mlfit.gb2
# See also the examples of ml.gb2 and mlprof.gb2

if (FALSE) {
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]

# ML fit
m1 <- mlfit.gb2(inc,w)

# GB2 fitted parameters and indicators through maximum likelihood estimation
m1[[1]]
# The fit using the full log-likelihood
m1[[2]]
# The fit using the profile log-likelihood
m1[[3]]

# ML fit, when no weights are avalable 
m2 <- mlfit.gb2(inc)
# Results
m2[[1]]
}

Run the code above in your browser using DataLab