pypcurve: A Python Implementation of Simonsohn, Simmons and Nelson's 'p-curve'
============================================================================
# Installation
You can install pypcurve with pip:
pip install pypcurve
# Using pypcurve
## 1. Compulsory Reading
First and foremost, [read the user guide to the p-curve](http://p-curve.com/guide.pdf). It is crucial that users
understand what p-curve can and cannot do, that they know which statistical results to select, and that they properly
prepare the disclosure table.
## 2. Formatting the statistical results
pypcurve only requires a list of statistical results, stored in a list (or an array). Similar to the p-curve app,
pypcurve accepts the following formats of statistical tests:
* F(1, 302)=3.273
* t(103)=4.23
* r(76)=.42
* z=1.98
* chi2(1)=7.1
In addition, pypcurve will accept raw p-values:
* p = .0023
This is not recommended though: p-values are often weirdly rounded, so enter the statistical result instead if
it is reported in the paper.
## 3. Using pypcurve
### A. Initialization
For this example, I will assume that your tests have been properly formatted, and stored in a column
called "Tests" of a .csv file.
````python
from pypcurve import PCurve
import pandas as pd
df = pd.read_csv("mydata.csv")
pc = PCurve(df.Tests)
````
If all your tests are properly formatted, there will be no error, and pcurve will be initialized properly.
### B. Printing the p-curve output
Next, you can print the summary of the p-curve, as you would see it using the web-app:
````python
pc.summary()
````
This will output the p-curve plot, as well as the table summarizing the binomial and Stouffer tests of the
p-curve analysis. You can get the plot alone, or the table alone, using the methods `pc.plot_pcurve()` and
`pc.pcurve_analysis_summary()`.
### C. Power Estimation
You can use pycurve to estimate the power of the design that generated the statistical tests:
* `pc.estimate_power()` will return the power estimate, and the (lower, upper) bounds of 90% confidence interval.
* `pc.plot_power_estimate()` will plot the power estimate (as the webapp does).
### D. Accessing the results of the p-curve analysis
You can directly access the results of the p-curve analysis using three methods:
* `pc.get_stouffer_tests()` will recover the Z and p-values of the Stouffer tests
* `pc.get_binomial_tests()` will recover the p-values of the binomial tests
* `pc.get_results_entered()` will recover the statistical results entered in the p-curve, and the pp-values and z scores
associated with the different alternatives to which they are compared.
You can also directly check if the p-curve passes the cutoff for evidential value, and the cutoff for
inadequate evidence (as defined in [Better P-Curve](http://p-curve.com/paper/Better%20p-curves%202015%2011%2026.pdf)),
using the properties `pc.has_evidential_value` and `pc.has_inadequate_evidence`
# Version History
The app is still in beta, so please take care when interpreting the results. I have tested pypcurve against the
p-curve app using multiple examples: There are occasional minor deviations between the two, because of the way R (vs.
Python) compute the non-central F distribution.
## Beta
### 0.1.0
First beta release.
Raw data
{
"_id": null,
"home_page": "https://github.com/QuentinAndre/pypcurve/",
"name": "pypcurve",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "mediation-analysis,statistics,process,plotting,data-science,data-analysis,data-visualization,regression-models",
"author": "Quentin Andr\u00e9",
"author_email": "quentin.andre@colorado.edu",
"download_url": "https://files.pythonhosted.org/packages/b3/1a/182a8b4a7d8a0343d5a100150549e0d740c28e56ce38212549f2752e7285/pypcurve-0.1.1.tar.gz",
"platform": null,
"description": "\ufeffpypcurve: A Python Implementation of Simonsohn, Simmons and Nelson's 'p-curve'\n============================================================================\n\n# Installation\n\nYou can install pypcurve with pip:\n\n pip install pypcurve\n\n# Using pypcurve\n\n## 1. Compulsory Reading\n\nFirst and foremost, [read the user guide to the p-curve](http://p-curve.com/guide.pdf). It is crucial that users \nunderstand what p-curve can and cannot do, that they know which statistical results to select, and that they properly\n prepare the disclosure table. \n\n## 2. Formatting the statistical results\n\npypcurve only requires a list of statistical results, stored in a list (or an array). Similar to the p-curve app, \npypcurve accepts the following formats of statistical tests:\n* F(1, 302)=3.273\n* t(103)=4.23\n* r(76)=.42\n* z=1.98\n* chi2(1)=7.1\n\nIn addition, pypcurve will accept raw p-values:\n* p = .0023\n\nThis is not recommended though: p-values are often weirdly rounded, so enter the statistical result instead if \n it is reported in the paper.\n\n## 3. Using pypcurve\n\n### A. Initialization\n\nFor this example, I will assume that your tests have been properly formatted, and stored in a column\ncalled \"Tests\" of a .csv file.\n\n````python\nfrom pypcurve import PCurve\nimport pandas as pd\ndf = pd.read_csv(\"mydata.csv\")\npc = PCurve(df.Tests)\n````\n\nIf all your tests are properly formatted, there will be no error, and pcurve will be initialized properly.\n\n### B. Printing the p-curve output\n\nNext, you can print the summary of the p-curve, as you would see it using the web-app:\n\n````python\npc.summary()\n````\n\nThis will output the p-curve plot, as well as the table summarizing the binomial and Stouffer tests of the \np-curve analysis. You can get the plot alone, or the table alone, using the methods `pc.plot_pcurve()` and \n`pc.pcurve_analysis_summary()`.\n\n### C. Power Estimation\n\nYou can use pycurve to estimate the power of the design that generated the statistical tests:\n * `pc.estimate_power()` will return the power estimate, and the (lower, upper) bounds of 90% confidence interval.\n * `pc.plot_power_estimate()` will plot the power estimate (as the webapp does).\n \n### D. Accessing the results of the p-curve analysis\n\nYou can directly access the results of the p-curve analysis using three methods:\n* `pc.get_stouffer_tests()` will recover the Z and p-values of the Stouffer tests\n* `pc.get_binomial_tests()` will recover the p-values of the binomial tests\n* `pc.get_results_entered()` will recover the statistical results entered in the p-curve, and the pp-values and z scores\nassociated with the different alternatives to which they are compared.\n\nYou can also directly check if the p-curve passes the cutoff for evidential value, and the cutoff for \ninadequate evidence (as defined in [Better P-Curve](http://p-curve.com/paper/Better%20p-curves%202015%2011%2026.pdf)), \nusing the properties `pc.has_evidential_value` and `pc.has_inadequate_evidence`\n\n# Version History\n\nThe app is still in beta, so please take care when interpreting the results. I have tested pypcurve against the \np-curve app using multiple examples: There are occasional minor deviations between the two, because of the way R (vs.\nPython) compute the non-central F distribution.\n\n## Beta\n\n### 0.1.0\nFirst beta release.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python library for p-curve estimation",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/QuentinAndre/pypcurve/"
},
"split_keywords": [
"mediation-analysis",
"statistics",
"process",
"plotting",
"data-science",
"data-analysis",
"data-visualization",
"regression-models"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "569822c4a408f13cabfe7d4214a1b7e274df0c36f15dff6ad46dd1c96f080ad6",
"md5": "23493adb733236dea1e039724b9c8853",
"sha256": "a15f2712b367ffebd6b5e3813456fb73fe810a275733131629972b3419dee7a9"
},
"downloads": -1,
"filename": "pypcurve-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "23493adb733236dea1e039724b9c8853",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 14401,
"upload_time": "2024-02-12T17:41:57",
"upload_time_iso_8601": "2024-02-12T17:41:57.418465Z",
"url": "https://files.pythonhosted.org/packages/56/98/22c4a408f13cabfe7d4214a1b7e274df0c36f15dff6ad46dd1c96f080ad6/pypcurve-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b31a182a8b4a7d8a0343d5a100150549e0d740c28e56ce38212549f2752e7285",
"md5": "b10ddaa1f11eed8a74e3ee8d14307a6c",
"sha256": "fdcd1d3768965fdd3c695ca4059a4c22559f8180e47a945a770a5be6bc1047d1"
},
"downloads": -1,
"filename": "pypcurve-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "b10ddaa1f11eed8a74e3ee8d14307a6c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 15592,
"upload_time": "2024-02-12T17:41:59",
"upload_time_iso_8601": "2024-02-12T17:41:59.206183Z",
"url": "https://files.pythonhosted.org/packages/b3/1a/182a8b4a7d8a0343d5a100150549e0d740c28e56ce38212549f2752e7285/pypcurve-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-12 17:41:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "QuentinAndre",
"github_project": "pypcurve",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pypcurve"
}