library(tidyverse)
library(rnaturalearth)
library(spdep)
# get data from Natural Earth
countries <- ne_countries(scale = 10, returnclass = "sf") |>
st_make_valid() |>
group_by(sov_a3, sovereignt) |>
summarise(.groups = "drop")
# for joining codes and names later
lookup <- countries |>
st_drop_geometry()
# get neighbours with {spdep}
neighbours <- countries |>
poly2nb()
# we only keep countries with 1 neighbour
# and add names
neighbours |>
set_names(countries$sov_a3) |>
keep(\(x) length(x) == 1) |>
enframe("sov_a3", "nb") |>
unnest(nb) |>
filter(nb != 0) |>
mutate(nb = countries$sov_a3[nb]) |>
left_join(lookup, by = "sov_a3") |>
left_join(lookup, by = c("nb" = "sov_a3"), suffix = c("", "_nb")) |>
relocate(sovereignt, .after = 1)
# A tibble: 16 × 4
sov_a3 sovereignt nb sovereignt_nb
<chr> <chr> <chr> <chr>
1 BRN Brunei MYS Malaysia
2 CAN Canada US1 United States of America
3 DN1 Denmark DEU Germany
4 DOM Dominican Republic HTI Haiti
5 GMB Gambia SEN Senegal
6 HTI Haiti DOM Dominican Republic
7 IRL Ireland GB1 United Kingdom
8 KOR South Korea PRK North Korea
9 LSO Lesotho ZAF South Africa
10 MCO Monaco FR1 France
11 PNG Papua New Guinea IDN Indonesia
12 PRT Portugal ESP Spain
13 QAT Qatar SAU Saudi Arabia
14 SMR San Marino ITA Italy
15 TLS East Timor IDN Indonesia
16 VAT Vatican ITA Italy
I miss Bahrain / Saudi Arabia because the Natural Earth dataset is not detailed enough…
# A tibble: 209 × 3
sov_a3 n sovereignt
<chr> <int> <chr>
1 CH1 15 China
2 RUS 14 Russia
3 BRA 11 Brazil
4 FR1 11 France
5 COD 9 Democratic Republic of the Congo
6 DEU 9 Germany
7 AUT 8 Austria
8 SDN 8 Sudan
9 SRB 8 Republic of Serbia
10 TUR 8 Turkey
# … with 199 more rows
« a pair of cats can produce 20,000 individuals in just four years ».
(translation)
That seems quite high… Let’s check!
(additionally, the article is about feral cats preying on wildlife but we are shown a wild cat capturing a laboratory mouse!)
This figure could come from a back-of-the-envelope calculation, such as litters of 3.5 kitten twice a year for 4 years producing 3.58 ≈ 22,519 kitten. But that’s a very rough and false estimate : at this rate there will be 76 billions cats in Lyon in 10 years! Moreover we ignore the fact that the first generations can still have litters, the less than perfect survival of feral cats, the delay before the first pregnancy, etc.
We can use Leslie matrix to model the destiny of our founding pair. Leslie matrices are used in population ecology to project a structured (by age) population based on transitions between age classes and fertility.
Cat females reach sexual maturity at 6–8 months (Kaeuffer et al. 2004), can have 2.1 litters each year (Robinson & Cox, 1970) and have a mean of around 4 kitten by litter (Hall & Pierce, 1934 ; Deag et al., 1987) or 9.1 kitten by year (Robinson & Cox, 1970). So we will use quarters as ages classes. We first use an unrealistic 100 % survival and 100 % fecundity.
R base version
The first line of the matrix reads 0 kitten produced between 0-3 months, 0 kitten between 3-6 months, and 9.1 / 2 / 4 = 1.4 kitten by capita by quarter for the 6-9 months class and the adults. The 1s on the diagonal are the survivals between age classes and the lower-right 1 the adult survival.
l <- matrix(c(0, 0, 1.4, 1.4,
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 1),
nrow = 4,
byrow = TRUE)
quarters <- 16
n0 <- matrix(c(0, 0, 0, 2),
ncol = 1)
simul <- function(q) {
n_proj <- matrix(0,
nrow = nrow(l),
ncol = q)
n_proj[, 1] <- n0
for (i in 1:(q - 1)) {
n_proj[, i + 1] <- l %*% n_proj[, i]
}
return(n_proj)
}
res <- simul(quarters)
round(sum(res[, ncol(res)]))
# 2450
With our optimistic parameters, we get a population of 2,450 cats after 16 quarters (4 years). An order of magnitude less than in the article…
With a more realistic matrix, especially for feral cats, with less fertility for the first pregnancy and survival rates totally made-up but not 100 %, we can get quite a more manageable population size :
Renaud Kaeuffer, Dominique Pontier, Sébastien Devillard, Nicolas Perrin. Effective size of two feral domestic cat populations (Felis catus L.): effect of the mating system. Molecular Ecology, 2004, 13(2), pp. 483-490. https://doi.org/10.1046/j.1365-294x.2003.02046.x.hal-00427607
Hall, V.E. and Pierce, G.N., Jr. Litter size, birth weight and growth to weaning in the cat. Anat. Rec., 1934, 60: 111-124. https://doi.org/10.1002/ar.1090600113
Deag, J.M., Lawrence, C.E. and Manning, A. The consequences of differences in litter size for the nursing cat and her kittens. Journal of Zoology, 1987, 213: 153-179. https://doi.org/10.1111/j.1469-7998.1987.tb03687.x
Today no cartography in R but in QGIS. However the satellite image processing has been made with the {sen2R} package.
We emulate infrared photography with a combination of the 8, 4 and 3 bands from the Sentinel-2 satellites, aimed at Termignon in the Vanoise National Park.
Glaciers (and clouds) in white, grasslands in light red, forest in dark red, sparsely vegetated areas in brown reds and rocks in grey.