@@ -643,38 +643,38 @@ However, for reading convenience, most of the examples show sorted sequences.
643643
644644 .. versionadded :: 3.10
645645
646- .. function :: linear_regression(independent_variable, dependent_variable )
646+ .. function :: linear_regression(x, y, / )
647647
648648 Return the slope and intercept of `simple linear regression
649649 <https://en.wikipedia.org/wiki/Simple_linear_regression> `_
650650 parameters estimated using ordinary least squares. Simple linear
651651 regression describes the relationship between an independent variable *x * and
652652 a dependent variable *y * in terms of this linear function:
653653
654- *y = intercept + slope \* x + noise *
654+ *y = slope \* x + intercept + noise *
655655
656656 where ``slope `` and ``intercept `` are the regression parameters that are
657- estimated, and noise represents the
657+ estimated, and `` noise `` represents the
658658 variability of the data that was not explained by the linear regression
659659 (it is equal to the difference between predicted and actual values
660- of dependent variable).
660+ of the dependent variable).
661661
662662 Both inputs must be of the same length (no less than two), and
663- the independent variable *x * needs not to be constant;
664- otherwise :exc: `StatisticsError ` is raised.
663+ the independent variable *x * cannot be constant;
664+ otherwise a :exc: `StatisticsError ` is raised.
665665
666666 For example, we can use the `release dates of the Monty
667- Python films <https://en.wikipedia.org/wiki/Monty_Python#Films> `_, and used
668- it to predict the cumulative number of Monty Python films
667+ Python films <https://en.wikipedia.org/wiki/Monty_Python#Films> `_
668+ to predict the cumulative number of Monty Python films
669669 that would have been produced by 2019
670- assuming that they kept the pace.
670+ assuming that they had kept the pace.
671671
672672 .. doctest ::
673673
674674 >>> year = [1971 , 1975 , 1979 , 1982 , 1983 ]
675675 >>> films_total = [1 , 2 , 3 , 4 , 5 ]
676676 >>> slope, intercept = linear_regression(year, films_total)
677- >>> round (intercept + slope * 2019 )
677+ >>> round (slope * 2019 + intercept )
678678 16
679679
680680 .. versionadded :: 3.10
0 commit comments