R/gini.1997.R

Defines functions gini.1997

Documented in gini.1997

# x: population of each region
# y: resource of each region
gini.1997=function(x,y){
  index=order(y/x)
  x=x[index]
  y=y[index]
  X=cumsum(x)/sum(x)
  Y=cumsum(y)/sum(y)
  G=sum(X[1:(length(X)-1)]*Y[2:length(Y)]-X[2:length(X)]*Y[1:(length(Y)-1)])
  return(G)
}

Try the Gini package in your browser

Any scripts or data that you put into this service are public.

Gini documentation built on Sept. 13, 2021, 5:06 p.m.