SimBLM class

class pytwoway.simblm.SimBLM(sim_params=None)

Bases: object

Class of SimBLM, where SimBLM simulates a bipartite BLM network of firms and workers.

Parameters

sim_params (ParamsDict) – dictionary of parameters for simulating data. Run tw.sim_blm_params().describe_all() for descriptions of all valid parameters. None is equivalent to tw.sim_blm_params().

simulate(return_parameters=False, rng=None)

Simulate data (movers and stayers). All firms have the same expected size. Columns are as follows: y1/y2=wage; j1/j2=firm id; g1/g2=firm type; l=worker type.

Parameters
  • return_parameters (bool) – if True, return tuple of (simulated data, simulated parameters); otherwise, return only simulated data

  • rng (np.random.Generator) – NumPy random number generator; None is equivalent to np.random.default_rng(None)

Returns

sim_data gives {‘jdata’: movers BipartiteDataFrame, ‘sdata’: stayers BipartiteDataFrame}, while sim_params gives {‘A1’: A1, ‘A2’: A2, ‘S1’: S1, ‘S2’: S2, ‘pk1’: pk1, ‘pk0’: pk0, ‘A1_cat’: A1_cat, ‘A2_cat’: A2_cat, ‘S1_cat’: S1_cat, ‘S2_cat’: S2_cat, ‘A1_cts’: A1_cts, ‘A2_cts’: A2_cts, ‘S1_cts’: S1_cts, ‘S2_cts’: S2_cts}; if return_parameters=True, returns (sim_data, sim_params); if return_parameters=False, returns sim_data

Return type

(dict or tuple of dicts)