4d874309b36dff213fe66475eb7aec6d01bd973d,panel/iv/model.py,IVGMM,fit,#IVGMM#Any#Any#Any#,422
Before Change
cov_estimator = IVGMMCovariance(x, y, z, params, w,
cov_type, **cov_config)
results = {"cov_type": cov_type,
"weight_mat": w,
"weight_type": self._weight_type,
"weight_config": self._weight_type,
"iterations": iters,
"j_stat": self._j_statistic(params, w)}
pe = self._post_estimation(params, cov_estimator)
results.update(pe)
return IVGMMResults(results, self)
After Change
y, x, z = self._y, self._x, self._z
nobs = y.shape[0]
weight_matrix = self._weight.weight_matrix
w = inv(z.T @ z / nobs)
_params = params = self.estimate_parameters(x, y, z, w)
eps = y - x @ params
iters, norm = 1, 10 * tol
while iters < iter_limit and norm > tol:
w = inv(weight_matrix(x, z, eps))
params = self.estimate_parameters(x, y, z, w)
eps = y - x @ params
delta = params - _params
xpz = x.T @ z / nobs
if iters == 1:
v = (xpz @ w @ xpz.T) / nobs
vinv = inv(v)
_params = params
norm = delta.T @ vinv @ delta
iters += 1
cov_estimator = IVGMMCovariance(x, y, z, params, w,
cov_type, **cov_config)
results = self._post_estimation(params, cov_estimator)
gmm_pe = self._gmm_post_estimation(params, w, cov_type, iters)
results.update(gmm_pe)
return IVGMMResults(results, self)
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 7
Instances
Project Name: bashtage/linearmodels
Commit Name: 4d874309b36dff213fe66475eb7aec6d01bd973d
Time: 2017-03-01
Author: kevin.k.sheppard@gmail.com
File Name: panel/iv/model.py
Class Name: IVGMM
Method Name: fit
Project Name: bashtage/linearmodels
Commit Name: afbb6dac2c99789adbec3332b06132624231d4d8
Time: 2017-03-01
Author: kevin.k.sheppard@gmail.com
File Name: panel/iv/model.py
Class Name: IVGMM
Method Name: fit
Project Name: bashtage/linearmodels
Commit Name: afbb6dac2c99789adbec3332b06132624231d4d8
Time: 2017-03-01
Author: kevin.k.sheppard@gmail.com
File Name: panel/iv/model.py
Class Name: IVGMMCUE
Method Name: fit
Project Name: bashtage/linearmodels
Commit Name: 4d874309b36dff213fe66475eb7aec6d01bd973d
Time: 2017-03-01
Author: kevin.k.sheppard@gmail.com
File Name: panel/iv/model.py
Class Name: IVGMM
Method Name: fit
Project Name: bashtage/linearmodels
Commit Name: 4d874309b36dff213fe66475eb7aec6d01bd973d
Time: 2017-03-01
Author: kevin.k.sheppard@gmail.com
File Name: panel/iv/model.py
Class Name: IVGMMCUE
Method Name: fit