Displaying 2 results from an estimated 2 matches for "cumul_hosts".
2016 Mar 30
2
Compute the Gini coefficient
...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 manually calculated the cumulative percentage of parasites and hosts:
cumul_parasites <- cumsum(parasites)/max(cumsum(parasites))
cumul_hosts <- cumsum(hosts)/max(cumsum(hosts))
plot(cumul_hosts, cumul_parasites, type= "l")
>From this Lorenz curve, how can I calculate the Gini coefficient with the function "gini" in R (package reldist) given that the vector "hosts" is not a vector of weights ?
Thank...
2016 Apr 01
0
Compute the Gini coefficient
...umber of parasites given above:
>> hosts = c(18,20,28,19,16,10,3,1,0,0,0)
>>
>> To represent the Lorenz curve:
>> I manually calculated the cumulative percentage of parasites and hosts:
>>
>> cumul_parasites <- cumsum(parasites)/max(cumsum(parasites))
>> cumul_hosts <- cumsum(hosts)/max(cumsum(hosts))
>> plot(cumul_hosts, cumul_parasites, type= "l?)
>
>
> Your values in hosts are frequencies. So you need to calculate
>
> cumul_hosts = cumsum(hosts)/sum(hosts)
> cumul_parasites = cumsum(hosts*parasites)/sum(parasites)
That's...