You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to estimate the parameters to fit the tax functions in Problem Set 9 and to do weighted least squares, you will need to use generalized method of moments. I have a notebook for doing GMM in Python.
Let your error vector be eps_i and let your vector of population weights be w_i, and let theta be your vector of parameters to estimate. The GMM estimation problem, stated as a minimization problem is the following. Choose the vector of parameters to minimize the weighted sum of squared errors.
sum_i [ w_i *(eps_i ** 2) ]
You can substitute in the expression for eps_i in terms of paramters theta and data TotInc. In the linear case in Exercise 1a, the objective function being minimized is:
You can write a criterion function that takes as arguments the values of the parameters and the data and returns the value of the criterion function at those values.
defcriterion_lin(beta_vec, *args):
''' -------------------------------------------------------- Criterion function as a function of parameters and data -------------------------------------------------------- INPUTS: beta_vec = (2,) vector, parameters to be estimated args = length 3 tuple, (ETR, TotInc, weights) OBJECTS CREATED IN THIS FUNCTION: beta_0 = scalar, intercept value of linear function beta_1 = scalar, slope value of linear function ETR = (N,) vector, effective tax rate data vector TotInc = (N,) vector, total income data vector weights = (N,) vector, population weights vector err_vec = (N,) vector, epsilon errors vector crit_val = scalar, criterion value RETURNS: crit_val '''beta_0, beta_1=beta_vecETR, TotInc, weights=argserr_vec=ETR-beta_0-beta_1*TotInccrit_val= (weights* (err_vec**2)).sum()
returncrit_val
In order to estimate the parameters to fit the tax functions in Problem Set 9 and to do weighted least squares, you will need to use generalized method of moments. I have a notebook for doing GMM in Python.
Let your error vector be
eps_i
and let your vector of population weights bew_i
, and lettheta
be your vector of parameters to estimate. The GMM estimation problem, stated as a minimization problem is the following. Choose the vector of parameters to minimize the weighted sum of squared errors.sum_i [ w_i *(eps_i ** 2) ]
You can substitute in the expression for
eps_i
in terms of paramterstheta
and dataTotInc
. In the linear case in Exercise 1a, the objective function being minimized is:sum_i [ w_i * ( {ETR_i - beta_0 - beta_1 * TotInc_i} ** 2)]
You can write a criterion function that takes as arguments the values of the parameters and the data and returns the value of the criterion function at those values.
You can then use scipy.optimize.minimize() to choose values of
beta_0
andbeta_1
that minimize that criterion function. @SophiaMo @jfan3The text was updated successfully, but these errors were encountered: