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

Updates for spreg 1.4 #118

Merged
merged 6 commits into from
Sep 19, 2023
Merged

Updates for spreg 1.4 #118

merged 6 commits into from
Sep 19, 2023

Conversation

pedrovma
Copy link
Member

This PR incorporates several new developments into spreg.

Main changes:

  • Refactoring of the output. The way the results from the models are printed to the users has been completely refactored. The new function is simpler and generic. It is based on pandas to create an 'output' attribute to the regression object that contains the most important information on the estimates from the model.
  • Addition of slx_lags to all cross-section models. An argument slx_lags was added to all cross-section models to allow for the direct estimation of SLX models, Spatial Durbin Models (SDM) or GNS models.
  • Creation of wrapper functions for the error models. Both error_sp and error_sp_regimes now have wrapper functions, 'GMM_Error' and 'GMM_Error_Regimes' that allow for easy estimation of error models based on the original Kelejian&Prucha1998 (kp98), homoskedastic (hom) or heteroskedastic (het, the default) estimators. The wrapper functions also allow specifications with extra endogenous variables or a spatial lag of the dependent variable.
  • Several minor updates of fixes were also developed in this commit.

Despite the major changes, this commit does not break any previous code. This update was developed in a private branch by Luc Anselin and Pedro Amaral.

This commit incorporates several developments into spreg.

Main changes:
- Refactoring of the output. The way the results from the models are printed to the users has been completely refactored. The new function is simpler and generic. It is based on pandas to create an 'output' attribute to the regression object that contains the most important information on the estimates from the model.
- Addition of slx_lags to all cross-section models. An attribute slx_lags was added to all cross-section models to allow for the direct estimation of SLX models.
- Creation of wrapper functions for the error models. Both error_sp and error_sp_regimes now have wrapper functions that allow for easy estimation of error models based on the kp98, hom or het estimators. The wrapper functions also allow specifications with extra endogenous variables or spatial lag of the dependent variable.
- Several minor updates of fixes were also developed in this commit.

Despite the major changes, this commit does not break any previous code. This update was developed in a private branch by Luc Anselin and Pedro Amaral.
@knaaptime
Copy link
Member

that failure is a quick fix. It's looking for the master branch on libpysal which no longer exists. Just need to change this line to have @main instead of @master

I can do a PR into your fork if thats easiest

Thanks, Eli! =)
@knaaptime
Copy link
Member

this is nice, thought i havent tested the slx_lags functionality yet. One thing i notice in the new output is that the latex argument doesnt do anything just yet. Might be nice to raise a NotYetImplemented error in the output function at the moment if someone tries to use it. (also, im not sure what you have planned for that, but since output comes back nicely as a pandas dataframe, the to_latex() method right on the df usually works fairly well)

@pedrovma
Copy link
Member Author

this is nice, thought i havent tested the slx_lags functionality yet. One thing i notice in the new output is that the latex argument doesnt do anything just yet. Might be nice to raise a NotYetImplemented error in the output function at the moment if someone tries to use it. (also, im not sure what you have planned for that, but since output comes back nicely as a pandas dataframe, the to_latex() method right on the df usually works fairly well)

Good idea about the message regarding latex, as it is currently just a placeholder argument to be implemented later. The idea is to have the full results printed as latex. The output dataframe only stores the coefficients and their variance. No tests or other statistics are stored there currently.

@knaaptime
Copy link
Member

The idea is to have the full results printed as latex. The output dataframe only stores the coefficients and their variance. No tests or other statistics are stored there currently.

I figured that was probably it. It might be possible to build on something like stargazer to avoid doing it from scratch?

@pedrovma
Copy link
Member Author

pedrovma commented Sep 14, 2023

I figured that was probably it. It might be possible to build on something like stargazer to avoid doing it from scratch?

I didn't know about stargazer. Very nice! I'll look into it before starting. Many thanks!

Except for specific warning messages, I made sure that all text returned to the user is already concentrated in output.py, so it shouldn't be very hard to implement this at some point.

@knaaptime knaaptime merged commit 4ff0b0d into pysal:main Sep 19, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants