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

In VARLiNGAM, different behavior with the same data #131

Open
kitahara-neut opened this issue Mar 6, 2024 · 4 comments
Open

In VARLiNGAM, different behavior with the same data #131

kitahara-neut opened this issue Mar 6, 2024 · 4 comments

Comments

@kitahara-neut
Copy link

I ran the following code and an error occurred:

rng = np.random.default_rng(seed=0)
x = rng.random(size=80)
y = 10 * x
df_x_y = pd.DataFrame({'x': x, 'y': y})
lingam.VARLiNGAM(random_state=0).fit(df_x_y)

However, no error occurred when I ran the following code:

df_y_x = pd.DataFrame({'y': y, 'x': x})
lingam.VARLiNGAM(random_state=0).fit(df_y_x)

The results were different even though the data seemed to be the same.

I think this is a bug, but please check it.

@ikeuchi-screen
Copy link
Collaborator

Hi @kitahara-neut,
Thanks for your report.
Please let me know what kind of error you get.

@kitahara-neut
Copy link
Author

Hi @ikeuchi-screen,
I got the following error:

numpy.linalg.LinAlgError: 2-th leading minor of the array is not positive definite

@haraoka-screen
Copy link
Contributor

The API that raises the exception is statsmodels.tsa.vector_ar.var_model.VAR. The behavior depends on its implementation.

@kitahara-neut
Copy link
Author

Hi @haraoka-screen,
Thank you for your survey.

While I understand that the cause is not due to lingam,
I think that the different behavior with the same data is a problem.

In this case, is it okay to trust the results obtained without any errors?

Or, is it expected that errors should occur with the above data?

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

3 participants