# [R-sig-Geo] how to calculate centroid (or centre of gravity) of a population (count data)

Diego Pavon diego.pavonjordan at gmail.com
Wed Apr 20 13:08:58 CEST 2016

```Thanks Marcelino, Rolf and Tiago for your quick responses.

I think that the suggested method by Rolf and Tiago, which is also found in
the link provided by Marcelino works fine with my data. Yes, Rolf, it was
as simple as that :)

So,  I multiplied the X_i and Y_i coordinates of each of the 2000 sites by
the count in each site (C_i) and then divided by the total number of counts
(sum of all counts across all sites).
Tiago had, however, interesting points that I will need to address as well.

Thank you very much for your help.

Best

Diego

2016-04-20 13:19 GMT+03:00 Tiago Marques <tiagoandremarques at gmail.com>:

> Hi Diego,
>
> A perhaps dumb yet straightforward way of doing it is to replicate each
> point the number of times of its corresponding count, this will get you the
> right unbiased centroid, essentially  a weighted average as Marcelino
> suggests, assuming that the weight you use is proportional to the count.
> It's like saying that each bird contributes once to the centroid location,
> instead of each point contributing once.
>
> Note that just by using your suggested kernelUD you don't really get the
> centroid of the points (I think, never used it myself actually), I suspect
> you simply get a kernel estimate of the bivariate distribution of the
> points in space. Going from that to an actual centroid is possible but non
> necessarily straightforward.
>
> The answer to your specific question is much simpler than that: in 2D,
> simple calculate the means of the X and Y coordinates, multiply each
> coordinate by a weight, the count - that would be an alternative to what I
> suggested above - and there is your centroid.
>
> Note that this gets you the right mean centroid, but not necessarily the
> right variance for that centroid estimate. Also, you might want to think
> about if that is the right weight. But those are all questions beyond your
> original question ;)
>
> cheers
>
> Tiago
>
>
> Às 09:36 de 20/04/2016, Marcelino de la Cruz escreveu:
>
>> Hi Diego,
>>
>> it seems to me that what you want to compute are weighted centroids.
>>
>> Here some advice is given (it is for polygons but you can get the idea):
>>
>> https://stat.ethz.ch/pipermail/r-sig-geo/2016-February/024107.html
>>
>> Cheers,
>>
>> Marcelino
>>
>>
>>
>> El 20/04/2016 a las 8:45, Diego Pavon escribió:
>>
>>> Dear all
>>>
>>> I am working with count data and I want to assess whether the centre of
>>> gravity of the population (centroid or mean latitude?) has change over
>>> time, indicating some redistribution or shift ongoing. To simplify, let's
>>> say that I have ca. 2000 sites censused in two consecutive years (same
>>> sites censused both years - all sites) and the abundance (count) of the
>>> species registered.
>>>
>>> apparently this only takes into account the location of the sites to
>>> calculate the kernel and then the centroids. Thus, since I have the exact
>>> same sites in both years, the centroids for year 1 and year 2 are the
>>> same.
>>> In my case, what I would like to do is to calculate that centroid but
>>> taking into account the counts, because a site that had 3 individuals in
>>> both years can't have the same weight than a site that hosted 3000
>>> individuals when calculating the centroids.
>>>
>>> So, what I would like to have is the centroid (or centre of gravity) of
>>> the
>>> counts not of the sites surveyed (which is what adehabitatHR does,a s far
>>> as I understood).
>>>
>>> Do you have any suggestions which package other than adehabitatXX to use
>>> for this purpose? Or if this can be done with adehabitat?
>>>
>>> Thank you very much for your help.
>>>
>>> Diego
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>
> ---
> Este e-mail foi verificado em termos de vírus pelo software antivírus
> Avast.
> https://www.avast.com/antivirus
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

--
*Diego Pavón Jordán*

*Finnish Museum of Natural History*
*PO BOX 17 *

*Helsinki. Finland*

*0445061210https://tuhat.halvi.helsinki.fi/portal/en/persons/diego-pavon-jordan%288d5db37c-eddd-4fca-92cd-9c9956a42b4a%29.html