Beta Estimation Functions#

estimate_beta_j.py modules

ogusa.estimate_beta_j#

This script uses simulated method of moments estimator to estimate the beta_j parameters for OG-USA.

ogusa.estimate_beta_j.VCV_moments(scf, n, bin_weights, J)[source]#

Compute variance-covariance matrix for wealth moments by bootstrapping data.

Parameters:
  • scf (Pandas DataFrame) – raw data from SCF

  • n (int) – number of bootstrap iterations to run

  • bin_weights (array-like) – ability weights (Jx1 array)

  • J (int) – number of ability groups

Returns:

variance-covariance matrix of wealth moments,

(J+2xJ+2) array

Return type:

VCV (Numpy array)

ogusa.estimate_beta_j.beta_estimate(beta_initial_guesses, og_spec={}, two_step=False, client=None)[source]#

This function estimates the beta_j parameters using a simulated method of moments estimator that targets moments of the wealth distribution.

Parameters:
  • beta_initial_guesses (array-like) – array of initial guesses for the beta_j parameters

  • og_spec (dict) – any updates to default model parameters

  • two_step (boolean) – whether to use a two-step estimator

  • client (Dask Client object) – dask client for multiprocessing

Returns:

estimates of the beta_j beta_se (array-like): standard errors on the beta_j estimates

Return type:

beta_hat (array-like)

ogusa.estimate_beta_j.calc_moments(ss_output, p)[source]#

This function calculates moments from the SS output that correspond to the data moments used for estimation.

Parameters:
  • dictionary (ss_output =)

  • model (variables from SS of)

  • p (OG-USA Specifications object) – model parameters

Returns:

Array of model moments

Return type:

model_moments (array-like)

ogusa.estimate_beta_j.compute_se(beta_hat, W, K, p, h=0.01, client=None)[source]#

Function to compute standard errors for the SMM estimator.

Parameters:
  • beta_hat (array-like) – estimates of beta parameters

  • W (Numpy array) – weighting matrix

  • K (int) – number of moments

  • p (OG-USA Specifications object) – model parameters

  • h (scalar) – percentage to move parameters for numerical derivatives

  • client (Dask Client object) – Dask client

Returns:

standard errors for beta estimates VCV_params (Numpy array): VCV matrix for parameter estimates

Return type:

beta_se (array-like)

ogusa.estimate_beta_j.compute_weighting_matrix(p, optimal_weight=False)[source]#

Function to compute the weighting matrix for the GMM estimator.

Parameters:
  • p (OG-USA Specifications object) – model parameters

  • optimal_weight (boolean) – whether to use an optimal weighting matrix or not

Returns:

Weighting matrix

Return type:

W (Numpy array)

ogusa.estimate_beta_j.minstat(beta_guesses, *args)[source]#

This function generates the weighted sum of squared differences between the model and data moments.

Parameters:
  • beta_guesses (array-like) – a vector of length J with the betas

  • args (tuple) – length 6 tuple, variables needed for minimizer

Returns:

weighted, squared deviation between data and

model moments

Return type:

distance (scalar)