Skip to content

Commit 2dc4e20

Browse files
authored
Merge pull request #165 from bashtage/rel-4.9
RLS: Release 4.9 commit
2 parents b136d28 + 24841cf commit 2dc4e20

29 files changed

+241
-169
lines changed

.lgtm.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extraction:
2+
python:
3+
index:
4+
exclude:
5+
- versioneer.py
6+
- linearmodels/_version.py

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ env:
2424
matrix:
2525
fast_finish: true
2626
include:
27-
- python: 3.6
27+
- python: 3.5
2828
env:
2929
- PYTHON=3.5
3030
- NUMPY=1.12
@@ -42,15 +42,15 @@ matrix:
4242
- python: 3.6
4343
env:
4444
- PYTHON=3.6
45-
- NUMPY=1.15
46-
- SCIPY=1.1
45+
- NUMPY=1.14
46+
- SCIPY=1
4747
- PANDAS=0.22
4848
- XARRAY=0.10
4949
- DOCBUILD=true
5050
- STATAMODELS=0.9
5151
- python: 3.6
5252
env:
53-
- PYTHON=3.6
53+
- PYTHON=3.7
5454
- NUMPY=1.14
5555
- SCIPY=1.1
5656
- PANDAS=0.23

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[![Build Status](https://travis-ci.org/bashtage/linearmodels.svg?branch=master)](https://travis-ci.org/bashtage/linearmodels)
44
[![codecov](https://codecov.io/gh/bashtage/linearmodels/branch/master/graph/badge.svg)](https://codecov.io/gh/bashtage/linearmodels)
5+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c771bce50a164b6fa71c344b374f140d)](https://www.codacy.com/app/bashtage/linearmodels?utm_source=github.com&utm_medium=referral&utm_content=bashtage/linearmodels&utm_campaign=Badge_Grade)
6+
[![codebeat badge](https://codebeat.co/badges/aaae2fb4-72b5-4a66-97cd-77b93488f243)](https://codebeat.co/projects/github-com-bashtage-linearmodels-master)
57

68
Linear (regression) models for Python. Extends
79
[statsmodels](http://www.statsmodels.org) with Panel regression,

README.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
Linear Models
22
=============
33

4-
`Build Status <https://travis-ci.org/bashtage/linearmodels>`__
5-
`codecov <https://codecov.io/gh/bashtage/linearmodels>`__
4+
|Build Status| |codecov| |Codacy Badge| |codebeat badge|
65

76
Linear (regression) models for Python. Extends
87
`statsmodels <http://www.statsmodels.org>`__ with Panel regression,
@@ -161,3 +160,12 @@ Documentation
161160
- nbformat
162161
- ipython
163162
- jupyter
163+
164+
.. |Build Status| image:: https://travis-ci.org/bashtage/linearmodels.svg?branch=master
165+
:target: https://travis-ci.org/bashtage/linearmodels
166+
.. |codecov| image:: https://codecov.io/gh/bashtage/linearmodels/branch/master/graph/badge.svg
167+
:target: https://codecov.io/gh/bashtage/linearmodels
168+
.. |Codacy Badge| image:: https://api.codacy.com/project/badge/Grade/c771bce50a164b6fa71c344b374f140d
169+
:target: https://www.codacy.com/app/bashtage/linearmodels?utm_source=github.com&utm_medium=referral&utm_content=bashtage/linearmodels&utm_campaign=Badge_Grade
170+
.. |codebeat badge| image:: https://codebeat.co/badges/aaae2fb4-72b5-4a66-97cd-77b93488f243
171+
:target: https://codebeat.co/projects/github-com-bashtage-linearmodels-master

doc/source/changes.rst

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

4-
Since 4.8
5-
=========
4+
Version 4.9
5+
===========
6+
* Changed the return type of Wooldridge's over identification test when
7+
invalid to `InvalidTestStatistic`
8+
* Add typing information to IV models
9+
* Allow optimization parameters to be passed to `IVGMMCUE`
610
* Removed internal use of pandas Panel
711
* Improved performance in panel models when using `from_formula`
812
* Switched to retaining index column names when original input index is named

doc/source/plan.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ System Estimation
4747
=================
4848
* Seemingly Unrelated Regression (SUR) Estimator - :class:`linearmodels.system.model.SUR`
4949

50+
- Multivariate OLS is supported as a special case of SUR. This method does
51+
not perform well on large datasets and should be improved by a special
52+
purpose implementation.
53+
5054
Instrumental Variable Estimators
5155
********************************
5256
* Three-stage Least Squares (3SLS) Estimator - :class:`linearmodels.system.model.IV3SLS`

linearmodels/compat/pandas.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
from distutils.version import LooseVersion
2+
3+
import pandas as pd
4+
5+
PD_LT_023 = LooseVersion(pd.__version__) < LooseVersion('0.23')
6+
7+
8+
def concat(*args, **kwargs):
9+
"""
10+
Shim around pandas concat that passes sort if allowed
11+
12+
See pandas.compat
13+
"""
14+
if PD_LT_023 and 'sort' in kwargs:
15+
kwargs = kwargs.copy()
16+
del kwargs['sort']
17+
elif not PD_LT_023:
18+
if 'sort' not in kwargs:
19+
kwargs = kwargs.copy()
20+
kwargs['sort'] = False
21+
22+
return pd.concat(*args, **kwargs)
23+
24+
125
try:
226
from pandas.api.types import (is_numeric_dtype, is_categorical,
327
is_string_dtype, is_categorical_dtype,
@@ -24,11 +48,6 @@ def is_string_like(obj):
2448
is_categorical, is_categorical_dtype,
2549
is_datetime64_any_dtype, is_string_like)
2650

27-
try:
28-
from pandas.testing import assert_frame_equal, assert_series_equal
29-
except ImportError:
30-
from pandas.util.testing import assert_frame_equal, assert_series_equal
31-
3251
__all__ = ['is_string_dtype', 'is_numeric_dtype', 'is_categorical',
3352
'is_string_like', 'is_categorical_dtype', 'is_datetime64_any_dtype',
34-
'assert_frame_equal', 'assert_series_equal']
53+
'concat']

linearmodels/iv/data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from linearmodels.compat.pandas import (is_categorical, is_categorical_dtype,
1010
is_numeric_dtype, is_string_dtype,
11-
is_string_like)
11+
is_string_like, concat)
1212

1313
dim_err = '{0} has too many dims. Maximum is 2, actual is {1}'
1414
type_err = 'Only ndarrays, DataArrays and Series and DataFrames are supported'
@@ -25,7 +25,7 @@ def convert_columns(s, drop_first):
2525
def expand_categoricals(x, drop_first):
2626
if x.shape[1] == 0:
2727
return x
28-
return pd.concat([convert_columns(x[c], drop_first) for c in x.columns], axis=1)
28+
return concat([convert_columns(x[c], drop_first) for c in x.columns], axis=1)
2929

3030

3131
class IVData(object):

linearmodels/panel/data.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
import numpy as np
44
import pandas as pd
5-
from numpy import ndarray
65
from pandas import DataFrame, Panel, Series
76

87
from linearmodels.compat.numpy import lstsq
98
from linearmodels.compat.pandas import (is_categorical,
109
is_datetime64_any_dtype,
1110
is_numeric_dtype, is_string_dtype,
12-
is_string_like)
11+
is_string_like, concat)
1312
from linearmodels.utility import ensure_unique_column, panel_to_frame
1413

1514
__all__ = ['PanelData']
@@ -90,7 +89,7 @@ def convert_columns(s, drop_first):
9089

9190

9291
def expand_categoricals(x, drop_first):
93-
return pd.concat([convert_columns(x[c], drop_first) for c in x.columns], axis=1)
92+
return concat([convert_columns(x[c], drop_first) for c in x.columns], axis=1)
9493

9594

9695
class PanelData(object):
@@ -153,7 +152,7 @@ def __init__(self, x, var_name='x', convert_dummies=True, drop_first=True, copy=
153152
x = x.dataframe
154153
self._original = x
155154

156-
if not isinstance(x, (Series, DataFrame, Panel, ndarray)):
155+
if not isinstance(x, (Series, DataFrame, Panel, np.ndarray)):
157156
try:
158157
from xarray import DataArray
159158
if isinstance(x, DataArray):
@@ -191,7 +190,7 @@ def __init__(self, x, var_name='x', convert_dummies=True, drop_first=True, copy=
191190
self._frame = DataFrame({var_name: x.T.stack(dropna=False)})
192191
else:
193192
self._frame = x.swapaxes(1, 2).to_frame(filter_observations=False)
194-
elif isinstance(x, ndarray):
193+
elif isinstance(x, np.ndarray):
195194
if x.ndim not in (2, 3):
196195
raise ValueError('2 or 3-d array required for numpy input')
197196
if x.ndim == 2:

linearmodels/panel/results.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import datetime as dt
22

33
import numpy as np
4-
from numpy import diag, sqrt
54
from pandas import DataFrame, Series, concat
65
from scipy import stats
76
from statsmodels.iolib.summary import SimpleTable, fmt_2cols, fmt_params
@@ -67,7 +66,7 @@ def cov(self):
6766
@property
6867
def std_errors(self):
6968
"""Estimated parameter standard errors"""
70-
return Series(sqrt(diag(self.cov)), self._var_names, name='std_error')
69+
return Series(np.sqrt(np.diag(self.cov)), self._var_names, name='std_error')
7170

7271
@property
7372
def tstats(self):

0 commit comments

Comments
 (0)