Displaying 2 results from an estimated 2 matches for "num_parasit".
Did you mean:
num_parasites
2016 Mar 30
2
Compute the Gini coefficient
Hello,
I would like to build a Lorenz curve and calculate a Gini coefficient in order to find how much parasites does the top 20% most infected hosts support.
Here is my data set:
Number of parasites per host:
parasites = c(0,1,2,3,4,5,6,7,8,9,10)
Number of hosts associated with each number of parasites given above:
hosts = c(18,20,28,19,16,10,3,1,0,0,0)
To represent the Lorenz curve:
I
2016 Apr 01
0
Compute the Gini coefficient
...umul_parasites)
>
> plot(cumul_hosts,cum9l_parasites,type=?l?)
>
>
> The Gini coefficient can be calculated as
> library(reldist)
> gini(parasites,hosts)
>
>
> If you want to check, you can ?recreate? the original data (number of parasited for each host) with
>
> num_parasites = rep(parasites,hosts)
>
> and
> gini(num_parasites)
>
> will also give you the Gini coefficient you want.
>
>
>
>>
>
>>> From this Lorenz curve, how can I calculate the Gini coefficient with the function "gini" in R (package reldist) given that...