statsmodels/statsmodels — pull request #1208 by hmgaudecker (2013-11-26 14:24:30+00:00)
Title: Fixed bug in uniform kernel

The previous implementation returned a scalar instead of an array (in contrast to all other kernels) and made, for example, KDEUniform's fit method fail.

Example for the bug:

```python
data = np.random.randn(10)
kde = sm.nonparametric.KDEUnivariate(data)
kde.fit(kernel='uni', bw=1.0, gridsize=10, fft=False)
```

```python.traceback
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
1 data = np.random.randn(10)
2 kde = sm.nonparametric.KDEUnivariate(data)
----> 3 kde.fit(kernel='uni', bw=1.0, gridsize=10, fft=False)

/home/xxx/anaconda/envs/py33/lib/python3.3/site-packages/statsmodels/nonparametric/kde.py in fit(self, kernel, bw, fft, weights, gridsize, adjust, cut, clip)
144 density, grid, bw = kdensity(endog, kernel=kernel, bw=bw,
145 adjust=adjust, weights=weights, gridsize=gridsize,
--> 146 clip=clip, cut=cut)
147 self.density = density
148 self.support = grid

/home/xxx/anaconda/envs/py33/lib/python3.3/site-packages/statsmodels/nonparametric/kde.py in kdensity(X, kernel, bw, weights, gridsize, adjust, clip, cut, retgrid)
361 domain_mask = (k < z_lo) | (k > z_high)
362 k = kern(k) # estimate density
--> 363 k[domain_mask] = 0
364 else:
365 k = kern(k) # estimate density

TypeError: 'float' object does not support item assignment
```

This "test" passes after the fix; I don't have time right now to go beyond it.