# Set up code chunk options
knitr::opts_chunk$set(echo = TRUE,
                      message = FALSE, 
                      warning = FALSE, 
                      fig.align = 'center',
                      fig.width = 8,
                      fig.height = 6,
                      dpi = 300)
# Prevent scientific notation (useful for the rate calculation)
options(scipen = 999999)
pkgload::load_all()
Learning Objectives: In this vignette, you will learn how to extend the one-sex kinship model to incorporate both male and female demographic rates. You will understand the implementation of two-sex matrix models, explore how sex-specific mortality and fertility patterns affect kinship structures, and analyze differences in kin availability by sex.

Introduction {#introduction}

Demographic processes fundamental to kinship formation vary significantly between males and females. While one-sex models offer valuable insights into family structures, they overlook these sex differences, which can lead to incomplete understanding of kinship dynamics. Two-sex kinship models address this limitation by incorporating sex-specific demographic rates and tracing both male and female lineages.

Key advantages of two-sex models include:

In this vignette, we will implement a two-sex time-invariant kinship model, outlined in Caswell [-@caswell_formal_2022], using the DemoKin package to understand how sex-specific demographic patterns shape family structures.

Package Installation {#preparation}

If you haven't already installed the required packages from the previous vignettes, here's what you'll need:

# Install basic data analysis packages
install.packages("dplyr")     # Data manipulation
install.packages("tidyr")     # Data tidying
install.packages("ggplot2")   # Data visualization
install.packages("knitr")     # Document generation

# Install DemoKin
# DemoKin is available on CRAN (https://cran.r-project.org/web/packages/DemoKin/index.html), 
# but we'll use the development version on GitHub (https://github.com/IvanWilli/DemoKin):
install.packages("remotes")
remotes::install_github("IvanWilli/DemoKin")
library(DemoKin)  # For kinship analysis

Setting Up the Analysis Environment {#load-packages}

Let's load the necessary packages for our analysis:

rm(list = ls())
library(dplyr)    # For data manipulation
library(tidyr)    # For restructuring data
library(ggplot2)  # For visualization
library(knitr)    # For document generation

Two-Sex Kinship Modeling {#two-sex-model}

Understanding Sex Differences in Demographic Rates {#model-input-2sex}

The first step in implementing a two-sex kinship model is to understand the sex differences in demographic rates. Human males and females exhibit distinct mortality and fertility patterns:

  1. Mortality differences: Males generally experience higher mortality rates at all ages, resulting in shorter life expectancy
  2. Fertility differences: Males often begin reproduction later and can continue reproducing at older ages

These differences affect kinship structures in several important ways:

For our example, we'll use data from France (2012), which is included in the DemoKin package. Let's examine the sex-specific mortality and fertility rates:

# Extract sex-specific rates
fra_fert_f <- fra_asfr_sex[,"ff"]    # Female fertility rates
fra_fert_m <- fra_asfr_sex[,"fm"]    # Male fertility rates
fra_surv_f <- fra_surv_sex[,"pf"]    # Female survival probabilities
fra_surv_m <- fra_surv_sex[,"pm"]    # Male survival probabilities

# Compare total fertility rates by sex
cat("Difference in TFR (male - female):", sum(fra_fert_m) - sum(fra_fert_f))

# Visualize sex differences in demographic rates
data.frame(value = c(fra_fert_f, fra_fert_m, fra_surv_f, fra_surv_m),
           age = rep(0:100, 4),
           sex = rep(c(rep("f", 101), rep("m", 101)), 2),
           risk = c(rep("fertility rate", 101 * 2), rep("survival probability", 101 * 2))) %>%
  ggplot(aes(age, value, col=sex)) + 
  geom_line(linewidth = 1) + 
  labs(
    title = "Sex-specific demographic rates in France (2012)",
    x = "Age",
    y = "Rate",
    color = "Sex"
  ) +
  facet_wrap(~ risk, scales = "free_y") + 
  theme_bw()

Interpretation: The graphs reveal important sex differences in demographic rates:

These sex differences in demographic rates will shape kinship networks in ways that one-sex models cannot capture.

Implementing the Two-Sex Model {#run-model-2sex}

We now introduce the function kin2sex, which extends the one-sex function kin to incorporate sex-specific rates. The key differences are:

  1. We need to provide both female and male demographic rates
  2. We must specify the sex of the focal individual
  3. We need to indicate the sex ratio at birth (proportion of births that are female)

Let's implement a two-sex time-varying model for France:

kin_result <- kin2sex(
  pf = fra_surv_f,        # Female survival probabilities
  pm = fra_surv_m,        # Male survival probabilities
  ff = fra_fert_f,        # Female fertility rates
  fm = fra_fert_m,        # Male fertility rates
  time_invariant = TRUE,  # Use time-invariant model
  sex_focal = "f",        # Focus on female focal individuals
  birth_female = .5       # Proportion of births that are female
)

The output of kin2sex is similar to that of kin, with an additional column sex_kin that specifies the sex of each relative.

Living Relatives by Sex {#living-relatives-by-sex}

Let's examine how the number of living relatives differs by sex across the life course of a female focal individual:

# Group specific kin types and filter for key relationships
kin_out <- kin_result$kin_summary %>% 
  mutate(kin = case_when(kin %in% c("ys", "os") ~ "s",      # Siblings
                         kin %in% c("ya", "oa") ~ "a",    # Aunts/uncles
                         TRUE ~ kin)) %>%
  filter(kin %in% c("d", "m", "gm", "ggm", "s", "a"))     # Select key relationships

# Visualize living kin by sex
kin_out %>% 
  group_by(kin, age_focal, sex_kin) %>%
  summarise(count = sum(count_living)) %>%
  ggplot(aes(age_focal, count, fill = sex_kin)) +
  geom_area() +
  labs(
    title = "Expected number of living relatives by sex",
    subtitle = "Female focal individual, France 2012",
    x = "Age of focal individual",
    y = "Number of living relatives",
    fill = "Sex of relative"
  ) +
  theme_bw() +
  facet_wrap(~kin, labeller = labeller(
    kin = c("a" = "Aunts/Uncles", "d" = "Children", 
            "gm" = "Grandparents", "ggm" = "Great-grandparents",
            "m" = "Parents", "s" = "Siblings")
  ))

Interpretation: These stacked area plots reveal how the sex composition of living relatives changes across the life course:

These patterns highlight the importance of accounting for sex differences in kinship models, especially when studying older populations.

Understanding Kinship Terminology in Two-Sex Models {#kinship-terminology}

When using the kin2sex function, it's important to understand how relationship codes work:

# Example of how to identify specific relatives by sex
kin_result$kin_summary %>% 
  filter(kin == "d", sex_kin == "m") %>%  # This selects sons (male children)
  head()

The function uses the same relationship codes as the one-sex model (see demokin_codes()), but now each relative has a specified sex. For example:

This coding system allows for flexible analysis of specific relative types while maintaining compatibility with the one-sex model.

Sex Ratios in Kinship Networks {#sex-ratios}

Sex ratios (males per female) are a traditional measure in demography that can provide insights into kinship structures. Let's examine how sex ratios vary across different types of relatives:

# Calculate sex ratios (males per female) by kin type and age
kin_out %>% 
  group_by(kin, age_focal) %>%
  summarise(sex_ratio = sum(count_living[sex_kin == "m"], na.rm = TRUE) / 
                        sum(count_living[sex_kin == "f"], na.rm = TRUE)) %>%
  ggplot(aes(age_focal, sex_ratio)) +
  geom_line(linewidth = 1) +
  geom_hline(yintercept = 1, linetype = "dashed", color = "gray50") +
  labs(
    title = "Sex ratios of living relatives across the life course",
    subtitle = "Males per female, France 2012",
    x = "Age of focal individual",
    y = "Sex ratio (m/f)"
  ) +
  theme_bw() +
  facet_wrap(~kin, scales = "free", labeller = labeller(
    kin = c("a" = "Aunts/Uncles", "d" = "Children", 
            "gm" = "Grandparents", "ggm" = "Great-grandparents",
            "m" = "Parents", "s" = "Siblings")
  ))

Interpretation: The sex ratio plots reveal several important patterns:

These sex ratios have important implications for care relationships and support networks, particularly in older populations where female relatives predominate.

Timing of Kin Loss by Sex {#kin-loss-by-sex}

The experience of losing relatives differs by the sex of those relatives. Let's examine how the timing of kin loss varies by sex:

# Visualize dead kin by sex
kin_out %>%
  group_by(kin, sex_kin, age_focal) %>%
  summarise(count = sum(count_dead)) %>%
  ggplot(aes(age_focal, count, color = sex_kin)) +
  geom_line(linewidth = 1) +
  labs(
    title = "Number of deceased relatives by sex",
    subtitle = "Female focal individual, France 2012",
    x = "Age of focal individual",
    y = "Number of deceased relatives",
    color = "Sex of relative"
  ) +
  theme_bw() +
  facet_wrap(~kin, scales = "free", labeller = labeller(
    kin = c("a" = "Aunts/Uncles", "d" = "Children", 
            "gm" = "Grandparents", "ggm" = "Great-grandparents",
            "m" = "Parents", "s" = "Siblings")
  ))

Interpretation: These curves show how the experience of losing relatives differs by sex:

Understanding these patterns is important for studying bereavement experiences and their impacts across the life course.

Applications of Two-Sex Kinship Models

Two-sex kinship models have numerous applications in demographic and social research:

  1. Gender and care: Women typically provide more informal care to relatives than men. Two-sex models can help quantify potential care burdens by examining the availability of different types of relatives by sex.

  2. Kinship networks in aging societies: As populations age, the sex composition of available kin changes dramatically. Two-sex models allow us to project these changes and their implications for social support.

  3. Intergenerational transfers: Resources often flow differently between male and female relatives. Two-sex models provide the demographic foundation for studying these gendered patterns.

  4. Demographic transitions: Sex differences in mortality and fertility change during demographic transitions, reshaping kinship networks in ways that one-sex models cannot capture.

  5. Demographic shocks: Events like wars often affect males and females differently, with long-lasting impacts on kinship structures. Two-sex models can capture these effects.

Conclusion

In this vignette, we've explored how to implement two-sex kinship models using the DemoKin package. By incorporating sex-specific mortality and fertility rates, these models reveal important patterns that one-sex models cannot capture:

  1. Female predominance among older relatives due to sex differences in mortality
  2. Systematic differences in the timing of kin loss by sex, with male kin typically lost earlier
  3. Varying sex ratios within kinship networks by relationship type and age
  4. Distinct age distributions of relatives by sex

These insights have significant implications for understanding care relationships, intergenerational transfers, and support systems in aging societies. The two-sex approach substantially enhances our understanding of how gender shapes family structures across the life course, providing a more realistic foundation for both research and policy development.

References



IvanWilli/DemoKin documentation built on June 9, 2025, 10:54 p.m.