MyNixOS website logo
Description

Estimate Population Kin Distribution.

Estimate population kin counts and its distribution by type, age and sex. The package implements one-sex and two-sex framework for studying living-death availability, with time varying rates or not, and multi-stage model.

DemoKin

DemoKin uses matrix demographic methods to compute expected (average) kin counts from demographic rates under a range of scenarios and assumptions. The package is an R-language implementation of Caswell (2019, 2020, 2022), and Caswell and Song (2021). It draws on previous theoretical development by Goodman, Keyfitz and Pullum (1974).

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("IvanWilli/DemoKin")

Usage

Consider an average Swedish woman called ‘Focal.’ For this exercise, we assume a female closed population in which everyone experiences the Swedish 2015 mortality and fertility rates at each age throughout their life; i.e., the ‘time-invariant’ assumption in Caswell (2019).

We then ask:

What is the expected number of relatives of Focal over her life course?

Let’s explore this using the Swedish data already included with DemoKin.

library(DemoKin)
swe_surv_2015 <- swe_px[,"2015"]
swe_asfr_2015 <- swe_asfr[,"2015"]
swe_2015 <- kin(p = swe_surv_2015, f = swe_asfr_2015, time_invariant = TRUE)

p is the survival probability by age from a life table and f are the age specific fertility ratios by age (see ?kin for details).

Now, we can visualize the implied kin counts (i.e., the average number of living kin) of Focal at age 35 using a network or ‘Keyfitz’ kinship diagram with the function plot_diagram:

# We need to reformat the data a little bit
kin_total <- swe_2015$kin_summary
# Keep only data for Focal's age 35
kin_total <- kin_total[kin_total$age_focal == 35 , c("kin", "count_living")]
names(kin_total) <- c("kin", "count")
plot_diagram(kin_total, rounding = 2)

Relatives are identified by a unique code:

DemoKinLabels_female
coaCousins from older aunts
cyaCousins from younger aunts
cCousins
dDaughters
gdGrand-daughters
ggdGreat-grand-daughters
ggmGreat-grandmothers
gmGrandmothers
mMother
nosNieces from older sisters
nysNieces from younger sisters
nNieces
oaAunts older than mother
yaAunts younger than mother
aAunts
osOlder sisters
ysYounger sisters
sSisters

Vignette

For more details, including an extension to time-variant rates, deceased kin, and multi-state models in a one-sex framework, see vignette("Reference_OneSex", package = "DemoKin"). For two-sex models, see vignette("Reference_TwoSex", package = "DemoKin"). If the vignette does not load, you may need to install the package as devtools::install_github("IvanWilli/DemoKin", build_vignettes = T).

Citation

Williams, Iván; Alburez-Gutierrez, Diego; Song, Xi; and Hal Caswell. (2021) DemoKin: An R package to implement demographic matrix kinship models. URL: https://github.com/IvanWilli/DemoKin.

Acknowledgments

We thank Silvia Leek from the Max Planck Institute for Demographic Research for designing the DemoKin logo. The logo includes elements that have been taken or adapted from this file, originally by Ansunando, CC BY-SA 4.0 via Wikimedia Commons. Sha Jiang provided useful comments for improving the package.

Get involved!

DemoKin is under constant development. If you’re interested in contributing, please get in touch, create an issue, or submit a pull request. We look forward to hearing from you!

References

Caswell, Hal. 2019. “The Formal Demography of Kinship: A Matrix Formulation.” Demographic Research 41 (September): 679–712. https://doi.org/10.4054/DemRes.2019.41.24.

———. 2020. “The Formal Demography of Kinship II: Multistate Models, Parity, and Sibship.” Demographic Research 42 (June): 1097–1146. https://doi.org/10.4054/DemRes.2020.42.38.

———. 2022. “The Formal Demography of Kinship IV: Two-Sex Models and Their Approximations.” Demographic Research 47 (September): 359–96. https://doi.org/10.4054/DemRes.2022.47.13.

Caswell, Hal, and Xi Song. 2021. “The Formal Demography of Kinship III: Kinship Dynamics with Time-Varying Demographic Rates.” Demographic Research 45 (August): 517–46. https://doi.org/10.4054/DemRes.2021.45.16.

Goodman, Leo A, Nathan Keyfitz, and Thomas W. Pullum. 1974. “Family Formation and the Frequency of Various Kinship Relationships.” Theoretical Population Biology, 27. https://doi.org/10.1016/0040-5809(74)90049-5.

Metadata

Version

1.0.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows