DOC: stats.linregress: split stats/mstats documentation #20547
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reference issue
NA
What does this implement/fix?
The documentation of
scipy.stats.linregress
incorrectly suggests that masked arrays are supported:Masks are silently ignored by this function, so this PR removes the statement. This PR also corrects a typo about the first argument being a 2x2 array; it meant 2xN array, where N is the number of observations.
Also, the documentation of
scipy.stats.mstats.linregress
currently looks like:suggesting that the docstring was supposed to be replaced automatically. I'm not aware of any machinery to do that, so I copied the
scipy.stats.linregress
documentation over and changed the example to usestats.mstats.linregress
instead ofstats.linregress
.Additional information
I decided against adding a mask to the example in the
mstats
version. For one thing, themstats
version of the function offers little value since it simply calls thestats
version after compressing the arrays, so it is not worth much time to maintain it. Also, if nobody noticed that the documentation was missing entirely, it is unlikely that anyone would appreciate an improved example.If we want
scipy.stats.linregress
to be translated to array-API, I think we should deprecate they=None
behavior and makey
a required argument. It's not strictly required, but I think it would be confusing to preserve this behavior when there can be arrays of arbitrary dimensionality. Please indicate whether you agree, and I'll make the change in a separate PR.