pvaluefunctions
Repository for the 'pvaluefunctions R package
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
✓DOI references
Found 6 DOI reference(s) in README -
○Academic publication links
-
✓Committers with academic emails
1 of 2 committers (50.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.1%) to scientific vocabulary
Last synced: 11 months ago
·
JSON representation
Repository
Repository for the 'pvaluefunctions R package
Statistics
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Created about 7 years ago
· Last pushed about 3 years ago
Metadata Files
Readme
README.Rmd
---
title: pvaluefunctions
output:
github_document:
toc: true
toc_depth: 3
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
# *P*-value functions
[](https://cran.r-project.org/package=pvaluefunctions)
[](https://cran.r-project.org/package=pvaluefunctions)
[](https://cranlogs.r-pkg.org/badges/grand-total/pvaluefunctions)
[](https://www.rdocumentation.org/packages/pvaluefunctions)
## Accompanying paper
We published an [accompanying paper](https://doi.org/10.1002/sim.8293) to illustrate the use of *p*-value functions:
Infanger D, Schmidt-Trucksäss A. (2019): *P* value functions: An underused method to present research results and to promote quantitative reasoning. *Statistics in Medicine.* **38**: 4189-4197. doi: 10.1002/sim.8293.
### Recreation of the figures in the paper
The code and instructions to reproduce all graphics in our paper can be found in the following GitHub repository: https://github.com/DInfanger/pvalue_functions
## Overview
This is the repository for the R-package [`pvaluefunctions`](https://cran.r-project.org/package=pvaluefunctions). The package contains R functions to create graphics of *p*-value functions, confidence distributions, confidence densities, or the [Surprisal value (S-value)](http://www.umsl.edu/~fraundorfp/egsurpri.html) (Greenland 2019).
## Installation
You can install the package directly from CRAN by typing `install.packages("pvaluefunctions")`. After installation, load it in R using `library(pvaluefunctions)`.
```{r source_github, message = FALSE, warning = FALSE, echo = FALSE, eval = FALSE}
library(devtools)
# Load main function
source_url("https://raw.githubusercontent.com/DInfanger/pvaluefunctions/master/R/confidence_distributions.R")
```
## Dependencies
The function depends on the following R packages, which need to be installed beforehand:
* [ggplot2](https://cran.r-project.org/package=ggplot2)
* [scales](https://cran.r-project.org/package=scales)
* [zipfR](https://cran.r-project.org/package=zipfR)
* [pracma](https://cran.r-project.org/package=pracma)
* [gsl](https://cran.r-project.org/package=gsl)
Use the command `install.packages(c("ggplot2", "scales", "zipfR", "pracma", "gsl"))` in R to install those packages.
## Examples
For more examples and code, see the [vignette](https://CRAN.R-project.org/package=pvaluefunctions/vignettes/pvaluefun.html).
```{r ttest_pval, echo = FALSE, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "70%", fig.align='left', dev = "png", dpi = 600}
# devtools::install_github("DInfanger/pvaluefunctions")
library(pvaluefunctions)
#-----------------------------------------------------------------------------
# Create p-value function
#-----------------------------------------------------------------------------
res <- conf_dist(
estimate = c(-1.58)
, df = c(17.77647)
, tstat = c(-1.860813)
, type = "ttest"
, plot_type = "p_val"
, n_values = 1e4L
# , est_names = c("")
, conf_level = c(0.95, 0.90, 0.80)
, null_values = c(0)
, trans = "identity"
, alternative = "two_sided"
, log_yaxis = FALSE
, cut_logyaxis = 0.05
, xlab = "Mean difference (group 1 - group 2)"
, together = FALSE
, plot_p_limit = 1 - 0.999
, plot_counternull = TRUE
, inverted = FALSE
, title = expression(italic(P)~"-value function for a"~italic(t)~"-test")
, plot = TRUE
)
```
```{r ttest_sval, echo = FALSE, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "70%", fig.align='left', dev = "png", dpi = 600}
#-----------------------------------------------------------------------------
# Create s-value function
#-----------------------------------------------------------------------------
res <- conf_dist(
estimate = c(-1.58)
, df = c(17.77647)
, tstat = c(-1.860813)
, type = "ttest"
, plot_type = "s_val"
, n_values = 1e4L
# , est_names = c("")
, conf_level = c(0.95, 0.90, 0.80)
, null_values = c(0)
, trans = "identity"
, alternative = "two_sided"
, log_yaxis = FALSE
, cut_logyaxis = 0.05
, xlab = "Mean difference (group 1 - group 2)"
, together = FALSE
, col = "#C977A2"
, plot_p_limit = 1 - 0.999
, plot_counternull = TRUE
, inverted = FALSE
, title = expression(italic(S)~"-value function for a"~italic(t)~"-test")
)
```
```{r benderfig1, echo = FALSE, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "70%", fig.align='left', dev = "png", dpi = 600}
rse_fun <- function(x){
100*(1 - exp(x))
}
rse_fun_inv <- function(x){
log(1 - (x/100))
}
res <- conf_dist(
estimate = c(log(0.72))
, stderr = (0.187618)
, type = "coxreg"
, plot_type = "p_val"
, n_values = 1e4L
, est_names = c("RSE")
, conf_level = c(0.95, 0.8, 0.5)
, null_values = rse_fun_inv(c(0))
, trans = "rse_fun"
, alternative = "two_sided"
, log_yaxis = FALSE
, cut_logyaxis = 0.05
, xlab = "Relative survival effect (1 - HR%)"
, xlim = rse_fun_inv(c(-30, 60))
, together = FALSE
, plot_p_limit = 1 - 0.999
, plot_counternull = TRUE
, inverted = TRUE
, title = "Figure 1 in Bender et al. (2005)"
)
```
## References
Bender R, Berg G, Zeeb H. (2005): Tutorial: using confidence curves in medical research. *Biom J.* 47(2): 237-47.
Berrar D (2017): Confidence Curves: an alternative to null hypothesis significance testing for the comparison of classifiers. *Mach Learn.* 106:911-949.
Fraser D. A. S. (2019): The *p*-value function and statistical inference. *Am Stat.* 73:sup1, 135-147.
Greenland S (2019): Valid *P*-Values Behave Exactly as They Should: Some Misleading Criticisms of *P*-Values and Their Resolution with *S*-Values. *Am Stat.* 73sup1, 106-114.
Infanger D, Schmidt-Trucksäss A. (2019): *P* value functions: An underused method to present research results and to promote quantitative reasoning. *Stat Med.* 38, 4189-4197. doi: 10.1002/sim.8293.
Poole C. (1987a): Beyond the confidence interval. *Am J Public Health.* 77(2): 195-9.
Poole C. (1987b): Confidence intervals exclude nothing. *Am J Public Health.* 77(4): 492-3.
Rafi Z, Greenland S. (2020): Semantic and cognitive tools to aid statistical science: replace confidence and significance by compatibility and surprise. *BMC Med Res Methodol.* 20, 244. doi: 10.1186/s12874-020-01105-9.
Rosenthal R, Rubin DB. (1994): The counternull value of an effect size: A new statistic. *Psychol Sci.* 5(6): 329-34.
Schweder T, Hjort NL. (2016): Confidence, likelihood, probability: statistical inference with confidence distributions. New York, NY: Cambridge University Press.
Xie M, Singh K, Strawderman WE. (2011): Confidence Distributions and a Unifying Framework for Meta-Analysis. *J Am Stat Assoc.* 106(493): 320-33. doi: 10.1198/jasa.2011.tm09803.
Xie Mg, Singh K. (2013): Confidence distribution, the frequentist distribution estimator of a parameter: A review. *Internat Statist Rev.* 81(1): 3-39.
## Contact
[Denis Infanger](https://dsbg.unibas.ch/de/personen/denis-infanger/)
## Session info
```{r session_info, include=TRUE, echo=FALSE}
sessionInfo()
```
## License
[](https://www.gnu.org/licenses/gpl-3.0)
Owner
- Name: Denis Infanger
- Login: DInfanger
- Kind: user
- Location: Switzerland
- Repositories: 4
- Profile: https://github.com/DInfanger
GitHub Events
Total
Last Year
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Denis Infanger | 7****r | 142 |
| Denis Infanger | d****r@u****h | 9 |
Committer Domains (Top 20 + Academic)
unibas.ch: 1
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 2
- Total pull requests: 0
- Average time to close issues: about 1 month
- Average time to close pull requests: N/A
- Total issue authors: 2
- Total pull request authors: 0
- Average comments per issue: 0.5
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ChristophHanck (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 345 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 9
- Total maintainers: 1
cran.r-project.org: pvaluefunctions
Creates and Plots P-Value Functions, S-Value Functions, Confidence Distributions and Confidence Densities
- Homepage: https://github.com/DInfanger/pvaluefunctions
- Documentation: http://cran.r-project.org/web/packages/pvaluefunctions/pvaluefunctions.pdf
- License: GPL-3
-
Latest release: 1.6.2
published over 4 years ago
Rankings
Stargazers count: 17.9%
Forks count: 21.9%
Average: 28.1%
Dependent packages count: 29.8%
Downloads: 35.3%
Dependent repos count: 35.5%
Maintainers (1)
Last synced:
11 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.5.0 depends
- ggplot2 >= 3.3.0 imports
- gsl >= 2.1 imports
- pracma >= 2.3.3 imports
- scales >= 1.1.1 imports
- stats * imports
- zipfR >= 0.6 imports
- devtools * suggests
- knitr * suggests
- rmarkdown * suggests