The function rpm
is used to fit a revealed preference model
for men and women of certain
characteristics (or shared characteristics) of people of the opposite sex.
The model assumes a one-to-one stable matching using an observed set of
matchings and a set of (possibly dyadic) covariates to
estimate the parameters for
linear equations of utilities.
It does this using an large-population likelihood based on ideas from Dagsvik (2000), Menzel (2015) and Goyal et al (2023).
No return value, called for side effects.
Terms to rpm
are specified by a formula to represent the
pairings and covariates This is done via a formula
, that is,
an formula object, of the form ~ <term 1> + <term 2> ...
, where
<term 1>
, <term 2>
, etc, are each terms chosen
from the list given below.
absdiff(attr)
(quantitative attribute),
absdiff(attr)
(quantitative attribute)Absolute difference:
The attr
argument specifies a quantitative attribute
This term adds one statistic to the model equaling
abs(attr[i]-attr[j])
for all women-man dyad (i,j).
W_greaterthan(attr)
Women's value greater than the men's value Adds one statistic indicating if the women's value exceeds the men's value.
M_greaterthan(attr)
Men's value greater than the women's value Adds one statistic indicating if the men's value exceeds the women's value.
W_atleast(attr,threshold=0)
Values
greater than or equal to a threshold Adds one statistic
indicating if the women's value of the attribute equals or exceeds
threshold
.
W_atmost(threshold=0)
Values
less than or equal to a threshold Adds one statistic
indicating if the women's value equals or is exceeded by
threshold
.
W_cov(attr)
(quantitative attribute),
W_cov(attr)
(quantitative attribute)
Main effect of a covariate for women:
The attr
argument specifies a quantitative attribute
This term adds a single statistic equaling the
value of attr(i)
for women \(i\) in the dyad.
For categorical attributes,
see W_factor
.
diff(attr)
(quantitative attribute), diff(attr)
(quantitative attribute)Woman's Gap:
The attr
argument specifies a quantitative attribute
This term adds one statistic to the model
being attr[i]-attr[j]
for women \(i\) and man \(j\).
Specifically, it is the excess of the woman's value over the man's value.
WtoM_diff(attr, diff)
(ordinal categorical attribute), WtoM_diff(attr)
(ordinal categorical discrete attribute)Woman's Gap:
The attr
argument specifies a ordinal categorical attribute
This term adds one statistic to the model
being an indicator that attr[i]=attr[j]+diff
for women \(i\) and man \(j\).
Specifically, it indicates if the woman's value is diff
higher than the man's value.
MtoW_diff(attr, diff)
(ordinal categorical attribute), MtoW_diff(attr)
(ordinal categorical discrete attribute)Man's Gap:
The attr
argument specifies a ordinal categorical attribute
This term adds one statistic to the model
being an indicator that attr[j]=attr[i]+diff
for women \(i\) and man \(j\).
Specifically, it indicates if the man's value is diff
higher than the woman's value.
MtoW_diff(attr)
(quantitative attribute), MtoW_diff(attr)
(quantitative attribute)Difference:
The attr
argument specifies a quantitative attribute
This term adds one statistic to the model
attr[j]-attr[i]
for women \(i\) and man \(j\).
W_factor(attr, base=1, levels=-1)
(categorical attribute),
W_factor(attr, base=1, levels=-1)
(categorical attribute)
Factor attribute effect for women:
The attr
argument specifies a categorical attribute
This term adds
multiple statistics to the model, one for each of (a subset of) the
unique values of the attr
attribute. Each of these statistics
indicates if the women's has that attribute.
homophily(attr)
Uniform homophily effect:
The attr
argument specifies a categorical attribute
This term adds one statistic to the model
indicating that the dyad matches on that attribute.
match(attr, diff=FALSE, collapse=NULL)
Attribute-based homophily effect:
The attr
argument specifies a categorical attribute
This term adds one statistic to the model for each categorical level,
unless diff
is set to TRUE
, in which case the term adds multiple
statistics to the model, one for each of (a subset of) the unique values of the attr
attribute.
If diff
is set to TRUE
, the optional argument collapse
control what dyads
are collapsed (or pooled).
Specifically, it is a list of indices of attribute values which are to be collapsed into a
single term. For example, collapse=list(c(1,4))
will collapse the (1,1)
and the
(4,4)
dyads into a single term (and group). Multiple lists can be included with arbitrary numbers of
dyads in a group.
mix(attr, base=NULL, collapse=NULL)
Attribute mixing: The attr
argument specifies a categorical attributes
By default, this term adds one statistic to
the model for each possible pairing of attribute values. The
statistic indicates if the dyad
has that pairing of values.
In other words, this term produces one statistic for
every entry in the mixing matrix for the attribute(s). The ordering of
the attribute values is lexicographic: alphabetical (for nominal categories) or
numerical (for ordered categories).
The optional argument base
control what statistics are
included in the model, specifically it lists the index of the omitted terms (in order).
For example, base=2
omits the second term.
The optional argument collapse
control what dyads are collapsed (or pooled).
Specifically, it is a list of lists. Each element of the list is a list of dyads which are to be collapsed into a
single term. For example, collapse=list(list(c(1,4),c(2,4)))
will collapse the (1,4)
and the
(2,4)
dyads into a single term (and group). Multiple lists can be included with arbitrary numbers of
dyads in a group.
The model represents the dyadic utility functions as deterministic linear utility functions of
dyadic variables. These utility functions are functions of observed characteristics of the women
and men.
These functions are entered as terms in the function call
to rpm
. This page describes the possible terms (and hence
linear utility functions) included in rpm
package.
Goyal, Shuchi; Handcock, Mark S.; Jackson, Heide M.; Rendall, Michael S. and Yeung, Fiona C. (2023). A Practical Revealed Preference Model for Separating Preferences and Availability Effects in Marriage Formation, Journal of the Royal Statistical Society, A. tools:::Rd_expr_doi("10.1093/jrsssa/qnad031")
Dagsvik, John K. (2000) Aggregation in Matching Markets International Economic Review,, Vol. 41, 27-57. JSTOR: https://www.jstor.org/stable/2648822, tools:::Rd_expr_doi("10.1111/1468-2354.00054")
Menzel, Konrad (2015). Large Matching Markets as Two-Sided Demand Systems Econometrica, Vol. 83, No. 3 (May, 2015), 897-941. tools:::Rd_expr_doi("10.3982/ECTA12299")
rpm
package,
rpm
library(rpm)
data(fauxmatching)
# \donttest{
fit <- rpm(~match("edu") + WtoM_diff("edu",3),
Xdata=fauxmatching$Xdata, Zdata=fauxmatching$Zdata,
X_w="X_w", Z_w="Z_w",
pair_w="pair_w", pair_id="pair_id", Xid="pid", Zid="pid",
sampled="sampled")
summary(fit)
# }
Run the code above in your browser using DataLab