Package 'Families'

Title: Kinship Ties in Virtual Populations
Description: Tools to study kinship networks, grandparenthood, and double burden (presence of children and oldest old parents) in virtual population produced by 'VirtualPop'.
Authors: Frans Willekens [aut, cre]
Maintainer: Frans Willekens <[email protected]>
License: GPL-2
Version: 1.0.1
Built: 2025-02-15 04:40:28 UTC
Source: https://github.com/willekens/families

Help Index


Kinship Ties in Virtual Populations

Description

Tools to study kinship networks, grandparenthood, and double burden (presence of children and oldest old parents) in virtual population produced by ’VirtualPop’.

Author(s)

Frans Willekens <[email protected]>


dataLH data

Description

simulated population of four generations

Usage

data(dataLH)

Format

A data frame with data on 1000 individuals.

ID

Identification number

gen

Generation

sex

Sex. A factor with levels Males Females

bdated

Date of birth (decimal date)

ddated

Date of death (decimal date)

x_D

Age at death (decimal number)

IDpartner

ID of partner

IDmother

ID of mother

IDfather

ID of father

jch

Child's line number in the household

nch

Number of children ever born

id.1

ID of first child

id.2

ID of 2nd child

id.3

ID of 3rd child

id.4

ID of 4th child

id.5

ID of 5th child

id.6

ID of 6th child

id.7

ID of 7th child

id.8

ID of 8th child

id.9

ID of 9th child

age.1

Age of mother at birth of first child

age.2

Age of mother at birth of 2nd child

age.3

Age of mother at birth of 3rd child

age.4

Age of mother at birth of 4th child

age.5

Age of mother at birth of 5th child

age.6

Age of mother at birth of 6th child

age.7

Age of mother at birth of 7th child

age.8

Age of mother at birth of 8th child

age.9

Age of mother at birth of 9th child

Source

Simulation uses period mortality rates and fertility rates by birth order from the United States 2019. The data are downloaded from the Human Mortality Database (HMD) and the Human Fertility Database (HFD).


dataLH_F data

Description

Simulated population of four generations, produced by 'VirtualPop'.

Format

A data frame with data on 2965 individuals (1000 in initial cohort).

ID

Identification number

gen

Generation

sex

Sex. A factor with levels Males and Females

bdated

Date of birth (decimal date

ddated

Date of death (decimal date

x_D

Age at death (decimal number

IDpartner

ID of partner

IDmother

ID of mother

IDfather

ID of father

jch

Child's line number in the household

nch

Number of children ever born

id.1

ID of first child

id.2

ID of 2nd child

id.3

ID of 3rd child

id.4

ID of 4th child

id.5

ID of 5th child

id.6

ID of 6th child

id.7

ID of 7th child

id.8

ID of 8th child

id.9

ID of 9th child

age.1

Age of mother at birth of first child

age.2

Age of mother at birth of 2nd child

age.3

Age of mother at birth of 3rd child

age.4

Age of mother at birth of 4th child

age.5

Age of mother at birth of 5th child

age.6

Age of mother at birth of 6th child

age.7

Age of mother at birth of 7th child

age.8

Age of mother at birth of 8th child

age.9

Age of mother at birth of 9th child

Source

Simulation uses period mortality rates and fertility rates by birth order from the United States 2019. The data are downloaded from the Human Mortality Database (HMD) and the Human Fertility Database (HFD).


Retrieves the date(s) of birth in decimal format

Description

Retrieves the date(s) of birth from the database

Usage

Db(idego, dLH)

Arguments

idego

vector of IDs of egos

dLH

Name of database. If dLH is missing, dataLH_F is used.

Value

Returns the dates of birth

Author(s)

Frans Willekens

Examples

# Date of birth of first individual in database
data(dataLH_F,package = "Families")
Db(idego=1)

Retrieves the date(s) of death in decimal format

Description

Retrieves the date(s) of death from the database

Usage

Dd(idego, dLH)

Arguments

idego

vector of IDs of egos

dLH

Name of database. If dLH is missing, dataLH_F is used.

Value

Returns the date of death

Author(s)

Frans Willekens

Examples

# Date of death of first individual in database
data(dataLH_F,package = "Families")
Dd(idego=1)

dpopus data Population of the United States in 2019 reported in the HMD (Population.txt file)

Description

dpopus data

Population of the United States in 2019 reported in the HMD (Population.txt file)

Format

A data frame with 111 age groups (single years of age).

Females

Female population

Males

Male population

Source

The data are downloaded from the Human Mortality Database (HMD). Country: USA. Year: 2019


Computes (a) Life expectancy at birth, (b) Probability of surviving at age 65, and (c) Probability of surviving at age 85

Description

Computes (a) Life expectancy at birth, (b) Probability of surviving at age 65, and (c) Probability of surviving at age 85

Usage

e0(dLH)

Arguments

dLH

The name of the database. If missing, dataLH_F is used.

Value

e0

Mean ages at death

Prob65

Probability of surviving at age 65

Prob85

Probability of surviving at age 85

Author(s)

Frans Willekens

Examples

data(dataLH_F,package = "Families")
e0(dLH=dataLH_F)

Retrieves ID of children of ego

Description

Retrieves ID of children of ego or children of vector of egos

Usage

IDch(idego, dLH, keep_ego = FALSE)

Arguments

idego

ID of ego(s)

dLH

Name of database. If dLH is missing, dataLH_F is used.

keep_ego

Option to link show ID of ego together with ID of mother

Value

ID of children. If ego has no children or IDs of children are not included in database, numeric(0) is returned. If keep_ego=TRUE, a data frame is returned with the following columns: IDego, ID of mother of children, ID of father of children, ID of children, sex of children.

Author(s)

Frans Willekens

Examples

data(dataLH_F,package = "Families")
IDch(idego=1)
id <- sample (dataLH_F$ID[dataLH_F$gen==1],10)
IDch(idego=sort(id),keep_ego=TRUE)

Retrieves ID of father of ego

Description

Function to retrieve the ID of father of ego or fathers of vector of egos

Usage

IDfather(idego, dLH, keep_ego = FALSE)

Arguments

idego

ID

dLH

Name of database. If missing, dataLH_F is used.

keep_ego

Option to link show ID of ego together with ID of father

Value

ID of father or (if keep_ego=TRUE, object with ID of ego and ID of father). Returns NA if ID of father is not included in the database

Author(s)

Frans Willekens

Examples

data(dataLH_F,package = "Families")
IDfather (idego=sample (dataLH_F$ID,10))

Retrieves IDs of granchildren of ego

Description

Retrieves IDs of grandchildren of vector of egos

Usage

IDgch(id, dataLH, keep_ego = FALSE)

Arguments

id

vector of IDs of egos

dataLH

Database. If missing, datac=datab

keep_ego

Option to show ID of ego together with ID of mother

Details

IDgch uses IDch

Value

ID of grandchildren or (if keep_ego=TRUE, data frame with ID of members of multiple generations). If ego has no grandchildren or IDs of grandchildren are not included in database, numeric(0) is returned and the message "No (grand)children of ego in database". If keep_ego=TRUE, an data frame is returned with the following columns: IDego, ID of ego's child that is mother or father of grandchildren, IDs of mother and father of grandchildren, ID of grandchildren, character sequence denoting the sex of grandparent, parent and sex of child.

Author(s)

Frans Willekens

Examples

data(dataLH)
# Grandchildren of ego with ID 1
IDgch(1,dataLH)
# Grandchildren of member of first generation
IDgch(sample(dataLH$ID[dataLH$gen==1],3),dataLH,keep_ego=TRUE)

Retrieves ID of mother of ego

Description

Retrieves the ID of mother of ego or mothers of vector of egos

Usage

IDmother(idego, dLH, keep_ego = FALSE)

Arguments

idego

ID

dLH

Name of database. If missing, dataLH_F is used.

keep_ego

Option to show ID of ego together with ID of mother

Value

ID of mother or (if keep_ego=TRUE, object with ID of ego and ID of mother). Returns NA if ID of mother is not included in the database

Author(s)

Frans Willekens

Examples

data(dataLH_F,package = "Families")
IDmother (sample (dataLH_F$ID,10))
IDmother(sample (dataLH_F$ID,10),keep_ego=TRUE)

Retrieves ID of partner of ego or allocate partner to ego

Description

Retrieves ID of partners of vector of egos or randomly allocates partners to egos

Usage

IDpartner(idego, dLH)

Arguments

idego

vector of ID of egos. If idego is missing, then the function allocates partners (from opposite sex) to egos. The allocation is random.

dLH

Name of database. If missing, dataLH_F is used.

Value

IDs of partners. If the argument idego is missing, then a data frame similar to 'dLH' is returned with IDs of partners completed.

Author(s)

Frans Willekens

Examples

data(dataLH_F,package = "Families")
IDpartner(idego=1)
# Allocate partner to egos with ID 4,9,30.
IDpartner(idego=dataLH_F$ID[c(4,9,30)])

Multistate life table

Description

Computes fertility table by birth order

Usage

Multistate(rates, mortality = 1)

Arguments

rates

rates by age and sex and birth rates by age and birth order (or parity)

mortality

Indicator variable. Mortality accounted for if mortality=1, else mortality omitted.

Details

The multistate life table is computed using the functions MSLT.S and MLST.e from the Biograph package. The two functions are included in the Multistate function as MSLT_S and MSLT_e.

Value

A list of two objects: itemSthe multistate survival function (S) and multistate transition probabilities (P) itemmsltother measures of the multistate life table: person-years (L); expectation at birth of sojourn times in the various states (e0); expectation at age x of the remaining expected sojourn times in the various states: population-based measures (e.p); expectation at age x of the remaining expected sojourn times in the various states: status-based measures (e.p)

Author(s)

Frans Willekens

Examples

data(rates,package = "Families")
z=Multistate(rates)

rates data

Description

Mortality rates by age and sex: fertility rates by age and birth order

Format

A list of three objects.

ASDR

Mortality rates

ASFR

Fertility rates

ratesM

Multistate transition rates

Source

The data are downloaded from the Human Mortality Database (HMD) and the Human Fertility Database (HFD). Country: USA. Year: 2019