Skip to content

Commit ccdcf7d

Browse files
authored
Merge pull request #171 from bashtage/fix-parzen-weight
Fix parzen weights
2 parents 09ba36c + 0fc39a4 commit ccdcf7d

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

doc/source/changes.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Change Log
22
----------
33

4+
Version 4.10
5+
============
6+
* Fixed a bug where weights were incorrectly calculated for HAC covariances
7+
when the weight function was `parzen` or `gallant` (:issue:`170`)
8+
49
Version 4.9
510
===========
611
* Changed the return type of Wooldridge's over identification test when
@@ -60,4 +65,4 @@ Version 2.0
6065
Version 1.0
6166
===========
6267
* Added Instrumental Variable estimators -- 2SLS, LIML and
63-
k-class, GMM and continuously updating GMM.
68+
k-class, GMM and continuously updating GMM.

linearmodels/iv/covariance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def kernel_weight_parzen(bw, *args):
168168
"""
169169
z = arange(bw + 1) / (bw + 1)
170170
w = 1 - 6 * z ** 2 + 6 * z ** 3
171-
w[z > 0.5] = 2 * (1 - z[z > 0.5] ** 3)
171+
w[z > 0.5] = 2 * (1 - z[z > 0.5]) ** 3
172172
return w
173173

174174

linearmodels/tests/iv/test_covariance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def w(k):
5555
for i in range(k + 1):
5656
z = i / (k + 1)
5757
if z > 0.5:
58-
w[i] = 2 * (1 - z ** 3)
58+
w[i] = 2 * (1 - z) ** 3
5959
else:
6060
w[i] = 1 - 6 * z ** 2 + 6 * z ** 3
6161
return w

0 commit comments

Comments
 (0)