This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients rhettinger, steven.daprano
Date 2021-11-09.15:16:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1636470983.21.0.286113384782.issue45766@roundup.psfhosted.org>
In-reply-to
Content
Signature:

    def linear_regression(x, y, /, *, proportional=False):

Additional docstring with example:

    If *proportional* is true, the independent variable *x* and the
    dependent variable *y* are assumed to be directly proportional.
    The data is fit to a line passing through the origin.

    Since the *intercept* will always be 0.0, the underlying linear
    function simplifies to:

        y = slope * x + noise

    >>> y = [3 * x[i] + noise[i] for i in range(5)]
    >>> linear_regression(x, y, proportional=True)  #doctest: +ELLIPSIS
    LinearRegression(slope=3.0244754248461283, intercept=0.0)

See Wikipedia entry for regression without an intercept term:
https://en.wikipedia.org/wiki/Simple_linear_regression#Simple_linear_regression_without_the_intercept_term_(single_regressor)

Compare with the *const* parameter in MS Excel's linest() function:
https://support.microsoft.com/en-us/office/linest-function-84d7d0d9-6e50-4101-977a-fa7abf772b6d

Compare with the *IncludeConstantBasis* option in Mathematica:
https://reference.wolfram.com/language/ref/IncludeConstantBasis.html
History
Date User Action Args
2021-11-09 15:16:23rhettingersetrecipients: + rhettinger, steven.daprano
2021-11-09 15:16:23rhettingersetmessageid: <1636470983.21.0.286113384782.issue45766@roundup.psfhosted.org>
2021-11-09 15:16:23rhettingerlinkissue45766 messages
2021-11-09 15:16:23rhettingercreate