MLfullGB2 | R Documentation |
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.
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)
z |
numeric; vector of data values. |
w |
numeric; vector of weights. Must have the same length as |
hs |
numeric; vector of household sizes. Must have the same length as |
method |
numeric; the method to be used by |
hess |
logical; By default, |
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.
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
.
Monique Graf
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.
optim
for the general-purpose optimization and fisk
for the Fisk distribution.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.