{ "info": { "author": "Sergey Kim, Reidar Brumer Bratvold", "author_email": "kimsergeo@gmail.com, reidar.bratvold@uis.no", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "metalog\n=======\n\nSergey Kim, Reidar Brumer Bratvold\n\nMetalog Distribution\n--------------------\n\nThe metalog distributions constitute a new system of continuous\nunivariate probability distributions designed for flexibility,\nsimplicity, and ease/speed of use in practice. The system is comprised\nof unbounded, semi-bounded, and bounded distributions, each of which\noffers nearly unlimited shape flexibility compared to Pearson, Johnson,\nand other traditional systems of distributions.\n\nThe package requires the following packages: **numpy, pandas, matplotlib and scipy (ver 1.3.1)**.\n\nThe following\n`paper `__\nand `website `__ provide\na full background of the metalog distribution.\n\nUsing the Package\n-----------------\n\nThis Python package was transfered from\n`RMetalog `__ package by Isaac J.\nFaber and therefore shares the same R-based structure.\n\nThe\n`data `__\nused for demonstration are body length of salmon and were collected in\n2008-2010:\n\n::\n\n import numpy as np\n import pandas as pd\n\n salmon = pd.read_csv(\"Chinook and forage fish lengths.csv\")\n\n # Filtered data for eelgrass vegetation and chinook salmon\n salmon = salmon[(salmon['Vegetation'] == 'Eelgrass') & (salmon['Species'] == 'Chinook_salmon')]\n salmon = np.array(salmon['Length'])\n\nTo import package with metalog distribution run the code:\n\n::\n\n from metalog import metalog\n\nTo **fit the data to metalog distribution** one should use function\n``metalog.fit()``. It has the following arguments:\n\n- ``x``: data.\n\n- ``bounds``: bounds of metalog distribution. Depending on\n ``boundedness`` argument can take zero, one or two values.\n\n- ``boundedness``: boundedness of metalog distribution. Can take values\n ``'u'`` for unbounded, ``'sl'`` for semi-bounded lower, ``'su'`` for\n semi-bounded upper and ``'b'`` for bounded on both sides.\n\n- ``term_limit``: maximum number of terms to specify the metalog\n distribution. Can take values from 3 to 30.\n\n- ``term_lower_bound``: the lowest number of terms to specify the\n metalog distribution. Must be greater or equal to 2 and less than\n ``term_limit``. The argument is optional. Default value is 2.\n\n- ``step_len``: size of steps to summarize the distribution. The\n argument is optional. Default value is 0.01.\n\n- ``probs``: probabilities corresponding to data. The argument is\n optional. Default value is ``numpy.nan``.\n\n- ``fit_method``: fit method ``'OLS'``, ``'LP'`` or ``'any'``. The\n argument is optional. Default value is ``'any'``.\n\n- ``save_data``: if ``True`` then data will be saved for future update.\n The argument is optional. Default values is ``False``.\n\nFit metalog distribution to data and store the result to variable\n``metalog_salmon``. The distribution is bounded on both sides: from 0 to\n200. Term limit is set to 10:\n\n::\n\n metalog_salmon = metalog.fit(x=salmon, boundedness='b', bounds=[0, 200], term_limit=10)\n\nTo get **summary of distribution** call the following function with only\none argument ``m`` - the variable that stores fitted metalog\ndistribution:\n\n::\n\n metalog.summary(m=metalog_salmon)\n\nOutput:\n\n::\n\n -----------------------------------------------\n SUMMARY OF METALOG DISTRIBUTION OBJECT\n -----------------------------------------------\n\n PARAMETERS\n\n Term Limit: 10 \n Term Lower Bound: 2 \n Boundedness: b \n Bounds (only used based on boundedness): [0, 200] \n Step Length for Distribution Summary: 0.01 \n Method Use for Fitting: any \n Number of Data Points Used: 138 \n Original Data Saved: False \n\n\n VALIDATION AND FIT METHOD\n\n term valid method\n 2 2 yes OLS\n 3 3 yes OLS\n 4 4 yes OLS\n 5 5 yes OLS\n 6 6 yes OLS\n 7 7 yes OLS\n 8 8 yes OLS\n 9 9 yes OLS\n 10 10 yes OLS\n\nIt's possible **to plot corresponding PDF and CDF** of metalog\ndistribution:\n\n::\n\n metalog.plot(m=metalog_salmon)\n\nOutput:\n\n.. figure:: https://raw.githubusercontent.com/kimsergeo/metalog/master/figures/figure_1.png\n :alt: pdf\\_cdf\n\n**To draw samples** from distribution use ``metalog.r()`` function where\n``n`` is number of samples and ``term`` specifies the terms of\ndistribution to sample from:\n\n::\n\n metalog.r(m=metalog_salmon, n=5, term=10)\n\nOutput:\n\n::\n\n array([73.81897286, 86.74055734, 84.22509619, 83.80426247, 97.79800677])\n\n**To get densities** based on quantiles type ``metalog.d()`` function\nwhere ``q`` is vector of quantiles:\n\n::\n\n metalog.d(m=metalog_salmon, q=[50, 110, 150], term=10)\n\nOutput:\n\n::\n\n array([0.00038265, 0.00712032, 0.00373991])\n\n**To calculate probabilities** based on quantiles use ``metalog.p()``\nfunction:\n\n::\n\n metalog.p(m=metalog_salmon, q=[50, 110, 150], term=10)\n\nOutput:\n\n::\n\n array([0.00275336, 0.82349578, 0.98686581])\n\nFinally, **to get quantiles** from probabilites input ``metalog.q()``:\n\n::\n\n metalog.q(m=metalog_salmon, y=[0.00275336, 0.82349578, 0.98686581], term=10)\n\nOutput:\n\n::\n\n array([ 50.02583336, 109.99861143, 149.99737059])\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kimsergeo/metalog", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "metalog", "package_url": "https://pypi.org/project/metalog/", "platform": "", "project_url": "https://pypi.org/project/metalog/", "project_urls": { "Homepage": "https://github.com/kimsergeo/metalog" }, "release_url": "https://pypi.org/project/metalog/0.2.2/", "requires_dist": null, "requires_python": "", "summary": "the package fits data to metalog distribution and generates samples, quantiles, densities and probabilities based on the fitted distribution.", "version": "0.2.2" }, "last_serial": 5830034, "releases": { "0.2.2": [ { "comment_text": "", "digests": { "md5": "5f77eee7cd6f692d8844b06ee555ca85", "sha256": "e7b5aa6ccaf25d23f272add2d49f10ac2b9041c73be84d22bb04bc87ffc3edd8" }, "downloads": -1, "filename": "metalog-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "5f77eee7cd6f692d8844b06ee555ca85", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12858, "upload_time": "2019-09-14T19:49:49", "url": "https://files.pythonhosted.org/packages/44/1c/82505e6df4a1995fea83c6b07869ecfc2e3c231bab88498e7acd467ce1c1/metalog-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9e38203f45aff956245dedb1485dcd67", "sha256": "187f8888d63d8c8c09358b70a9a5d2ca5b0783d9f22166c93ac9c03f530c269d" }, "downloads": -1, "filename": "metalog-0.2.2.tar.gz", "has_sig": false, "md5_digest": "9e38203f45aff956245dedb1485dcd67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13421, "upload_time": "2019-09-14T19:49:52", "url": "https://files.pythonhosted.org/packages/1d/7a/ccba674e373e4f00842c253a3ceed11b8d03e3b51cb5d892ad2e04b25ff4/metalog-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5f77eee7cd6f692d8844b06ee555ca85", "sha256": "e7b5aa6ccaf25d23f272add2d49f10ac2b9041c73be84d22bb04bc87ffc3edd8" }, "downloads": -1, "filename": "metalog-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "5f77eee7cd6f692d8844b06ee555ca85", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12858, "upload_time": "2019-09-14T19:49:49", "url": "https://files.pythonhosted.org/packages/44/1c/82505e6df4a1995fea83c6b07869ecfc2e3c231bab88498e7acd467ce1c1/metalog-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9e38203f45aff956245dedb1485dcd67", "sha256": "187f8888d63d8c8c09358b70a9a5d2ca5b0783d9f22166c93ac9c03f530c269d" }, "downloads": -1, "filename": "metalog-0.2.2.tar.gz", "has_sig": false, "md5_digest": "9e38203f45aff956245dedb1485dcd67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13421, "upload_time": "2019-09-14T19:49:52", "url": "https://files.pythonhosted.org/packages/1d/7a/ccba674e373e4f00842c253a3ceed11b8d03e3b51cb5d892ad2e04b25ff4/metalog-0.2.2.tar.gz" } ] }