Learn R Programming

rpm (version 0.7-3)

microsimulate: Micro simulate a population from a Revealed Preference Matchings Model

Description

microsimulate simulates a population of the pairs and singles from a Revealed Preference Matchings Model. It is typically based on the estimate from a rpm() call.

Usage

microsimulate(
  object,
  nsim = 1,
  seed = NULL,
  pmfW_N = NULL,
  pmfM_N = NULL,
  large.population = TRUE,
  bootstrap = FALSE,
  control = control.rpm(),
  counts.only = FALSE,
  verbose = FALSE
)

Value

A list of lists, each a simulation from the population. Each of the simulation lists contains components population being a list with components Xdata and Zdata (for use with rpm()).

Arguments

object

list; an object of classrpm that is typically the result of a call to rpm().

nsim

Number of matchings to be randomly drawn from the given model on the set of all matchings / singles.

seed

integer; (Optional) random number seed.

pmfW_N

vector; The population count of the number of women of each type. This should be compatible with the type in the object.

pmfM_N

vector; The population count of the number of men of each type. This should be compatible with the type in the object.

large.population

logical; If TRUE a large population approximation is used to generate the matchings (rather than the individual level generation of utilities). This is much faster and uses a lot less memory. It is TRUE by default. If used, a sample is drawn rather than the population being returned. The sample size is controlled by pmfW_N and pmfM_N.

bootstrap

logical; If TRUE the original population is sampled from. If FALSE the population underlying the fitted model is sampled from.

control

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

counts.only

logical; If TRUE only the matrices of counts and the PMF of the population of households is returned. If FALSE It is FALSE by default.

verbose

logical; Should verbose messages be printed out.

Details

The function requites the numbers of women of each type and the number of men of each type to be specified.

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

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 function simulates a population from such a model.

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

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")
num_women = fit$N*exp(fit$gw)
num_men   = fit$N*exp(fit$gm)
pmfW_N <- round(fit$pmfW * num_women)
pmfM_N <- round(fit$pmfM * num_men)
a <- microsimulate(fit, pmfW_N=pmfW_N, pmfM_N=pmfM_N)
# }

Run the code above in your browser using DataLab