% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/inequalityMeasure.R
\name{Gini}
\alias{Gini}
\title{Gini coefficient}
\usage{
Gini(X, W = rep(1, length(X)), fast = TRUE, rounded.weights = FALSE)
}
\arguments{
\item{X}{is a data vector}

\item{W}{is a vector of weights}

\item{fast}{logical, if TRUE (default), Gini is calculated via matrix operations - fast but may cause memory allocation problems. If FALSE, Gini is calculated via vector operations - slower but with better memory allocation}

\item{rounded.weights}{logical, may be run when fast=FALSE. If TRUE (default), Gini is calculated through alternative formula based on ordered X and integer weights. Choose it when dealing with memory allocation problems.}
}
\value{
The value of Gini coefficient.
}
\description{
Computes Gini coefficient of a given variable taking into account weights.
}
\details{
Gini coefficient is given by:
\deqn{G = \frac{ \sum_{i=1}^n \sum_{j=1}^n \mid x_{i} - x_{j} \mid}{2n^{2} \overline{x}}}
}
\examples{
# Compare weighted and unweighted result
X=1:10
W=1:10
Gini(X)
Gini(X,W)

data(Tourism)
#Gini coefficient for Total expenditure with sample weights
X=Tourism$Total_expenditure
W=Tourism$Sample_weight
Gini(X,W)


}
\references{
Dixon P. M., Weiner, J., Mitchell-Olds, T., and Woodley, R.: (1987) Bootstrapping the Gini Coefficient of Inequality. Ecology , Volume 68 (5)

Firebaugh G.: (1999) Empirics of World Income Inequality, American Journal of Sociology

Deininger K.; Squire L.: (1996) A New Data Set Measuring Income Inequality, The World Bank Economic Review, Vol. 10, No. 3
}
