Learn R Programming

rpm (version 0.7-3)

rpm_MLPLE: Fit a Revealed Preference Matchings Model

Description

rpm_MLPLE estimates the parameters of 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).

Usage

rpm_MLPLE(
  formula,
  Xdata,
  Zdata,
  Xid = NULL,
  Zid = NULL,
  pair_id = NULL,
  X_w = NULL,
  Z_w = NULL,
  pair_w = NULL,
  sampled = NULL,
  sampling_design = "stock-flow",
  fixed.margins = fixed.margins,
  control = control.rpm(),
  verbose = FALSE
)

Value

rpm returns an object of class rpm.object

that is a list consisting of the following elements:

coefficients

The bias-corrected bootstrap estimate of \(\theta\), the vector of coefficients for the model parameters. This includes the model \(\beta\) and the model \(\Gamma\).

loglik

The value of the maximized log-likelihood.

exitflag

integer value with the status of the optimization (4 is success as xtol_rel or xtol_abs was reached). Other codes are 1 = generic success; 2 = optimization stopped because ftol_rel or ftol_abs was reached; 3 = optimization stopped because stopval was reached; 4 = optimization stopped because xtol_rel or xtol_abs was reached; 5 = optimization stopped because maxeval was reached; 6 = optimization stopped because maxtime was reached.

call

the call that was made to nloptr.

x0

vector with starting values for the optimization.

message

more informative message with the status of the optimization.

iterations

number of iterations that were executed.

objective

value if the objective function in the solution.

solution

optimal value of the controls.

version

version of NLopt that was used.

covar

Approximate covariance matrix of the estimates.

eq

Values from the equality constraints. Larger values indicate non-convergence.

Arguments

formula

formula; an formula object, of the form ~ <model terms>. For the details on the possible <model terms>, see rpm-terms.

Xdata

data.frame for women. Each row is a woman, each column is a variable on that women or her partnerships. It must contain the women's ID variable (see Xid) and a variable with the ID of the women's partner. If the women is single the men's ID should be NA.

Zdata

data.frame for men. Each row is a man, each column is a variable on that men It must contain the men's ID variable (see Zid).

Xid

string The name of the variable in Xdata containing the IDs of the women.

Zid

string The name of the variable in Zdata containing the IDs of the men.

pair_id

string The name of the variable in Xdata containing the ID of the men paired with the women in Xid. If the women is not paired it must be NA.

X_w

string The name of the variable in Xdata containing the individual weight of the women. If this is NULL then it is assumed the sample is unweighted from a population with 2000 women in it.

Z_w

string The name of the variable in Zdata containing the individual weight of the man If this is NULL then it is assumed the sample is unweighted from a population with 2000 men in it.

pair_w

string The name of the variable in Xdata containing the pair weight of that women. If the women is not paired it should be NA. If this is NULL then it is computed from the individual weights using the sampling_design. Note that the pair weights currently do not play a role in the estimation. They do in the quasi-likelihood version of the code. If this is NULL then it is assumed the sample is unweighted from a population with 2000 men in it.

sampled

string The name of the logical variable in Xdata and Zdata containing the indicator that the person was sampled directly (as distinct from being included as the match of a directly sampled person. All single people are directly sampled.

sampling_design

string; The name of the sampling protocol used to select the survey data. Valid values are "stock-flow" (default) (individuals are sampled, data contains both singles and couples); "stock-stock" (households are sampled, each household can be a single or a couple); "census" (the sample is a census of the population of people).

fixed.margins

list If not NULL the numbers of men and women (i.e, in pmfW and pmfM) are assumed determined by outside information and are hence fixed. In this case fixed.margins should be a list with two elements. The first is a vector of women's margins for each type and the second is the men's margins for each type. The default, NULL, means these are estimated from sample data.

control

A list of control parameters for algorithm tuning. Constructed using control.rpm, which should be consulted for specifics.

verbose

logical; if this is TRUE, the program will print out additional information, including data summary statistics.

Details

It is usually called via the rpm function.

The pairings are determined by the pair_id variable in Xdata. If that variable is NA then the women is assumed to be single. If men are listed in Zdata and are not partnered then they are assumed single. Weights are specified by three optional variables in Xdata.

X_w

: This is character string of the name of the weight variable for women. The sum of the weights should be the number of women in the population.

Z_w

: This is character string of the name of the weight variable for men. The sum of the weights should be the number of men in the population.

pair_w

: This is character string of the name of the weight variable for pairs.

References

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")

See Also

control.rpm, summary.rpm, print.rpm

Examples

Run this code
library(rpm)
# \donttest{
data(fauxmatching)
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",sampling_design="stock-flow")
summary(fit)
# }

Run the code above in your browser using DataLab