statsmodels / statsmodels/statsmodels
caseweights when test function doesn't support it
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.6k
- Forks
- 3.6k
- Avg merge
- 7h 37m
- Merged PRs (30d)
- 96
Description
weightstats explicitly calculates statistics with taking weights into account, the "repeat" array is never used.
I dropped levene as method, because scipy.stats.levene doesn't support weights. The cheap (in terms of code) way out is to create the full repeat array and use it for those functions.
SPSS manual describes that they are doing this (after rounding of the weights to integers).
possible problem: because of the rounding nobs of expanded array might not be the same as round(sum(weights)) if weights are not integers. Maybe add or take away one random observation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with weightstats and trace how its statistics currently use weights, then compare the unsupported-method path with scipy.stats.levene. Review the SPSS manual behavior and determine the expected handling of rounded weights and expanded-array observation counts; done means the affected test functions consistently support weighted input under that defined behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100