BLMEstimator class

class pytwoway.blm.BLMEstimator(params)

Bases: object

Class for estimating BLM using multiple sets of starting values.

Parameters

params (ParamsDict) – dictionary of parameters for BLM estimation. Run tw.blm_params().describe_all() for descriptions of all valid parameters.

fit(jdata, sdata, n_init=20, n_best=5, ncore=1, rng=None)

Estimate BLM using multiple sets of starting values.

Parameters
  • jdata (BipartitePandas DataFrame) – event study or collapsed event study format labor data for movers

  • sdata (BipartitePandas DataFrame) – event study or collapsed event study format labor data for stayers

  • n_init (int) – number of starting values

  • n_best (int) – take the n_best estimates with the highest likelihoods, and then take the estimate with the highest connectedness

  • ncore (int) – number of cores for multiprocessing

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

plot_liks_connectedness(jitter=False, dpi=None)

Plot likelihoods vs connectedness for the estimations run.

Parameters
  • jitter (bool) – if True, jitter points to prevent overlap

  • dpi (float or None) – dpi for plot

plot_log_earnings(period='first', grid=True, dpi=None)

Plot log-earnings by worker-firm type pairs.

Parameters
  • period (str) – ‘first’ plots log-earnings in the first period; ‘second’ plots log-earnings in the second period; ‘all’ plots the average over log-earnings in the first and second periods

  • grid (bool) – if True, plot grid

  • dpi (float or None) – dpi for plot

plot_type_proportions(period='first', subset='all', dpi=None)

Plot proportions of worker types at each firm class.

Parameters
  • period (str) – ‘first’ plots type proportions in the first period; ‘second’ plots type proportions in the second period; ‘all’ plots the average over type proportions in the first and second periods

  • subset (str) – ‘all’ plots a weighted average over movers and stayers; ‘movers’ plots movers; ‘stayers’ plots stayers

  • dpi (float or None) – dpi for plot