summaryrefslogtreecommitdiff
path: root/python-linearmodels.spec
blob: 9534c9be1e334b0f466164e9f7892165933ba2b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
%global _empty_manifest_terminate_build 0
Name:		python-linearmodels
Version:	4.27
Release:	1
Summary:	Linear Panel, Instrumental Variable, Asset Pricing, and System Regression models for Python
License:	NCSA
URL:		http://github.com/bashtage/linearmodels
Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/ab/db/dcd2f13a06cb7537b65464e3632f731ff6f4db344e0b9d6c8d8e3d95fe62/linearmodels-4.27.tar.gz

Requires:	python3-numpy
Requires:	python3-pandas
Requires:	python3-scipy
Requires:	python3-statsmodels
Requires:	python3-property-cached
Requires:	python3-mypy-extensions
Requires:	python3-Cython
Requires:	python3-pyhdfe
Requires:	python3-formulaic
Requires:	python3-setuptools-scm

%description
# Linear Models

| Metric                     |                                                                                                                                                                                                                                                          |
| :------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Latest Release**         | [![PyPI version](https://badge.fury.io/py/linearmodels.svg)](https://badge.fury.io/py/linearmodels)                                                                                                                                                      |
| **Continuous Integration** | [![Build Status](https://dev.azure.com/kevinksheppard/kevinksheppard/_apis/build/status/bashtage.linearmodels?branchName=main)](https://dev.azure.com/kevinksheppard/kevinksheppard/_build/latest?definitionId=2&branchName=main)                        |
|                            | [![Build status](https://ci.appveyor.com/api/projects/status/7768doy6wrdunmdt/branch/main?svg=true)](https://ci.appveyor.com/project/bashtage/linearmodels/branch/main)                                                                                  |
| **Coverage**               | [![codecov](https://codecov.io/gh/bashtage/linearmodels/branch/main/graph/badge.svg)](https://codecov.io/gh/bashtage/linearmodels)                                                                                                                       |
| **Code Quality**           | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/745a24a69cb2466b95df6a53c83892de)](https://www.codacy.com/manual/bashtage/linearmodels?utm_source=github.com&utm_medium=referral&utm_content=bashtage/linearmodels&utm_campaign=Badge_Grade) |
|                            | [![codebeat badge](https://codebeat.co/badges/aaae2fb4-72b5-4a66-97cd-77b93488f243)](https://codebeat.co/projects/github-com-bashtage-linearmodels-main)                                                                                                 |
|                            | [![Code Quality: Python](https://img.shields.io/lgtm/grade/python/g/bashtage/linearmodels.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/bashtage/linearmodels/context:python)                                                                 |
|                            | [![Total Alerts](https://img.shields.io/lgtm/alerts/g/bashtage/linearmodels.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/bashtage/linearmodels/alerts)                                                                                       |
| **Citation**               | [![DOI](https://zenodo.org/badge/82291672.svg)](https://zenodo.org/badge/latestdoi/82291672)                                                                                                                                                             |

Linear (regression) models for Python. Extends
[statsmodels](http://www.statsmodels.org) with Panel regression,
instrumental variable estimators, system estimators and models for
estimating asset prices:

-   **Panel models**:
    -   Fixed effects (maximum two-way)
    -   First difference regression
    -   Between estimator for panel data
    -   Pooled regression for panel data
    -   Fama-MacBeth estimation of panel models

-   **High-dimensional Regresssion**:
    -   Absorbing Least Squares

-   **Instrumental Variable estimators**
    -   Two-stage Least Squares
    -   Limited Information Maximum Likelihood
    -   k-class Estimators
    -   Generalized Method of Moments, also with continuously updating

-   **Factor Asset Pricing Models**:
    -   2- and 3-step estimation
    -   Time-series estimation
    -   GMM estimation

-   **System Regression**:
    -   Seemingly Unrelated Regression (SUR/SURE)
    -   Three-Stage Least Squares (3SLS)
    -   Generalized Method of Moments (GMM) System Estimation

Designed to work equally well with NumPy, Pandas or xarray data.

## Panel models

Like [statsmodels](http://www.statsmodels.org) to include, supports
formulas for specifying models. For example, the classic Grunfeld regression can be
specified

```python
import numpy as np
from statsmodels.datasets import grunfeld
data = grunfeld.load_pandas().data
data.year = data.year.astype(np.int64)
# MultiIndex, entity - time
data = data.set_index(['firm','year'])
from linearmodels import PanelOLS
mod = PanelOLS(data.invest, data[['value','capital']], entity_effects=True)
res = mod.fit(cov_type='clustered', cluster_entity=True)
```

Models can also be specified using the formula interface.

```python
from linearmodels import PanelOLS
mod = PanelOLS.from_formula('invest ~ value + capital + EntityEffects', data)
res = mod.fit(cov_type='clustered', cluster_entity=True)
```

The formula interface for `PanelOLS` supports the special values
`EntityEffects` and `TimeEffects` which add entity (fixed) and time
effects, respectively.

Formula support comes from the [formulaic](https://github.com/matthewwardrop/formulaic/)
package which is a replacement for [patsy](https://patsy.readthedocs.io/en/latest/).

## Instrumental Variable Models

IV regression models can be similarly specified.

```python
import numpy as np
from linearmodels.iv import IV2SLS
from linearmodels.datasets import mroz
data = mroz.load()
mod = IV2SLS.from_formula('np.log(wage) ~ 1 + exper + exper ** 2 + [educ ~ motheduc + fatheduc]', data)
```

The expressions in the `[ ]` indicate endogenous regressors (before `~`)
and the instruments.

## Installing

The latest release can be installed using pip

```bash
pip install linearmodels
```

The main branch can be installed by cloning the repo and running setup

```bash
git clone https://github.com/bashtage/linearmodels
cd linearmodels
pip install .
```

## Documentation

[Stable Documentation](https://bashtage.github.io/linearmodels/) is
built on every tagged version using
[doctr](https://github.com/drdoctr/doctr).
[Development Documentation](https://bashtage.github.io/linearmodels/devel)
is automatically built on every successful build of main.

## Plan and status

Should eventually add some useful linear model estimators such as panel
regression. Currently only the single variable IV estimators are polished.

-   Linear Instrumental variable estimation - **complete**
-   Linear Panel model estimation - **complete**
-   Fama-MacBeth regression - **complete**
-   Linear Factor Asset Pricing - **complete**
-   System regression - **complete**
-   Linear IV Panel model estimation - _not started_
-   Dynamic Panel model estimation - _not started_

## Requirements

### Running

With the exception of Python 3 (3.8+ tested), which is a hard requirement, the
others are the version that are being used in the test environment. It
is possible that older versions work.

-   Python 3.8+
-   NumPy (1.18+)
-   SciPy (1.3+)
-   pandas (1.0+)
-   statsmodels (0.12+)
-   xarray (0.16+, optional)
-   Cython (0.29.24+, optional)

### Testing

-   py.test

### Documentation

-   sphinx
-   sphinx-material
-   nbsphinx
-   nbconvert
-   nbformat
-   ipython
-   jupyter


%package -n python3-linearmodels
Summary:	Linear Panel, Instrumental Variable, Asset Pricing, and System Regression models for Python
Provides:	python-linearmodels
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
BuildRequires:	python3-cffi
BuildRequires:	gcc
BuildRequires:	gdb
%description -n python3-linearmodels
# Linear Models

| Metric                     |                                                                                                                                                                                                                                                          |
| :------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Latest Release**         | [![PyPI version](https://badge.fury.io/py/linearmodels.svg)](https://badge.fury.io/py/linearmodels)                                                                                                                                                      |
| **Continuous Integration** | [![Build Status](https://dev.azure.com/kevinksheppard/kevinksheppard/_apis/build/status/bashtage.linearmodels?branchName=main)](https://dev.azure.com/kevinksheppard/kevinksheppard/_build/latest?definitionId=2&branchName=main)                        |
|                            | [![Build status](https://ci.appveyor.com/api/projects/status/7768doy6wrdunmdt/branch/main?svg=true)](https://ci.appveyor.com/project/bashtage/linearmodels/branch/main)                                                                                  |
| **Coverage**               | [![codecov](https://codecov.io/gh/bashtage/linearmodels/branch/main/graph/badge.svg)](https://codecov.io/gh/bashtage/linearmodels)                                                                                                                       |
| **Code Quality**           | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/745a24a69cb2466b95df6a53c83892de)](https://www.codacy.com/manual/bashtage/linearmodels?utm_source=github.com&utm_medium=referral&utm_content=bashtage/linearmodels&utm_campaign=Badge_Grade) |
|                            | [![codebeat badge](https://codebeat.co/badges/aaae2fb4-72b5-4a66-97cd-77b93488f243)](https://codebeat.co/projects/github-com-bashtage-linearmodels-main)                                                                                                 |
|                            | [![Code Quality: Python](https://img.shields.io/lgtm/grade/python/g/bashtage/linearmodels.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/bashtage/linearmodels/context:python)                                                                 |
|                            | [![Total Alerts](https://img.shields.io/lgtm/alerts/g/bashtage/linearmodels.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/bashtage/linearmodels/alerts)                                                                                       |
| **Citation**               | [![DOI](https://zenodo.org/badge/82291672.svg)](https://zenodo.org/badge/latestdoi/82291672)                                                                                                                                                             |

Linear (regression) models for Python. Extends
[statsmodels](http://www.statsmodels.org) with Panel regression,
instrumental variable estimators, system estimators and models for
estimating asset prices:

-   **Panel models**:
    -   Fixed effects (maximum two-way)
    -   First difference regression
    -   Between estimator for panel data
    -   Pooled regression for panel data
    -   Fama-MacBeth estimation of panel models

-   **High-dimensional Regresssion**:
    -   Absorbing Least Squares

-   **Instrumental Variable estimators**
    -   Two-stage Least Squares
    -   Limited Information Maximum Likelihood
    -   k-class Estimators
    -   Generalized Method of Moments, also with continuously updating

-   **Factor Asset Pricing Models**:
    -   2- and 3-step estimation
    -   Time-series estimation
    -   GMM estimation

-   **System Regression**:
    -   Seemingly Unrelated Regression (SUR/SURE)
    -   Three-Stage Least Squares (3SLS)
    -   Generalized Method of Moments (GMM) System Estimation

Designed to work equally well with NumPy, Pandas or xarray data.

## Panel models

Like [statsmodels](http://www.statsmodels.org) to include, supports
formulas for specifying models. For example, the classic Grunfeld regression can be
specified

```python
import numpy as np
from statsmodels.datasets import grunfeld
data = grunfeld.load_pandas().data
data.year = data.year.astype(np.int64)
# MultiIndex, entity - time
data = data.set_index(['firm','year'])
from linearmodels import PanelOLS
mod = PanelOLS(data.invest, data[['value','capital']], entity_effects=True)
res = mod.fit(cov_type='clustered', cluster_entity=True)
```

Models can also be specified using the formula interface.

```python
from linearmodels import PanelOLS
mod = PanelOLS.from_formula('invest ~ value + capital + EntityEffects', data)
res = mod.fit(cov_type='clustered', cluster_entity=True)
```

The formula interface for `PanelOLS` supports the special values
`EntityEffects` and `TimeEffects` which add entity (fixed) and time
effects, respectively.

Formula support comes from the [formulaic](https://github.com/matthewwardrop/formulaic/)
package which is a replacement for [patsy](https://patsy.readthedocs.io/en/latest/).

## Instrumental Variable Models

IV regression models can be similarly specified.

```python
import numpy as np
from linearmodels.iv import IV2SLS
from linearmodels.datasets import mroz
data = mroz.load()
mod = IV2SLS.from_formula('np.log(wage) ~ 1 + exper + exper ** 2 + [educ ~ motheduc + fatheduc]', data)
```

The expressions in the `[ ]` indicate endogenous regressors (before `~`)
and the instruments.

## Installing

The latest release can be installed using pip

```bash
pip install linearmodels
```

The main branch can be installed by cloning the repo and running setup

```bash
git clone https://github.com/bashtage/linearmodels
cd linearmodels
pip install .
```

## Documentation

[Stable Documentation](https://bashtage.github.io/linearmodels/) is
built on every tagged version using
[doctr](https://github.com/drdoctr/doctr).
[Development Documentation](https://bashtage.github.io/linearmodels/devel)
is automatically built on every successful build of main.

## Plan and status

Should eventually add some useful linear model estimators such as panel
regression. Currently only the single variable IV estimators are polished.

-   Linear Instrumental variable estimation - **complete**
-   Linear Panel model estimation - **complete**
-   Fama-MacBeth regression - **complete**
-   Linear Factor Asset Pricing - **complete**
-   System regression - **complete**
-   Linear IV Panel model estimation - _not started_
-   Dynamic Panel model estimation - _not started_

## Requirements

### Running

With the exception of Python 3 (3.8+ tested), which is a hard requirement, the
others are the version that are being used in the test environment. It
is possible that older versions work.

-   Python 3.8+
-   NumPy (1.18+)
-   SciPy (1.3+)
-   pandas (1.0+)
-   statsmodels (0.12+)
-   xarray (0.16+, optional)
-   Cython (0.29.24+, optional)

### Testing

-   py.test

### Documentation

-   sphinx
-   sphinx-material
-   nbsphinx
-   nbconvert
-   nbformat
-   ipython
-   jupyter


%package help
Summary:	Development documents and examples for linearmodels
Provides:	python3-linearmodels-doc
%description help
# Linear Models

| Metric                     |                                                                                                                                                                                                                                                          |
| :------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Latest Release**         | [![PyPI version](https://badge.fury.io/py/linearmodels.svg)](https://badge.fury.io/py/linearmodels)                                                                                                                                                      |
| **Continuous Integration** | [![Build Status](https://dev.azure.com/kevinksheppard/kevinksheppard/_apis/build/status/bashtage.linearmodels?branchName=main)](https://dev.azure.com/kevinksheppard/kevinksheppard/_build/latest?definitionId=2&branchName=main)                        |
|                            | [![Build status](https://ci.appveyor.com/api/projects/status/7768doy6wrdunmdt/branch/main?svg=true)](https://ci.appveyor.com/project/bashtage/linearmodels/branch/main)                                                                                  |
| **Coverage**               | [![codecov](https://codecov.io/gh/bashtage/linearmodels/branch/main/graph/badge.svg)](https://codecov.io/gh/bashtage/linearmodels)                                                                                                                       |
| **Code Quality**           | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/745a24a69cb2466b95df6a53c83892de)](https://www.codacy.com/manual/bashtage/linearmodels?utm_source=github.com&utm_medium=referral&utm_content=bashtage/linearmodels&utm_campaign=Badge_Grade) |
|                            | [![codebeat badge](https://codebeat.co/badges/aaae2fb4-72b5-4a66-97cd-77b93488f243)](https://codebeat.co/projects/github-com-bashtage-linearmodels-main)                                                                                                 |
|                            | [![Code Quality: Python](https://img.shields.io/lgtm/grade/python/g/bashtage/linearmodels.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/bashtage/linearmodels/context:python)                                                                 |
|                            | [![Total Alerts](https://img.shields.io/lgtm/alerts/g/bashtage/linearmodels.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/bashtage/linearmodels/alerts)                                                                                       |
| **Citation**               | [![DOI](https://zenodo.org/badge/82291672.svg)](https://zenodo.org/badge/latestdoi/82291672)                                                                                                                                                             |

Linear (regression) models for Python. Extends
[statsmodels](http://www.statsmodels.org) with Panel regression,
instrumental variable estimators, system estimators and models for
estimating asset prices:

-   **Panel models**:
    -   Fixed effects (maximum two-way)
    -   First difference regression
    -   Between estimator for panel data
    -   Pooled regression for panel data
    -   Fama-MacBeth estimation of panel models

-   **High-dimensional Regresssion**:
    -   Absorbing Least Squares

-   **Instrumental Variable estimators**
    -   Two-stage Least Squares
    -   Limited Information Maximum Likelihood
    -   k-class Estimators
    -   Generalized Method of Moments, also with continuously updating

-   **Factor Asset Pricing Models**:
    -   2- and 3-step estimation
    -   Time-series estimation
    -   GMM estimation

-   **System Regression**:
    -   Seemingly Unrelated Regression (SUR/SURE)
    -   Three-Stage Least Squares (3SLS)
    -   Generalized Method of Moments (GMM) System Estimation

Designed to work equally well with NumPy, Pandas or xarray data.

## Panel models

Like [statsmodels](http://www.statsmodels.org) to include, supports
formulas for specifying models. For example, the classic Grunfeld regression can be
specified

```python
import numpy as np
from statsmodels.datasets import grunfeld
data = grunfeld.load_pandas().data
data.year = data.year.astype(np.int64)
# MultiIndex, entity - time
data = data.set_index(['firm','year'])
from linearmodels import PanelOLS
mod = PanelOLS(data.invest, data[['value','capital']], entity_effects=True)
res = mod.fit(cov_type='clustered', cluster_entity=True)
```

Models can also be specified using the formula interface.

```python
from linearmodels import PanelOLS
mod = PanelOLS.from_formula('invest ~ value + capital + EntityEffects', data)
res = mod.fit(cov_type='clustered', cluster_entity=True)
```

The formula interface for `PanelOLS` supports the special values
`EntityEffects` and `TimeEffects` which add entity (fixed) and time
effects, respectively.

Formula support comes from the [formulaic](https://github.com/matthewwardrop/formulaic/)
package which is a replacement for [patsy](https://patsy.readthedocs.io/en/latest/).

## Instrumental Variable Models

IV regression models can be similarly specified.

```python
import numpy as np
from linearmodels.iv import IV2SLS
from linearmodels.datasets import mroz
data = mroz.load()
mod = IV2SLS.from_formula('np.log(wage) ~ 1 + exper + exper ** 2 + [educ ~ motheduc + fatheduc]', data)
```

The expressions in the `[ ]` indicate endogenous regressors (before `~`)
and the instruments.

## Installing

The latest release can be installed using pip

```bash
pip install linearmodels
```

The main branch can be installed by cloning the repo and running setup

```bash
git clone https://github.com/bashtage/linearmodels
cd linearmodels
pip install .
```

## Documentation

[Stable Documentation](https://bashtage.github.io/linearmodels/) is
built on every tagged version using
[doctr](https://github.com/drdoctr/doctr).
[Development Documentation](https://bashtage.github.io/linearmodels/devel)
is automatically built on every successful build of main.

## Plan and status

Should eventually add some useful linear model estimators such as panel
regression. Currently only the single variable IV estimators are polished.

-   Linear Instrumental variable estimation - **complete**
-   Linear Panel model estimation - **complete**
-   Fama-MacBeth regression - **complete**
-   Linear Factor Asset Pricing - **complete**
-   System regression - **complete**
-   Linear IV Panel model estimation - _not started_
-   Dynamic Panel model estimation - _not started_

## Requirements

### Running

With the exception of Python 3 (3.8+ tested), which is a hard requirement, the
others are the version that are being used in the test environment. It
is possible that older versions work.

-   Python 3.8+
-   NumPy (1.18+)
-   SciPy (1.3+)
-   pandas (1.0+)
-   statsmodels (0.12+)
-   xarray (0.16+, optional)
-   Cython (0.29.24+, optional)

### Testing

-   py.test

### Documentation

-   sphinx
-   sphinx-material
-   nbsphinx
-   nbconvert
-   nbformat
-   ipython
-   jupyter


%prep
%autosetup -n linearmodels-4.27

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-linearmodels -f filelist.lst
%dir %{python3_sitearch}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 4.27-1
- Package Spec generated