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

StoNED: can not get unconditional expected inefficiency #38

Closed
ds2010 opened this issue Apr 28, 2021 · 8 comments
Closed

StoNED: can not get unconditional expected inefficiency #38

ds2010 opened this issue Apr 28, 2021 · 8 comments
Assignees

Comments

@ds2010
Copy link
Owner

ds2010 commented Apr 28, 2021

Hi @JulianaTa , It seems that there is a bug in StoNED.py when calculating the unconditional expected inefficiency. Please check the following error and fix it. Thanks in advance!

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-8d44572d25fb> in <module>
      1 # retrive the unconditional expected inefficiency \mu
      2 rd = StoNED.StoNED(model)
----> 3 print(model.get_unconditional_expected_inefficiency('KDE'))

AttributeError: 'CNLS' object has no attribute 'get_unconditional_expected_inefficiency'
@ds2010
Copy link
Owner Author

ds2010 commented Apr 28, 2021

Here is the example code:

    # import packages
    from pystoned import CNLS, StoNED
    from pystoned.dataset import load_Finnish_electricity_firm
    from pystoned.constant import CET_MULT, FUN_COST, RTS_VRS, RED_KDE
    
    # import Finnish electricity distribution firms data
    data = load_Finnish_electricity_firm(x_select=['OPEX', 'CAPEX'], y_select=['Energy'])
    
    # build and optimize the CNLS model
    model = CNLS.CNLS(data.y, data.x, z=None, cet=CET_MULT, fun=FUN_COST, rts=RTS_VRS)
    model.optimize('email@address')
    
    # retrive the unconditional expected inefficiency \mu
    rd = StoNED.StoNED(model)
    print(model.get_unconditional_expected_inefficiency('KDE'))

@Fangop
Copy link
Collaborator

Fangop commented Apr 28, 2021

Hi @ds2010
It may be rd.get_unconditional_inefficiency().
😃

@ds2010
Copy link
Owner Author

ds2010 commented Apr 28, 2021

Oh, MG! Thx!

The Line 213: self.get_unconditional_expected_inefficiency(method), is it redundant? Can I remove it?

@Fangop
Copy link
Collaborator

Fangop commented Apr 28, 2021

It'll affect the value of the sigma_mu.
If we first calculate the unconditional_expected_inefficiency() by KDE.
Then, we try to retrieve the frontier with MOM, the removing will leads to error.

@Fangop
Copy link
Collaborator

Fangop commented Apr 28, 2021

Did you consider about DDF with the get_frontier?

@ds2010
Copy link
Owner Author

ds2010 commented Apr 28, 2021

Did you consider about DDF with the get_frontier?

For sake of simplicity, I think we need to make a restriction on output y. If the model only contains one output, we can let it into the StoNED.py, otherwise not. Multiple outputs (i.e., y is a matrix) make the decomposition more complicated. What do you think?

@Fangop
Copy link
Collaborator

Fangop commented Apr 30, 2021

First of all, the StoNED have been designed considering CNLS, CNLSG, and also CNLSDDF.
I don't think inconsistent design of methods good....
Maybe we can remove the get_frontier in StoNED, since we have the get_frontier method in CNLS/CNLS+G and others.
The StoNED class should stick to the residual decomposition and maybe related methods.
My opinion is to sort out the class and method now, maybe not to expand the project more....

@ds2010
Copy link
Owner Author

ds2010 commented May 2, 2021

The StoNED frontier (get_frontier) is different from the CNLS frontier (which is actually the CNLS estimated function). So, we should keep it in the StoNED.py.
In the DDF framework, I realized that we can only estimate the unexpected conditional mean \mu, but can not estimate the conditional mean 𝐸(𝑢𝑖|𝜀𝑖) using the JLMS estimator. We could leave it for further research.

@ds2010 ds2010 closed this as completed May 2, 2021
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

No branches or pull requests

2 participants