SJTU CMGPD Methodological Lecture Day 8 Family and contextual influences
Existing variables The various datasets already have a number of basic kinship variables such as counts of various types of kin. – Next slide is parental survival When creating kinship variables, be careful about mixing them with existing kinship variables – Kinship variables are sensitive to assumptions made in their creation, so be consistent
Parental survival use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear merge 1:1 RECORD_NUMBER using "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0003\ Data.dta" keep if FATHER_ALIVE >= 0 & MOTHER_ALIVE >= 0 keep if AGE_IN_SUI >= 1 & AGE_IN_SUI <= 80 keep if SEX == 2 & PRESENT bysort AGE_IN_SUI: generate byte first_in_age = _n == 1 bysort AGE_IN_SUI: egen p_both_parents_alive = mean(FATHER_ALIVE & MOTHER_ALIVE) bysort AGE_IN_SUI: egen p_one_parent_alive = mean((FATHER_ALIVE + MOTHER_ALIVE)==1) bysort AGE_IN_SUI: egen p_no_parent_alive = mean((FATHER_ALIVE + MOTHER_ALIVE)==0) bysort AGE_IN_SUI: egen p_father_alive = mean(FATHER_ALIVE) bysort AGE_IN_SUI: egen p_mother_alive = mean(MOTHER_ALIVE) line p_both_parents_alive p_one_parent_alive p_no_parent_alive p_father_alive p_mother_alive AGE_IN_SUI if first_in_age, ytitle("Proportion") xtitle("Age in sui") legend(order(1 "Both parents alive" 2 "One parent alive" 3 "No parent alive" 4 "Father alive" 5 "Mother alive")) scheme(s1mono) lpattern(solid dash dot dash_dot shortdash)
Basic principles for locating descendants in same year Sons – Males in the same YEAR whose FATHER_ID is same as individual’s PERSON_ID Daughters – Never-married females (MARITAL_STATUS == 2) in the same YEAR whose FATHER_ID is same as an individual’s PERSON_ID Married daughters-in-law – Married women (MARITAL_STATUS == 1 or 4) in the same year whose FATHER_ID is same as individual’s PERSON_ID – For married and widowed women, kinship identifiers for father, mother etc. all refer to in-laws Widowed daughters-in-law – Widowed women (MARITAL_STATUS == 3) in the same year whose FATHER_ID is same as individual’s PERSON_ID Grandchildren – Same as above, but look for values of GRANDFATHER_ID that match PERSON_ID
Counting descendants alive in the current register year Sons – Create for each unique combination of FATHER_ID and YEAR Number of people who have specified FATHER_ID in the current register year – Rename FATHER_ID to PERSON_ID and save – Load original file and merge on PERSON_ID and YEAR Grandsons – Do the same, except use GRANDFATHER_ID Could do this with MOTHER_ID and GRANDMOTHER_ID as well – Would need minor adjustments
Numbers of living sons use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if FATHER_ID != "-99" keep if PRESENT keep if SEX == 2 bysort FATHER_ID YEAR: generate sons_alive = _N bysort FATHER_ID YEAR: keep if _n == 1 keep FATHER_ID YEAR sons_alive rename FATHER_ID PERSON_ID save sons_alive use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear merge m:1 PERSON_ID YEAR using sons_alive, keep(match master) keep if SEX == 2 replace sons_alive = 0 if sons_alive ==. keep if AGE_IN_SUI > 0 & AGE_IN_SUI <= 80 bysort AGE_IN_SUI: generate byte first_in_age = _n == 1 bysort AGE_IN_SUI: egen mean_sons_alive = mean(sons_alive) line mean_sons_alive AGE_IN_SUI if first_in_age, scheme(s1mono) ytitle("Mean number of living sons") xtitle("Age in sui") bysort AGE_IN_SUI: egen p_sons_alive_0 = mean(sons_alive == 0) bysort AGE_IN_SUI: egen p_sons_alive_1 = mean(sons_alive == 1) bysort AGE_IN_SUI: egen p_sons_alive_2 = mean(sons_alive == 2) bysort AGE_IN_SUI: egen p_sons_alive_3 = mean(sons_alive == 3) bysort AGE_IN_SUI: egen p_sons_alive_4 = mean(sons_alive == 4) bysort AGE_IN_SUI: egen p_sons_alive_gt_5 = mean(sons_alive >= 5) line p_sons_alive_0 p_sons_alive_1 p_sons_alive_2 p_sons_alive_3 p_sons_alive_4 p_sons_alive_gt_5 AGE_IN_SUI if first_in_age, scheme(s1mono) ytitle("Prop. of men with specified # of living sons") xtitle("Age in sui") legend(order(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5+"))
Numbers of living grandsons use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if GRANDFATHER_ID != "-99" keep if PRESENT keep if SEX == 2 bysort GRANDFATHER_ID YEAR: generate grandsons_alive = _N bysort GRANDFATHER_ID YEAR: keep if _n == 1 keep GRANDFATHER_ID YEAR grandsons_alive rename GRANDFATHER_ID PERSON_ID save grandsons_alive, replace use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear merge m:1 PERSON_ID YEAR using grandsons_alive, keep(match master) keep if SEX == 2 replace grandsons_alive = 0 if grandsons_alive ==. keep if AGE_IN_SUI > 0 & AGE_IN_SUI <= 80 bysort AGE_IN_SUI: generate byte first_in_age = _n == 1 bysort AGE_IN_SUI: egen mean_gsons_alive = mean(grandsons_alive) line mean_gsons_alive AGE_IN_SUI if first_in_age, scheme(s1mono) ytitle("Mean # living grandsons") xtitle("Age in sui") bysort AGE_IN_SUI: egen p_gsons_alive_0 = mean(grandsons_alive == 0) bysort AGE_IN_SUI: egen p_gsons_alive_1 = mean(grandsons_alive == 1) bysort AGE_IN_SUI: egen p_gsons_alive_2 = mean(grandsons_alive == 2) bysort AGE_IN_SUI: egen p_gsons_alive_3 = mean(grandsons_alive == 3) bysort AGE_IN_SUI: egen p_gsons_alive_4 = mean(grandsons_alive == 4) bysort AGE_IN_SUI: egen p_gsons_alive_gt_5 = mean(grandsons_alive >= 5) line p_gsons_alive_0 p_gsons_alive_1 p_gsons_alive_2 p_gsons_alive_3 p_gsons_alive_4 p_gsons_alive_gt_5 AGE_IN_SUI if first_in_age, scheme(s1mono) ytitle("Prop. of men with # of living grandsons") xtitle("Age in sui") legend(order(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5+"))
Counting up sons (or grandsons) with specified characteristics Apply additional restrictions in keep to count up sons or grandsons with specified characteristics The following adds a restriction so that only boys aged 1 to 10 sui are included in the count. Could just as well have been sons with position, or other characteristics such as marriage.
Counting young sons use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if FATHER_ID != "-99" keep if PRESENT keep if SEX == 2 & AGE_IN_SUI >= 1 & AGE_IN_SUI <= 10 bysort FATHER_ID YEAR: generate sons_alive = _N bysort FATHER_ID YEAR: keep if _n == 1 keep FATHER_ID YEAR sons_alive rename FATHER_ID PERSON_ID save sons_alive use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear merge m:1 PERSON_ID YEAR using sons_alive, keep(match master) keep if SEX == 2 replace sons_alive = 0 if sons_alive ==. keep if AGE_IN_SUI > 0 & AGE_IN_SUI <= 80 bysort AGE_IN_SUI: generate byte first_in_age = _n == 1 bysort AGE_IN_SUI: egen mean_sons_alive = mean(sons_alive) line mean_sons_alive AGE_IN_SUI if first_in_age, scheme(s1mono) ytitle("Mean number of living sons") xtitle("Age in sui") bysort AGE_IN_SUI: egen p_sons_alive_0 = mean(sons_alive == 0) bysort AGE_IN_SUI: egen p_sons_alive_1 = mean(sons_alive == 1) bysort AGE_IN_SUI: egen p_sons_alive_2 = mean(sons_alive == 2) bysort AGE_IN_SUI: egen p_sons_alive_3 = mean(sons_alive == 3) bysort AGE_IN_SUI: egen p_sons_alive_4 = mean(sons_alive == 4) bysort AGE_IN_SUI: egen p_sons_alive_gt_5 = mean(sons_alive >= 5) line p_sons_alive_0 p_sons_alive_1 p_sons_alive_2 p_sons_alive_3 p_sons_alive_4 p_sons_alive_gt_5 AGE_IN_SUI if first_in_age, scheme(s1mono) ytitle("Prop. of men with specified # of living sons") xtitle("Age in sui") legend(order(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5+"))
Locating members of the same generation Brothers – Males in the same YEAR who have the same FATHER_ID Sisters – Never-married females in the same YEAR who have the same FATHER_ID Sisters-in-law – Married or widowed females in the same YEAR who have the same FATHER_ID Male cousins – Males in the same YEAR with the same GRANDFATHER_ID but a different FATHER_ID Male second cousins – Males in the same YEAR with the same F_ID_3 but a different GRANDFATHER_ID and FATHER_ID
Numbers of living brothers use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if FATHER_ID != "-99" & PRESENT & SEX == 2 bysort FATHER_ID YEAR: generate brothers_alive = _N-1 bysort FATHER_ID YEAR: keep if _n == 1 keep FATHER_ID YEAR brothers_alive save brothers_alive, replace use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if FATHER_ID != "-99" & SEX == 2 merge m:1 FATHER_ID YEAR using brothers_alive, keep(match master) replace brothers_alive = 0 if brothers_alive ==. keep if AGE_IN_SUI > 0 & AGE_IN_SUI <= 80 bysort AGE_IN_SUI: generate byte first_in_age = _n == 1 bysort AGE_IN_SUI: egen mean_brothers_alive = mean(brothers_alive) line mean_brothers_alive AGE_IN_SUI if first_in_age, scheme(s1mono) ytitle("Mean number of living brothers") xtitle("Age in sui") bysort AGE_IN_SUI: egen p_brothers_alive_0 = mean(brothers_alive == 0) bysort AGE_IN_SUI: egen p_brothers_alive_1 = mean(brothers_alive == 1) bysort AGE_IN_SUI: egen p_brothers_alive_2 = mean(brothers_alive == 2) bysort AGE_IN_SUI: egen p_brothers_alive_3 = mean(brothers_alive == 3) bysort AGE_IN_SUI: egen p_brothers_alive_4 = mean(brothers_alive == 4) bysort AGE_IN_SUI: egen p_brothers_alive_gt_5 = mean(brothers_alive >= 5) line p_brothers_alive_0 p_brothers_alive_1 p_brothers_alive_2 p_brothers_alive_3 p_brothers_alive_4 p_brothers_alive_gt_5 AGE_IN_SUI if first_in_age, scheme(s1mono) ytitle("Prop. of men with specified # of living brothers") xtitle("Age in sui") legend(order(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5+"))
Saving and merging isn’t necessary for counting siblings, cousins… use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if FATHER_ID != "-99" & PRESENT & SEX == 2 bysort FATHER_ID YEAR: generate brothers_alive = _N-1 keep if AGE_IN_SUI > 0 & AGE_IN_SUI <= 80 bysort AGE_IN_SUI: generate byte first_in_age = _n == 1 bysort AGE_IN_SUI: egen mean_brothers_alive = mean(brothers_alive) line mean_brothers_alive AGE_IN_SUI if first_in_age, scheme(s1mono) ytitle("Mean number of living brothers") xtitle("Age in sui") bysort AGE_IN_SUI: egen p_brothers_alive_0 = mean(brothers_alive == 0) bysort AGE_IN_SUI: egen p_brothers_alive_1 = mean(brothers_alive == 1) bysort AGE_IN_SUI: egen p_brothers_alive_2 = mean(brothers_alive == 2) bysort AGE_IN_SUI: egen p_brothers_alive_3 = mean(brothers_alive == 3) bysort AGE_IN_SUI: egen p_brothers_alive_4 = mean(brothers_alive == 4) bysort AGE_IN_SUI: egen p_brothers_alive_gt_5 = mean(brothers_alive >= 5) line p_brothers_alive_0 p_brothers_alive_1 p_brothers_alive_2 p_brothers_alive_3 p_brothers_alive_4 p_brothers_alive_gt_5 AGE_IN_SUI if first_in_age, scheme(s1mono) ytitle("Prop. of men with specified # of living brothers") xtitle("Age in sui") legend(order(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5+"))
Brothers w/ specified characteristics keep if FATHER_ID != "-99" & PRESENT & SEX == 2 bysort FATHER_ID YEAR: egen brothers_alive = total(MARITAL_STATUS == 1 | MARITAL_STATUS == 4) replace brothers_alive = brothers_alive - 1 if MARITAL_STATUS == 1 | MARITAL_STATUS == 4 keep if AGE_IN_SUI > 0 & AGE_IN_SUI <= 80 bysort AGE_IN_SUI: generate byte first_in_age = _n == 1 bysort AGE_IN_SUI: egen mean_brothers_alive = mean(brothers_alive) line mean_brothers_alive AGE_IN_SUI if first_in_age, scheme(s1mono) ytitle("Mean number of married brothers") xtitle("Age in sui") bysort AGE_IN_SUI: egen p_brothers_alive_0 = mean(brothers_alive == 0) bysort AGE_IN_SUI: egen p_brothers_alive_1 = mean(brothers_alive == 1) bysort AGE_IN_SUI: egen p_brothers_alive_2 = mean(brothers_alive == 2) bysort AGE_IN_SUI: egen p_brothers_alive_3 = mean(brothers_alive == 3) bysort AGE_IN_SUI: egen p_brothers_alive_4 = mean(brothers_alive == 4) bysort AGE_IN_SUI: egen p_brothers_alive_gt_5 = mean(brothers_alive >= 5) line p_brothers_alive_0 p_brothers_alive_1 p_brothers_alive_2 p_brothers_alive_3 p_brothers_alive_4 p_brothers_alive_gt_5 AGE_IN_SUI if first_in_age, scheme(s1mono) ytitle("Prop. of men with specified # of married brothers") xtitle("Age in sui") legend(order(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5+"))
Numbers of living cousins use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if GRANDFATHER_ID != "-99" & FATHER_ID != "-99" & PRESENT == 1 & SEX == 2 bysort FATHER_ID YEAR: generate brothers_alive = _N-1 bysort GRANDFATHER_ID YEAR: generate cousins_alive = _N - brothers_alive - 1 bysort GRANDFATHER_ID YEAR: keep if _n == 1 keep GRANDFATHER_ID YEAR cousins_alive save cousins_alive, replace use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if GRANDFATHER_ID != "-99" & FATHER_ID != "-99" & SEX == 2 merge m:1 GRANDFATHER_ID YEAR using cousins_alive, keep(match master) replace cousins_alive = 0 if cousins_alive ==. keep if AGE_IN_SUI > 0 & AGE_IN_SUI <= 80 bysort AGE_IN_SUI: generate byte first_in_age = _n == 1 bysort AGE_IN_SUI: egen mean_cousins_alive = mean(cousins_alive) line mean_cousins_alive AGE_IN_SUI if first_in_age, scheme(s1mono) ytitle("Mean number of living cousins") xtitle("Age in sui") bysort AGE_IN_SUI: egen p_cousins_alive_0 = mean(cousins_alive == 0) bysort AGE_IN_SUI: egen p_cousins_alive_1 = mean(cousins_alive == 1) bysort AGE_IN_SUI: egen p_cousins_alive_2 = mean(cousins_alive == 2) bysort AGE_IN_SUI: egen p_cousins_alive_3 = mean(cousins_alive == 3) bysort AGE_IN_SUI: egen p_cousins_alive_4 = mean(cousins_alive == 4) bysort AGE_IN_SUI: egen p_cousins_alive_gt_5 = mean(cousins_alive >= 5) line p_cousins_alive_0 p_cousins_alive_1 p_cousins_alive_2 p_cousins_alive_3 p_cousins_alive_4 p_cousins_alive_gt_5 AGE_IN_SUI if first_in_age, scheme(s1mono) ytitle("Prop. of men with specified # of living cousins") xtitle("Age in sui") legend(order(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5+"))
Second cousins use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear merge 1:1 RECORD_NUMBER using "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0004\ Data.dta", keepusing(F_ID_3) keep if PRESENT == 1 & SEX == 2 & F_ID_3 != "-99" & FATHER_ID != "- 99" & GRANDFATHER_ID != "-99" bysort GRANDFATHER_ID YEAR: generate cousins = _N-1 bysort F_ID_3 YEAR: generate second_cousins = _N – cousins - 1 bysort AGE_IN_SUI: generate byte first_in_age = _n == 1 bysort AGE_IN_SUI: egen second_cousins_mean = mean(second_cousins) line second_cousins_mean AGE_IN_SUI if first_in_age & AGE_IN_SUI >= 1 & AGE_IN_SUI <= 80, scheme(s1mono) ytitle("Mean number of second cousins") xtitle("Age in sui")
Coresidence Can also group on HOUSEHOLD_ID to distinguish between sets of kin living in separate households For that matter, could also group on village identifier to identify kin in other versus same village Coresidence only makes sense from 1789 on
Second cousins by co-residence use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear merge 1:1 RECORD_NUMBER using "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0004\ Data.dta", keepusing(F_ID_3) keep if PRESENT == 1 & SEX == 2 & F_ID_3 != "-99" & FATHER_ID != "-99" & GRANDFATHER_ID != "-99" & HOUSEHOLD_ID != "-99" bysort GRANDFATHER_ID YEAR: generate cousins = _N-1 bysort GRANDFATHER_ID HOUSEHOLD_ID YEAR: generate cousins_hh = _N-1 bysort F_ID_3 YEAR: generate second_cousins = _N – cousins -1 bysort F_ID_3 HOUSEHOLD_ID YEAR: generate second_cousins_hh = _N - cousins_hh - 1 bysort AGE_IN_SUI: generate byte first_in_age = _n == 1 bysort AGE_IN_SUI: egen second_cousins_mean = mean(second_cousins) bysort AGE_IN_SUI: egen second_cousins_hh_mean = mean(second_cousins_hh) line second_cousins_mean second_cousins_hh_mean AGE_IN_SUI if first_in_age & AGE_IN_SUI >= 1 & AGE_IN_SUI <= 80, scheme(s1mono) ytitle("Mean") xtitle("Age in sui") legend(order(1 "Second cousins" 2 "Second cousins in household"))
Variables measured according to location within a generation Can sort members grouped by GRANDFATHER_ID, FATHER_ID etc. to measure characteristics relative to other members of the same generation Sort men with the same FATHER_ID by BIRTHYEAR to order brothers according to seniority Can count up unmarried older brothers (for example) with a running total of MARITAL_STATUS == 2 within FATHER_ID and YEAR, minus 1 for unmarried men.
Older unmarried brothers use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if SEX == 2 & FATHER_ID != "-99" & PRESENT generate byte unmarried = MARITAL_STATUS == 2 bysort FATHER_ID YEAR (BIRTHYEAR): gen older_unmarried_brothers = sum(unmarried) replace older_unmarried_brothers = older_unmarried_brothers - 1 if MARITAL_STATUS == 2 tab older_unmarried_brothers bysort AGE_IN_SUI: egen mean_older_unmarried_brothers = mean(older_unmarried_brothers) bysort AGE_IN_SUI: generate byte first_in_age = _n == 1 line mean_older_unmarried_brothers AGE_IN_SUI if first_in_age & AGE_IN_SUI >= 1 & AGE_IN_SUI <= 80, scheme(s1mono) ytitle("Mean number of older unmarried brothers") xtitle("Age")
Kin in other generations Uncles – Men whose FATHER_ID is the same as the individual’s GRANDFATHER_ID – But whose PERSON_ID is not the individual’s FATHER_ID Nephews – Men whose GRANDFATHER_ID is the same as the individual’s FATHER_ID – But whose FATHER_ID is not the individual’s PERSON_ID
Uncles use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if SEX == 2 & PRESENT & FATHER_ID != "-99" bysort FATHER_ID YEAR: generate uncles = _N bysort FATHER_ID YEAR: keep if _n == _N keep FATHER_ID YEAR uncles rename FATHER_ID GRANDFATHER_ID save uncles, replace use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if SEX == 2 & PRESENT & FATHER_ID != "-99" bysort PERSON_ID YEAR: keep if _n == _N generate byte father_alive = 1 keep PERSON_ID FATHER_ID YEAR father_alive rename FATHER_ID GRANDFATHER_ID rename PERSON_ID FATHER_ID save father, replace
use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if GRANDFATHER_ID != "-99" & FATHER_ID != "-99" keep if SEX == 2 & PRESENT merge m:1 GRANDFATHER_ID YEAR using uncles, keep(match master) drop _merge merge m:1 GRANDFATHER_ID FATHER_ID YEAR using father, keep(match master) replace father_alive = 0 if father_alive ==. replace uncles = 0 if uncles ==. tab uncles father_alive replace uncles = uncles - father_alive bysort AGE_IN_SUI: generate first_in_age = _n == 1 bysort AGE_IN_SUI: egen mean_uncles = mean(uncles) line mean_uncles AGE_IN_SUI if first_in_age & AGE_IN_SUI >= 1 & AGE_IN_SUI <= 80, scheme(s1mono) xtitle("Age in sui") ytitle("Mean number of uncles")
Kin with specified characteristics Use egen to count up kin with specified characteristics Following example counts up uncles with position Could just as well count up uncles meeting any criteria of interest – Age, marital status, etc.
Uncles with position use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if SEX == 2 & PRESENT & FATHER_ID != "-99" bysort FATHER_ID YEAR: egen uncles_with_position = total(HAS_POSITION == 1) bysort FATHER_ID YEAR: keep if _n == _N keep FATHER_ID YEAR uncles rename FATHER_ID GRANDFATHER_ID save uncles_with_position, replace use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if SEX == 2 & PRESENT & FATHER_ID != "-99" & HAS_POSITION bysort PERSON_ID YEAR: keep if _n == _N generate byte father_has_position = 1 keep PERSON_ID FATHER_ID YEAR father_has_position rename FATHER_ID GRANDFATHER_ID rename PERSON_ID FATHER_ID save father_has_position, replace
use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if GRANDFATHER_ID != "-99" & FATHER_ID != "-99" keep if SEX == 2 & PRESENT merge m:1 GRANDFATHER_ID YEAR using uncles_with_position, keep(match master) drop _merge merge m:1 GRANDFATHER_ID FATHER_ID YEAR using father_has_position, keep(match master) replace father_has_position = 0 if father_has_position ==. replace uncles_with_position = 0 if uncles_with_position ==. tab uncles_with_position father_has_position replace uncles_with_position = uncles_with_position - father_has_position bysort AGE_IN_SUI: generate first_in_age = _n == 1 bysort AGE_IN_SUI: egen mean_uncles_with_position = mean(uncles_with_position) line mean_uncles AGE_IN_SUI if first_in_age & AGE_IN_SUI >= 1 & AGE_IN_SUI <= 80, scheme(s1mono) xtitle("Age in sui") ytitle("Mean number of uncles with position")
Fixed characteristics of individuals in previous times So far all examples have been characteristics of kin in the same year For analysis of influence of early-life characteristics, can construct measures of interest at one age (e.g. number of brothers when first observed) and copy forward to later records. In some cases, would like to collapse information from multiple records of father, grandfather, etc. to produce a single variable Typical example: did a father or grandfather hold a position at any point in his life – Regardless of whether he is still alive – Indeed, regardless of whether grandfather died before index individual was born
Father, grandfather ever held position use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if SEX == 2 & HAS_POSITION == 1& PRESENT bysort PERSON_ID: keep if _n == 1 rename HAS_POSITION FATHER_EVER_HAD_POSITION keep PERSON_ID FATHER_EVER_HAD_POSITION rename PERSON_ID FATHER_ID save father_ever_held_position rename FATHER_ID GRANDFATHER_ID rename FATHER_EVER_HAD_POSITION GF_EVER_HAD_POSITION save gf_ever_held_position use "C:\Users\Cameron Campbe\Documents\Baqi\CMGPD-LN from ICPSR\ICPSR_27063\DS0001\ Data.dta", clear keep if SEX == 2 & FATHER_ID != "-99" & GRANDFATHER_ID != "-99" keep if PRESENT merge m:1 FATHER_ID using father_ever_held_position, keep(match master) replace FATHER_EVER_HAD_POSITION = 0 if FATHER_EVER_HAD_POSITION ==. drop _merge merge m:1 GRANDFATHER_ID using gf_ever_held_position, keep(match master) drop _merge replace GF_EVER_HAD_POSITION = 0 if GF_EVER_HAD_POSITION ==. generate age_group = 1 + 5*int((AGE_IN_SUI-1)/5) generate ever_married = MARITAL_STATUS != 2 keep if MARITAL_STATUS >= 1 xi:logit HAS_POSITION i.age_group FATHER_EVER_HAD_POSITION GF_EVER_HAD_POSITION if AGE_IN_SUI >= 21 & AGE_IN_SUI = 0
Logistic regression Number of obs = LR chi2(7) = Prob > chi2 = Log likelihood = Pseudo R2 = HAS_POSITION | Coef. Std. Err. z P>|z| [95% Conf. Interval] _Iage_gro~_6 | (omitted) … _Iage_gr~_41 | _Iage_gr~_46 | (omitted) … _Iage_gr~721 | (omitted) FATHER_EVE~N | GF_EVER_HA~N | _cons |