jtloong / chow_test

Python module to calculate time series Chow break statistics.
31 stars 11 forks source link

Add p_value() function to chow_test #2

Closed AlexEngelhardt closed 6 years ago

AlexEngelhardt commented 6 years ago

Hi Joshua,

thanks for your package! I'm using it here, and added a few functions.

This pull request is for the p_value function, which returns a p-value instead of the F statistic.

In the second commit, I also added a parameter to the np.linalg.lstsq call (without changing the results), since that resulted in a warning when using it.

I also edited the test_analysis.ipynb (I just added two lines showing how to use the p_value function).

I have a few other extensions in use already, if you're interested. I have a wrapper function for a pd.Series that splits it into the y1, x1, y2, x2 variables, and another function that plots the -log(p-value) at each position, similar to the Manhattan plots in bioinformatics/computational biology.

Happy to hear your comments.

Cheers,

Alex

jtloong commented 6 years ago

Hi Alex,

Thanks so much for the PR! These changes look great and I'll merge it to master.

Those other extensions sound awesome as well. I'd love to integrate them too.

Glad you're enjoying the package!

Josh