createExogamyTerms: Create exogamy terms from partner's characteristics

View source: R/fakeunion_functions.r

createExogamyTermsR Documentation

Create exogamy terms from partner's characteristics

Description

This function will calculate a variable that combines two identical factor variables for each partner, replacing all cases where partners match to a reference category of endogamous unions.

Usage

createExogamyTerms(varh, varw, symmetric = FALSE)

Arguments

varh

A factor vector giving the categories for the "husband."

varw

A factor vector giving the categories for the "wife."

symmetric

If set to true, then the ordering of the categories by partner will be ignored.

Details

This function operates much like the interaction function to combine partner characteristics. The function assumes that the two variables being combined are identical categorical variables for each partner (e.g. husband's and wife's education, husband's and wife's race). It differs from a basic interaction in two ways. First, any cases where husband and wife have the same category will be recorded as the "Endog" category and will be set to the reference. Second, users can specify that terms should be symmetric such that couples are put in the same exogamous category without respect to whether it was the husband or wife who belonged to the specific categories. For example, if symmetric, then the category for white husbands and black wives would be the same as for black husbands and white wives.

Value

a factor vector containing the combined categories, with "Endog" set as the reference.

Examples

 market <- generateCouples(3,acs.couples,
                          acs.malealters,acs.femalealters,
                          "state",weight="perwt")
 market$rexog <- createExogamyTerms(market$raceh, market$racew)
 market$rexog.sym <- createExogamyTerms(market$raceh, market$racew, symmetric=TRUE)
 levels(market$rexog)
 levels(market$rexog.sym)

 ## Not run: 
 require(survival)
 clogit(choice~rexog+strata(group), data=market)
 clogit(choice~rexog.sym+strata(group), data=market)
 
## End(Not run)

AaronGullickson/fakeunion documentation built on Aug. 6, 2023, 7:19 p.m.