python-stats 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 py-stats Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,391 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-stats
3
+ Version: 1.0.0
4
+ Summary: A pure-Python module providing comprehensive statistics functions
5
+ Home-page: https://github.com/RanaEhtashamAli/py-stats
6
+ Author: Your Name
7
+ Author-email: Your Name <your.email@example.com>
8
+ Maintainer-email: Your Name <your.email@example.com>
9
+ License-Expression: MIT
10
+ Project-URL: Homepage, https://github.com/RanaEhtashamAli/py-stats
11
+ Project-URL: Documentation, https://github.com/RanaEhtashamAli/py-stats#readme
12
+ Project-URL: Repository, https://github.com/RanaEhtashamAli/py-stats.git
13
+ Project-URL: Bug Tracker, https://github.com/RanaEhtashamAli/py-stats/issues
14
+ Keywords: statistics,math,data-analysis,scientific-calculator
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Intended Audience :: Education
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.7
21
+ Classifier: Programming Language :: Python :: 3.8
22
+ Classifier: Programming Language :: Python :: 3.9
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
27
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
28
+ Requires-Python: >=3.7
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: numpy>=1.19.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=6.0; extra == "dev"
34
+ Requires-Dist: pytest-cov>=2.0; extra == "dev"
35
+ Requires-Dist: black>=21.0; extra == "dev"
36
+ Requires-Dist: flake8>=3.8; extra == "dev"
37
+ Requires-Dist: mypy>=0.900; extra == "dev"
38
+ Dynamic: author
39
+ Dynamic: home-page
40
+ Dynamic: license-file
41
+ Dynamic: requires-python
42
+
43
+ # py-stats
44
+
45
+ [![PyPI version](https://badge.fury.io/py/python-stats.svg)](https://badge.fury.io/py/python-stats)
46
+ [![Python 3.7+](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)
47
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
48
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
49
+ [![Status: Complete](https://img.shields.io/badge/status-complete-brightgreen.svg)](https://github.com/RanaEhtashamAli/py-stats)
50
+ [![Functions: 60+](https://img.shields.io/badge/functions-60+-orange.svg)](https://github.com/RanaEhtashamAli/py-stats)
51
+ [![Educational](https://img.shields.io/badge/educational-focus-blue.svg)](https://github.com/RanaEhtashamAli/py-stats)
52
+
53
+ A pure-Python module providing comprehensive statistics functions similar to those found on scientific calculators. This package offers over 60 statistics functions for both univariate and multivariate analysis.
54
+
55
+ **Educational Focus**: Perfect for learning statistics, programming, and data science with clear mathematical implementations and comprehensive examples.
56
+
57
+ ## 📊 Project Status
58
+
59
+ ✅ **Complete and Ready for Use**
60
+
61
+ - **Version**: 2.0.0
62
+ - **Functions**: 60+ statistical functions implemented
63
+ - **Testing**: 100% test coverage with comprehensive unit tests
64
+ - **Documentation**: Complete with examples and mathematical formulas
65
+ - **Educational Value**: High-quality learning resource
66
+ - **License**: MIT License (permissive and open)
67
+ - **Repository**: [GitHub](https://github.com/RanaEhtashamAli/py-stats)
68
+
69
+ ## 🚀 Quick Links
70
+
71
+ - **📦 PyPI Package**: [python-stats on PyPI](https://pypi.org/project/python-stats/)
72
+ - **🐙 GitHub Repository**: [RanaEhtashamAli/py-stats](https://github.com/RanaEhtashamAli/py-stats)
73
+ - **📖 Documentation**: [README](https://github.com/RanaEhtashamAli/py-stats#readme)
74
+ - **🐛 Issues**: [GitHub Issues](https://github.com/RanaEhtashamAli/py-stats/issues)
75
+ - **💬 Discussions**: [GitHub Discussions](https://github.com/RanaEhtashamAli/py-stats/discussions)
76
+
77
+ ## 📋 Table of Contents
78
+
79
+ - [Project Status](#-project-status)
80
+ - [Quick Links](#-quick-links)
81
+ - [Features](#features)
82
+ - [Installation](#installation)
83
+ - [Quick Start](#quick-start)
84
+ - [Documentation](#documentation)
85
+ - [Package Structure](#-package-structure)
86
+ - [Requirements](#requirements)
87
+ - [Testing](#testing)
88
+ - [Performance Notes](#performance-notes)
89
+ - [Educational Focus](#-educational-focus)
90
+ - [License](#license)
91
+ - [Contributing](#contributing)
92
+ - [Acknowledgments](#-acknowledgments)
93
+ - [Support](#-support)
94
+
95
+ ## Features
96
+
97
+ ### Univariate Statistics
98
+ - **Means**: arithmetic, harmonic, geometric, and quadratic means
99
+ - **Central Tendency**: median, mode, midrange, trimean
100
+ - **Angular Statistics**: mean of angular quantities
101
+ - **Averages**: running and weighted averages
102
+ - **Quantiles**: quartiles, hinges, and quantiles
103
+ - **Dispersion**: variance and standard deviation (sample and population)
104
+ - **Deviation Measures**: average deviation and median average deviation (MAD)
105
+ - **Shape**: skewness and kurtosis
106
+ - **Error**: standard error of the mean
107
+ - **Robust Statistics**: winsorized mean, trimmed mean, interquartile range, range, coefficient of variation
108
+ - **Order Statistics**: percentile rank, deciles, percentiles
109
+ - **Shape and Distribution**: coefficient of skewness, coefficient of kurtosis, normality test
110
+ - **Central Tendency Alternatives**: winsorized median, midhinge
111
+ - **Probability and Distribution**: z-score, t-score, percentile from z-score, confidence intervals
112
+ - **Time Series**: moving average, exponential smoothing, seasonal decomposition
113
+
114
+ ### Multivariate Statistics
115
+ - **Correlation**: Pearson's, Spearman's, Kendall's tau, Q-correlation, point-biserial correlation
116
+ - **Covariance**: sample and population covariance
117
+ - **Regression**: simple linear, multiple linear, polynomial regression, residual analysis
118
+ - **Sums**: Sxx, Syy, and Sxy calculations
119
+ - **Association Measures**: chi-square test, Cramer's V, contingency coefficient
120
+
121
+ ## Installation
122
+
123
+ ### From PyPI (Recommended)
124
+ ```bash
125
+ pip install python-stats
126
+ ```
127
+
128
+ ### From GitHub
129
+ ```bash
130
+ pip install git+https://github.com/RanaEhtashamAli/py-stats.git
131
+ ```
132
+
133
+ ### Development Installation
134
+ ```bash
135
+ git clone https://github.com/RanaEhtashamAli/py-stats.git
136
+ cd py-stats
137
+ pip install -e .
138
+ ```
139
+
140
+ ## Quick Start
141
+
142
+ ```python
143
+ import py_stats as ps
144
+
145
+ # Basic statistics
146
+ data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
147
+ print(f"Mean: {ps.arithmetic_mean(data)}")
148
+ print(f"Median: {ps.median(data)}")
149
+ print(f"Standard Deviation: {ps.standard_deviation(data)}")
150
+
151
+ # Robust statistics
152
+ print(f"IQR: {ps.interquartile_range(data)}")
153
+ print(f"Coefficient of Variation: {ps.coefficient_of_variation(data)}")
154
+
155
+ # Multivariate analysis
156
+ x = [1, 2, 3, 4, 5]
157
+ y = [2, 4, 5, 4, 5]
158
+ print(f"Pearson Correlation: {ps.pearson_correlation(x, y)}")
159
+ print(f"Spearman Correlation: {ps.spearman_correlation(x, y)}")
160
+
161
+ # Regression
162
+ slope, intercept, r_squared = ps.linear_regression(x, y)
163
+ print(f"Regression: y = {slope:.2f}x + {intercept:.2f}, R² = {r_squared:.3f}")
164
+ ```
165
+
166
+ ## Documentation
167
+
168
+ ### Univariate Functions
169
+
170
+ #### Means
171
+ - `arithmetic_mean(data)`: Arithmetic mean
172
+ - `harmonic_mean(data)`: Harmonic mean
173
+ - `geometric_mean(data)`: Geometric mean
174
+ - `quadratic_mean(data)`: Quadratic mean (RMS)
175
+
176
+ #### Central Tendency
177
+ - `median(data)`: Median
178
+ - `mode(data)`: Mode
179
+ - `midrange(data)`: Midrange
180
+ - `trimean(data)`: Trimean
181
+
182
+ #### Quantiles
183
+ - `quartiles(data)`: First, second, and third quartiles
184
+ - `hinges(data)`: Lower and upper hinges
185
+ - `quantile(data, q)`: Quantile at specified probability
186
+
187
+ #### Dispersion
188
+ - `variance(data, population=False)`: Variance (sample or population)
189
+ - `standard_deviation(data, population=False)`: Standard deviation
190
+ - `average_deviation(data)`: Average absolute deviation
191
+ - `median_absolute_deviation(data)`: Median absolute deviation (MAD)
192
+
193
+ #### Shape
194
+ - `skewness(data)`: Skewness coefficient
195
+ - `kurtosis(data)`: Kurtosis coefficient
196
+
197
+ #### Robust Statistics
198
+ - `winsorized_mean(data, percent=10.0)`: Winsorized mean
199
+ - `trimmed_mean(data, percent=10.0)`: Trimmed mean
200
+ - `interquartile_range(data)`: Interquartile range (IQR)
201
+ - `range_value(data)`: Range (max - min)
202
+ - `coefficient_of_variation(data)`: Coefficient of variation
203
+
204
+ #### Order Statistics
205
+ - `percentile_rank(data, value)`: Percentile rank of a value
206
+ - `deciles(data)`: All deciles (10th, 20th, ..., 90th percentiles)
207
+ - `percentile(data, p)`: pth percentile (0-100)
208
+
209
+ #### Shape and Distribution
210
+ - `coefficient_of_skewness(data)`: Standardized skewness
211
+ - `coefficient_of_kurtosis(data)`: Standardized kurtosis
212
+ - `simple_normality_test(data)`: Basic normality test
213
+
214
+ #### Central Tendency Alternatives
215
+ - `winsorized_median(data, percent=10.0)`: Winsorized median
216
+ - `midhinge(data)`: Midhinge
217
+
218
+ #### Probability and Distribution
219
+ - `z_score(data, value)`: Z-score of a value
220
+ - `t_score(data, value)`: T-score of a value
221
+ - `percentile_from_z_score(z)`: Percentile from z-score
222
+ - `confidence_interval_mean(data, confidence=0.95)`: Confidence interval for mean
223
+ - `confidence_interval_proportion(successes, total, confidence=0.95)`: Confidence interval for proportion
224
+
225
+ #### Time Series
226
+ - `moving_average(data, window=3)`: Simple moving average
227
+ - `exponential_smoothing(data, alpha=0.3)`: Exponential smoothing
228
+ - `seasonal_decomposition_simple(data, period=4)`: Simple seasonal decomposition
229
+
230
+ #### Specialized
231
+ - `angular_mean(data, degrees=True)`: Mean of angular quantities
232
+ - `running_average(data, window=3)`: Running average
233
+ - `weighted_average(data, weights)`: Weighted average
234
+ - `standard_error_mean(data)`: Standard error of the mean
235
+
236
+ ### Multivariate Functions
237
+
238
+ #### Correlation
239
+ - `pearson_correlation(x, y)`: Pearson's correlation coefficient
240
+ - `spearman_correlation(x, y)`: Spearman's rank correlation
241
+ - `kendall_tau(x, y)`: Kendall's tau correlation
242
+ - `q_correlation(x, y)`: Q-correlation coefficient
243
+ - `point_biserial_correlation(x, y)`: Point-biserial correlation
244
+
245
+ #### Covariance
246
+ - `covariance(x, y, population=False)`: Covariance (sample or population)
247
+
248
+ #### Regression
249
+ - `linear_regression(x, y)`: Simple linear regression
250
+ - `multiple_linear_regression(x_vars, y)`: Multiple linear regression
251
+ - `polynomial_regression(x, y, degree=2)`: Polynomial regression
252
+ - `residual_analysis(x, y)`: Residual analysis
253
+
254
+ #### Sums
255
+ - `sum_xx(x)`: Sum of squared deviations (Sxx)
256
+ - `sum_yy(y)`: Sum of squared deviations (Syy)
257
+ - `sum_xy(x, y)`: Sum of cross-products (Sxy)
258
+
259
+ #### Association Measures
260
+ - `chi_square_test(observed)`: Chi-square test of independence
261
+ - `cramers_v(observed)`: Cramer's V association measure
262
+ - `contingency_coefficient(observed)`: Contingency coefficient
263
+
264
+ ## 📁 Package Structure
265
+
266
+ ```
267
+ py-stats/
268
+ ├── py_stats/
269
+ │ ├── __init__.py # Package initialization (v2.0.0)
270
+ │ ├── univariate.py # 40+ univariate functions
271
+ │ └── multivariate.py # 20+ multivariate functions
272
+ ├── tests/
273
+ │ ├── test_univariate.py # Comprehensive univariate tests
274
+ │ └── test_multivariate.py # Comprehensive multivariate tests
275
+ ├── examples/
276
+ │ ├── basic_usage.py # Basic usage examples
277
+ │ └── advanced_usage.py # Advanced usage examples
278
+ ├── setup.py # Package configuration
279
+ ├── pyproject.toml # Modern packaging config
280
+ ├── README.md # This documentation
281
+ ├── LICENSE # MIT License
282
+ └── .gitignore # Git ignore patterns
283
+ ```
284
+
285
+ ## Requirements
286
+
287
+ - Python 3.7 or higher
288
+ - NumPy 1.19.0 or higher
289
+
290
+ ## License
291
+
292
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
293
+
294
+ ### License Summary
295
+
296
+ The MIT License is a permissive license that allows you to:
297
+ - ✅ Use the software for any purpose
298
+ - ✅ Modify the software
299
+ - ✅ Distribute the software
300
+ - ✅ Distribute modified versions
301
+ - ✅ Use it commercially
302
+
303
+ The only requirement is that the original license and copyright notice must be included in any substantial portions of the software.
304
+
305
+ ## Contributing
306
+
307
+ We welcome contributions to make python-stats even better! Here's how you can help:
308
+
309
+ ### 🤝 How to Contribute
310
+
311
+ 1. **Fork the repository**
312
+ 2. **Create a feature branch**: `git checkout -b feature/amazing-feature`
313
+ 3. **Make your changes** and add tests for new functionality
314
+ 4. **Run the tests**: `python -m pytest tests/ -v`
315
+ 5. **Commit your changes**: `git commit -m 'Add amazing feature'`
316
+ 6. **Push to the branch**: `git push origin feature/amazing-feature`
317
+ 7. **Open a Pull Request**
318
+
319
+ ### 📋 Contribution Guidelines
320
+
321
+ - **Code Style**: Follow PEP 8 and use Black for formatting
322
+ - **Documentation**: Add docstrings for new functions
323
+ - **Tests**: Include tests for new functionality
324
+ - **Educational Focus**: Keep the educational value in mind
325
+ - **Mathematical Accuracy**: Ensure statistical formulas are correct
326
+
327
+ ### 🐛 Reporting Issues
328
+
329
+ If you find a bug or have a feature request, please open an issue on GitHub with:
330
+ - Clear description of the problem
331
+ - Steps to reproduce
332
+ - Expected vs actual behavior
333
+ - Python version and environment details
334
+
335
+ ## Testing
336
+
337
+ Run the test suite:
338
+
339
+ ```bash
340
+ python -m pytest tests/ -v
341
+ ```
342
+
343
+ ## Performance Notes
344
+
345
+ This package is designed for educational purposes and small to medium-sized datasets. For large-scale data analysis, consider using NumPy, SciPy, or Pandas for better performance.
346
+
347
+ ## 🎓 Educational Focus
348
+
349
+ This package is specifically designed for educational purposes and serves as an excellent resource for:
350
+
351
+ ### 📚 Learning Applications
352
+ - **Statistics Courses**: Covers undergraduate statistics curriculum
353
+ - **Programming Education**: Demonstrates Python package development
354
+ - **Research Methods**: Practical statistical analysis tools
355
+ - **Data Science**: Foundation for more advanced analysis
356
+
357
+ ### 🎯 Key Educational Features
358
+ - **Mathematical Transparency**: Clear implementation of statistical formulas
359
+ - **Comprehensive Examples**: Step-by-step usage demonstrations
360
+ - **Pure Python**: Easy to understand and modify
361
+ - **Well-Documented**: Detailed docstrings with mathematical explanations
362
+ - **Test-Driven**: All functions thoroughly tested for accuracy
363
+
364
+ ### 💡 Use Cases
365
+ - **Classroom Teaching**: Interactive statistics demonstrations
366
+ - **Self-Learning**: Understanding statistical concepts through code
367
+ - **Research Projects**: Small-scale statistical analysis
368
+ - **Code Review**: Learning Python best practices
369
+ - **Portfolio Projects**: Showcasing statistical programming skills
370
+
371
+ The code is well-documented with clear mathematical formulas and examples, making it ideal for educational use.
372
+
373
+ ## 🙏 Acknowledgments
374
+
375
+ - **NumPy**: For efficient numerical computations
376
+ - **Scientific Community**: For statistical formulas and methodologies
377
+ - **Open Source Community**: For inspiration and best practices
378
+ - **Educational Institutions**: For feedback and testing
379
+
380
+ ## 📞 Support
381
+
382
+ If you have questions, suggestions, or need help:
383
+
384
+ - **Issues**: [GitHub Issues](https://github.com/RanaEhtashamAli/py-stats/issues)
385
+ - **Discussions**: [GitHub Discussions](https://github.com/RanaEhtashamAli/py-stats/discussions)
386
+ - **Documentation**: This README and function docstrings
387
+ - **Examples**: Check the `examples/` directory for usage demonstrations
388
+
389
+ ---
390
+
391
+ **Made with ❤️ for the educational community**