Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyFixest 0.10.3 #186

Merged
merged 4 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
Expand Down
6 changes: 6 additions & 0 deletions docs/news.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# News

## PyFixest `0.10.3`

- Allows for white space in the multiway clustering formula.
- Adds documentation for multiway clustering.

## PyFixest `0.10.2`

- Adds support for two-way clustering.
- Adds support for CRV3 inference for Poisson regression.

## PyFixest `0.10.1`

Expand Down
Binary file modified pyfixest/__pycache__/demean.cpython-310.pyc
Binary file not shown.
Binary file modified pyfixest/__pycache__/estimation.cpython-310.pyc
Binary file not shown.
Binary file modified pyfixest/__pycache__/feols.cpython-310.pyc
Binary file not shown.
Binary file modified pyfixest/__pycache__/fepois.cpython-310.pyc
Binary file not shown.
Binary file modified pyfixest/__pycache__/utils.cpython-310.pyc
Binary file not shown.
3 changes: 1 addition & 2 deletions pyfixest/demean.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ def demean_model(
@nb.njit
def _sad_converged(a, b, tol):
for i in range(a.size):
tol -= np.abs(a[i] - b[i])
if tol < 0:
if np.abs(a[i] - b[i]) >= tol:
return False
return True

Expand Down
2 changes: 2 additions & 0 deletions pyfixest/estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def feols(
vcov (Union(str, dict[str, str])): A string or dictionary specifying the type of variance-covariance matrix to use for inference.
If a string, it can be one of "iid", "hetero", "HC1", "HC2", "HC3".
If a dictionary, it should have the format dict("CRV1":"clustervar") for CRV1 inference or dict(CRV3":"clustervar") for CRV3 inference.
For twoway clustering, combine the cluster variables via a "+", i.e. dict(".CRV1":"clustervar1+clustervar2").

ssc (str): A ssc object specifying the small sample correction to use for inference. See the documentation for sscc() for more information.

Expand Down Expand Up @@ -184,6 +185,7 @@ def fepois(
vcov (Union(str, dict[str, str])): A string or dictionary specifying the type of variance-covariance matrix to use for inference.
If a string, it can be one of "iid", "hetero", "HC1", "HC2", "HC3".
If a dictionary, it should have the format dict("CRV1":"clustervar") for CRV1 inference or dict(CRV3":"clustervar") for CRV3 inference.
For twoway clustering, combine the cluster variables via a "+", i.e. dict(".CRV1":"clustervar1+clustervar2").

ssc (string): A ssc object specifying the small sample correction to use for inference. See the documentation for sscc() for more information.

Expand Down
3 changes: 2 additions & 1 deletion pyfixest/feols.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ def _check_vcov_input(vcov, data):
list(vcov.values())[0], str
), "vcov dict value must be a string"
deparse_vcov = list(vcov.values())[0].split("+")
assert all(col in data.columns for col in deparse_vcov), "vcov dict value must be a column in the data"
assert all(col.replace(" ","") in data.columns for col in deparse_vcov), "vcov dict value must be a column in the data"

assert (
len(deparse_vcov) <= 2
Expand Down Expand Up @@ -1082,6 +1082,7 @@ def _deparse_vcov_input(vcov, has_fixef, is_iv):
deparse_vcov = list(vcov.values())[0].split("+")
if isinstance(deparse_vcov, str):
deparse_vcov = [deparse_vcov]
deparse_vcov = [x.replace(" ", "") for x in deparse_vcov]
elif isinstance(vcov, list):
vcov_type_detail = vcov
elif isinstance(vcov, str):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyfixest"
version = "0.10.2"
version = "0.10.3"


description = "(Not so) experimental draft package for high dimensional fixed effect estimation. Supports OLS, IV and Poisson regression and a range of inference procedures."
Expand Down
Binary file modified tests/__pycache__/test_ses.cpython-310-pytest-7.3.1.pyc
Binary file not shown.
Binary file modified tests/__pycache__/test_vs_fixest.cpython-310-pytest-7.3.1.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/test_vs_fixest.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ def test_twoway_clustering():
for cluster_adj in cluster_adj_options:
for cluster_df in cluster_df_options:

fit1 = feols("Y ~ X1 + X2 ", data=data, vcov = {"CRV1":"f1+f2"}, ssc = ssc(cluster_adj = cluster_adj, cluster_df = cluster_df))
fit2 = feols("Y ~ X1 + X2 ", data=data, vcov = {"CRV3":"f1+f2"}, ssc = ssc(cluster_adj = cluster_adj, cluster_df = cluster_df))
fit1 = feols("Y ~ X1 + X2 ", data=data, vcov = {"CRV1":"f1 +f2"}, ssc = ssc(cluster_adj = cluster_adj, cluster_df = cluster_df))
fit2 = feols("Y ~ X1 + X2 ", data=data, vcov = {"CRV3":" f1+f2"}, ssc = ssc(cluster_adj = cluster_adj, cluster_df = cluster_df))

feols_fit1 = fixest.feols(
ro.Formula("Y ~ X1 + X2"),
Expand Down
Loading