> surved.households <- c(39, 179, 107, 56, 32, 22, 11, 15, 38) > percentage.household<-surved.households*100/sum(surved.households) > income <- c(56126.36, 290124.32, 281048.35, 225586.54, 162442.64, 115243.11, 64389.11, 136743.99, 784834.07) > average.per.capita.income<-income/surved.households > n<-length(average.per.capita.income) > x <- average.per.capita.income > i <- x[sort.list(-x)] > gini <- ( 1 + (1/n) - (2 * (sum(i * 1:n)) / (n * sum(i))) ) Note: These commands of R Console was documented in 9:53 AM 12/13/2003 by Mohammad Ehsanul Karim, Institute of Statistical Research and Training, Dhaka - 1000, Bangladesh.