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

UnboundLocalError: local variable 'pvalues' referenced before assignment #22

Closed
ghost opened this issue Jun 19, 2021 · 2 comments
Closed

Comments

@ghost
Copy link

ghost commented Jun 19, 2021

Hi, I am trying out factor models and ran into this error:

UnboundLocalError: local variable 'pvalues' referenced before assignment

which is coming from this line

value = pvalues[pvalues.index != "const"].max()

Probably because for my dataset I didn't run into this condition:

if best_pvalue > new_pvalues[i] and cond_1 <= threshold:

maybe an else condition could help to handle it.

Also, is it uncommon for this to occur? Is it a big deal? If so, how do I change my data/factors to ensure this doesn't occur?

@dcajasn
Copy link
Owner

dcajasn commented Jun 19, 2021

Hi, I remember that when I was writing that part I left that code on purpouse because I wanted that an error appears when there is no significant variables among risk factors. Meanwhile I check that part, you should try to add it more risk factors or change the criterion to AIC or BIS.

@ghost
Copy link
Author

ghost commented Jun 24, 2021

will try it out thanks

@ghost ghost closed this as completed Jun 24, 2021
This issue was closed.
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

1 participant