Skip to content

Added asarray for count and nobs - #2779

Closed
dhpiyush wants to merge 2 commits into
statsmodels:masterfrom
dhpiyush:fourth
Closed

dhpiyush wants to merge 2 commits into
statsmodels:masterfrom
dhpiyush:fourth

Conversation

@dhpiyush

Copy link
Copy Markdown
Contributor

fix #2734

Comment thread statsmodels/stats/proportion.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space around operators like = (except **)

the main part of #2734 needs to handle scalar nobs
simple would be to add

if nobs.size == 1:
    nobs = nobs * np.ones(len(count))

(I haven't checked if vectorized would work.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@josef-pkt Sorry i forgot to put space around = , i will keep that in mind .

What if the nobs.size is not equal to 1 , and the also the shape of counts and nobs are different . So should it raise a ValueError ??

Also i was getting error while trying to vectorize it .

So should i make a PR by adding if condition when nobs.size=1 and raising error when shape is different of count and nobs ??

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add this to this PR. Yes, if nobs is not scalar and not the same shape as count, then we should raise a ValueError.

You could also check the unit tests to see how much of this is covered.

full vectorization will require more work, and checking to see how it is supposed to be interpreted, and would be too much for this PR

bashtage added a commit to bashtage/statsmodels that referenced this pull request Jun 21, 2016
Correctly handle difference cases
Add tests for related cases
Add error for incorrect usage

closes statsmodels#2969
closes statsmodels#2779
@bashtage bashtage added the rejected Used for PRs with changes that are not acceptable label Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rejected Used for PRs with changes that are not acceptable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG/ENH: proportions_ztest with 2d count

3 participants