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

auto regression does not return the *co*variance #317

Closed
mathause opened this issue Oct 3, 2023 · 1 comment · Fixed by #318
Closed

auto regression does not return the *co*variance #317

mathause opened this issue Oct 3, 2023 · 1 comment · Fixed by #318

Comments

@mathause
Copy link
Member

mathause commented Oct 3, 2023

Ok, this is a bit akward, but what I did in #309 was wrong - not in that it leads to a wrong result, but the name is wrong. The AR process returns the variance and not the covariance!

What I found confusing is that once this variance is used to draw auto regression time series, and once the co-variance from another source is used. I should try to make that clearer.

@mathause
Copy link
Member Author

mathause commented Oct 4, 2023

Ok all this confusion is self made :-( Originally there were two code paths for drawing AR samples

  • Before refactoring:
    • uncorrelated samples -> used np.random.normal -> required std
    • correlated samples -> used np.random.multivariate_normal -> required cov
  • After refactoring:
    • uncorrelated samples -> uses np.random.multivariate_normal -> requires 1D cov
    • correlated samples -> uses np.random.multivariate_normal -> requires 2D cov

I am very tempted to just revert and have _fit_auto_regression_xr return std. Especially because I am thinking about splitting the code path again (for performance reasons, see #165).

However, as we average the variability of the residuals (see #307) its better to return them as var. I think...

mathause added a commit to mathause/mesmer that referenced this issue Oct 4, 2023
mathause added a commit that referenced this issue Oct 4, 2023
* fix AR_result ~co~variance (#317)

* changelog

* fix name
veni-vidi-vici-dormivi added a commit to veni-vidi-vici-dormivi/mesmer that referenced this issue Feb 12, 2024
veni-vidi-vici-dormivi added a commit that referenced this issue Feb 13, 2024
* add nobs to AR results

* Changed std to variance in documentation (see #317)

* changed tests to contain nobs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add entry to changelog

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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 a pull request may close this issue.

1 participant