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 |
Tools to study kinship networks, grandparenthood, and double burden (presence of children and oldest old parents) in virtual population produced by ’VirtualPop’.
Frans Willekens <[email protected]>
simulated population of four generations
data(dataLH)
data(dataLH)
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
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).
Simulated population of four generations, produced by 'VirtualPop'.
A data frame with data on 2965 individuals (1000 in initial cohort).
Identification number
Generation
Sex. A factor with levels Males and Females
Date of birth (decimal date
Date of death (decimal date
Age at death (decimal number
ID of partner
ID of mother
ID of father
Child's line number in the household
Number of children ever born
ID of first child
ID of 2nd child
ID of 3rd child
ID of 4th child
ID of 5th child
ID of 6th child
ID of 7th child
ID of 8th child
ID of 9th child
Age of mother at birth of first child
Age of mother at birth of 2nd child
Age of mother at birth of 3rd child
Age of mother at birth of 4th child
Age of mother at birth of 5th child
Age of mother at birth of 6th child
Age of mother at birth of 7th child
Age of mother at birth of 8th child
Age of mother at birth of 9th child
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 from the database
Db(idego, dLH)
Db(idego, dLH)
idego |
vector of IDs of egos |
dLH |
Name of database. If dLH is missing, dataLH_F is used. |
Returns the dates of birth
Frans Willekens
# Date of birth of first individual in database data(dataLH_F,package = "Families") Db(idego=1)
# Date of birth of first individual in database data(dataLH_F,package = "Families") Db(idego=1)
Retrieves the date(s) of death from the database
Dd(idego, dLH)
Dd(idego, dLH)
idego |
vector of IDs of egos |
dLH |
Name of database. If dLH is missing, dataLH_F is used. |
Returns the date of death
Frans Willekens
# Date of death of first individual in database data(dataLH_F,package = "Families") Dd(idego=1)
# 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)
A data frame with 111 age groups (single years of age).
Female population
Male population
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
e0(dLH)
e0(dLH)
dLH |
The name of the database. If missing, dataLH_F is used. |
e0 |
Mean ages at death |
Prob65 |
Probability of surviving at age 65 |
Prob85 |
Probability of surviving at age 85 |
Frans Willekens
data(dataLH_F,package = "Families") e0(dLH=dataLH_F)
data(dataLH_F,package = "Families") e0(dLH=dataLH_F)
Retrieves ID of children of ego or children of vector of egos
IDch(idego, dLH, keep_ego = FALSE)
IDch(idego, dLH, keep_ego = FALSE)
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 |
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.
Frans Willekens
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)
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)
Function to retrieve the ID of father of ego or fathers of vector of egos
IDfather(idego, dLH, keep_ego = FALSE)
IDfather(idego, dLH, keep_ego = FALSE)
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 |
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
Frans Willekens
data(dataLH_F,package = "Families") IDfather (idego=sample (dataLH_F$ID,10))
data(dataLH_F,package = "Families") IDfather (idego=sample (dataLH_F$ID,10))
Retrieves IDs of grandchildren of vector of egos
IDgch(id, dataLH, keep_ego = FALSE)
IDgch(id, dataLH, keep_ego = FALSE)
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 |
IDgch uses IDch
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.
Frans Willekens
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)
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 the ID of mother of ego or mothers of vector of egos
IDmother(idego, dLH, keep_ego = FALSE)
IDmother(idego, dLH, keep_ego = FALSE)
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 |
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
Frans Willekens
data(dataLH_F,package = "Families") IDmother (sample (dataLH_F$ID,10)) IDmother(sample (dataLH_F$ID,10),keep_ego=TRUE)
data(dataLH_F,package = "Families") IDmother (sample (dataLH_F$ID,10)) IDmother(sample (dataLH_F$ID,10),keep_ego=TRUE)
Retrieves ID of partners of vector of egos or randomly allocates partners to egos
IDpartner(idego, dLH)
IDpartner(idego, dLH)
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. |
IDs of partners. If the argument idego is missing, then a data frame similar to 'dLH' is returned with IDs of partners completed.
Frans Willekens
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)])
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)])
Computes fertility table by birth order
Multistate(rates, mortality = 1)
Multistate(rates, mortality = 1)
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. |
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.
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)
Frans Willekens
data(rates,package = "Families") z=Multistate(rates)
data(rates,package = "Families") z=Multistate(rates)
Mortality rates by age and sex: fertility rates by age and birth order
A list of three objects.
Mortality rates
Fertility rates
Multistate transition rates
The data are downloaded from the Human Mortality Database (HMD) and the Human Fertility Database (HFD). Country: USA. Year: 2019