piecewise-regression
Advanced tools
+2
-3
@@ -6,3 +6,3 @@ ========================================================== | ||
| :Author: Charlie Pilgrim | ||
| :Version: 1.4.0 | ||
| :Version: 1.4.1 | ||
| :Github: https://github.com/chasmani/piecewise-regression | ||
@@ -51,3 +51,3 @@ :Documentation: https://piecewise-regression.readthedocs.io/en/master/index.html | ||
| The package is tested on Python 3.7, 3.8 and 3.9. | ||
| The package is tested on Python 3.7, 3.8, 3.9 and 3.10. | ||
@@ -115,3 +115,2 @@ Getting started | ||
| ==================================================================================================== | ||
| Davies test for existence of at least 1 breakpoint: p=5.13032e-295 (e.g. p<0.05 means reject null hypothesis of no breakpoints at 5% significance) | ||
@@ -118,0 +117,0 @@ |
| Metadata-Version: 2.1 | ||
| Name: piecewise-regression | ||
| Version: 1.4.0 | ||
| Version: 1.4.1 | ||
| Summary: piecewise (segmented) regression in python | ||
@@ -15,2 +15,3 @@ Home-page: https://github.com/chasmani/piecewise-regression | ||
| Classifier: Programming Language :: Python :: 3.9 | ||
| Classifier: Programming Language :: Python :: 3.10 | ||
| Description-Content-Type: text/markdown | ||
@@ -17,0 +18,0 @@ License-File: LICENSE.txt |
@@ -7,51 +7,2 @@ | ||
| def get_test_statistic(xx_davies, yy_davies, theta): | ||
| """ | ||
| Compute a test statistic for the Davies test for the p-value of existence | ||
| of a breakpoint. Based on Davies(1987) "Hypothesis Testing when a nuisance | ||
| parameter is present only under the alternative". | ||
| All the variables in this function are as named and described in that | ||
| paper. | ||
| :param xx_davies: Data series in x-axis (same axis as the breakpoints). | ||
| :type xx_davies: list of floats | ||
| :param yy_davies: Data series in y-axis. | ||
| :type yy_davies: list of floats | ||
| :param theta: A test value from within the range of data in xx | ||
| :type theta: float | ||
| """ | ||
| n = len(xx_davies) | ||
| s_0 = 0 | ||
| s_1 = 0 | ||
| s_2 = 0 | ||
| s_3 = 0 | ||
| s_4 = 0 | ||
| for x in xx_davies: | ||
| s_0 += x**2 | ||
| if x > theta: | ||
| s_1 += x * (x - theta) | ||
| s_3 += x - theta | ||
| elif x < theta: | ||
| s_2 += x * (x - theta) | ||
| s_4 += x - theta | ||
| a_hat = np.sum(yy_davies) / n | ||
| b_hat = np.sum(xx_davies * yy_davies) / s_0 | ||
| V = s_1 * s_2 / s_0 + s_3 * s_4 / n | ||
| S = 0 | ||
| for i in range(n): | ||
| if xx_davies[i] > theta: | ||
| S += (yy_davies[i] - a_hat - b_hat * xx_davies[i]) * \ | ||
| (xx_davies[i] - theta) | ||
| S = S / (np.sqrt(np.abs(V))) | ||
| return S | ||
| def get_test_statistic_wald(xx, yy, theta): | ||
@@ -58,0 +9,0 @@ |
+2
-1
| Metadata-Version: 2.1 | ||
| Name: piecewise-regression | ||
| Version: 1.4.0 | ||
| Version: 1.4.1 | ||
| Summary: piecewise (segmented) regression in python | ||
@@ -15,2 +15,3 @@ Home-page: https://github.com/chasmani/piecewise-regression | ||
| Classifier: Programming Language :: Python :: 3.9 | ||
| Classifier: Programming Language :: Python :: 3.10 | ||
| Description-Content-Type: text/markdown | ||
@@ -17,0 +18,0 @@ License-File: LICENSE.txt |
+2
-1
@@ -6,3 +6,3 @@ import setuptools | ||
| name="piecewise-regression", | ||
| version="1.4.0", | ||
| version="1.4.1", | ||
| description="piecewise (segmented) regression in python", | ||
@@ -27,2 +27,3 @@ long_description= "piecewise-regression provides tools for fitting " | ||
| "Programming Language :: Python :: 3.9", | ||
| "Programming Language :: Python :: 3.10", | ||
| ], | ||
@@ -29,0 +30,0 @@ packages=setuptools.find_packages(), |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
108589
-1.04%2038
-1.78%