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.
A factor vector giving the categories for the "husband."
A factor vector giving the categories for the "wife."
If set to true, then the ordering of the categories by partner will be ignored.
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.
a factor vector containing the combined categories, with "Endog" set as the reference.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.