Skip to content

Commit

Permalink
version 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Infanger authored and cran-robot committed Dec 9, 2020
1 parent c36a373 commit 39d1f83
Show file tree
Hide file tree
Showing 14 changed files with 945 additions and 117 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
Expand Up @@ -2,10 +2,10 @@ Package: pvaluefunctions
Type: Package
Title: Creates and Plots P-Value Functions, S-Value Functions,
Confidence Distributions and Confidence Densities
Version: 1.6.0
Version: 1.6.1
Authors@R: person("Denis", "Infanger", email = "denis.infanger@unibas.ch", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9028-7110"))
Maintainer: Denis Infanger <denis.infanger@unibas.ch>
Description: Contains functions to compute and plot confidence distributions, confidence densities, p-value functions and s-value (surprisal) functions for several commonly used estimates. Instead of just calculating one p-value and one confidence interval, p-value functions display p-values and confidence intervals for many levels thereby allowing to gauge the compatibility of several parameter values with the data. These methods are discussed by Infanger D, Schmidt-Trucksäss A. (2019) <doi:10.1002/sim.8293>; Poole C. (1987) <doi:10.2105/AJPH.77.2.195>; Schweder T, Hjort NL. (2002) <doi:10.1111/1467-9469.00285>; Bender R, Berg G, Zeeb H. (2005) <doi:10.1002/bimj.200410104> ; Singh K, Xie M, Strawderman WE. (2007) <doi:10.1214/074921707000000102>; Rothman KJ, Greenland S, Lash TL. (2008, ISBN:9781451190052); Amrhein V, Trafimow D, Greenland S. (2019) <doi:10.1080/00031305.2018.1543137>; and Greenland S. (2019) <doi:10.1080/00031305.2018.1529625>.
Description: Contains functions to compute and plot confidence distributions, confidence densities, p-value functions and s-value (surprisal) functions for several commonly used estimates. Instead of just calculating one p-value and one confidence interval, p-value functions display p-values and confidence intervals for many levels thereby allowing to gauge the compatibility of several parameter values with the data. These methods are discussed by Infanger D, Schmidt-Trucksäss A. (2019) <doi:10.1002/sim.8293>; Poole C. (1987) <doi:10.2105/AJPH.77.2.195>; Schweder T, Hjort NL. (2002) <doi:10.1111/1467-9469.00285>; Bender R, Berg G, Zeeb H. (2005) <doi:10.1002/bimj.200410104> ; Singh K, Xie M, Strawderman WE. (2007) <doi:10.1214/074921707000000102>; Rothman KJ, Greenland S, Lash TL. (2008, ISBN:9781451190052); Amrhein V, Trafimow D, Greenland S. (2019) <doi:10.1080/00031305.2018.1543137>; Greenland S. (2019) <doi:10.1080/00031305.2018.1529625> and Rafi Z, Greenland S. (2020) <doi:10.1186/s12874-020-01105-9>.
Depends: R (>= 3.5.0)
Imports: ggplot2 (>= 3.3.0), scales (>= 1.1.0), zipfR (>= 0.6-66),
pracma (>= 2.2.9), stats
Expand All @@ -15,9 +15,9 @@ URL: https://github.com/DInfanger/pvaluefunctions
VignetteBuilder: knitr
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.0
RoxygenNote: 7.1.1
NeedsCompilation: no
Packaged: 2020-06-24 10:56:55 UTC; denis
Packaged: 2020-12-09 10:35:42 UTC; denis
Author: Denis Infanger [aut, cre] (<https://orcid.org/0000-0001-9028-7110>)
Repository: CRAN
Date/Publication: 2020-06-24 11:20:02 UTC
Date/Publication: 2020-12-09 11:30:03 UTC
25 changes: 13 additions & 12 deletions MD5
@@ -1,17 +1,18 @@
0872272175b95d58f0cc5aa5fc4be673 *DESCRIPTION
e39d7c0ea3a10fbe012766ff9078acb1 *DESCRIPTION
f4e77ba3810347894cacc5e5b68da3c0 *NAMESPACE
64ade5269b7be03cfbb9f28bed5321eb *NEWS.md
1b577612cf9bd2a5177a49e2b7ed13a2 *R/confidence_distributions.R
fc8deddf29feef4d456ff366e64b647a *README.md
ba9c5f9c66a9307264b7dc238f2c3726 *build/vignette.rds
44a7b04c9d6cb1507c6d351d07e545d3 *inst/doc/pvaluefun.R
ee2957167dd30232ff244b3204851cf6 *inst/doc/pvaluefun.Rmd
c9e290c8a6e5e90c2a2f538f6fe34526 *inst/doc/pvaluefun.html
a3795021984ee989b159f2832abc9c2c *NEWS.md
cd9d7c3d396998007bd64085c7934872 *R/confidence_distributions.R
3d0e873eebb32a6d58806e25fa550719 *README.md
20b65b1d3490a9cda17b7f63749c4934 *build/vignette.rds
5057d1562a0f9293de8683af7cf7bf3e *inst/doc/pvaluefun.R
3c4e4e548fedd791358db416320b80ea *inst/doc/pvaluefun.Rmd
3b115a369791f3691a1a9c16fc917934 *inst/doc/pvaluefun.html
b0cb542b722ba554ee8cbbe8f25d170b *man/conf_dist.Rd
e194b566f49867a19c372b4bb03e506b *man/figures/README-benderfig1-1.png
62a96239feca8c569cb69d48ff2c5615 *man/figures/README-ttest_pval-1.png
0453581210e74294766935c6b85ce846 *man/figures/README-ttest_sval-1.png
95ba12d42add04b1e89033936bcd6780 *man/figures/README-benderfig1-1.png
e1d306a2f0b34ccbcf4b715a9bc34424 *man/figures/README-ttest_pval-1.png
0d394c48e22e1031a23352c1dfee396f *man/figures/README-ttest_sval-1.png
70f0280813823dfe841f21813465f121 *man/figures/logo.svg
f8ad09a83a4bae484432532e94a6c95d *man/figures/logo2.svg
6c63de340dda5bfb650d755e6629e117 *man/figures/logo3.svg
ee2957167dd30232ff244b3204851cf6 *vignettes/pvaluefun.Rmd
3c4e4e548fedd791358db416320b80ea *vignettes/pvaluefun.Rmd
64411259804d77cd1659d1775fe67c86 *vignettes/pvaluefun.md
6 changes: 6 additions & 0 deletions NEWS.md
@@ -1,5 +1,11 @@
## NEWS and changes for the pvaluefunctions package

1.6.1
-------------

* Fixed a bug concerning the calculation of Newcombe's Wilson score interval with continuity correction for the difference of two proportions.
* Removed the "cairo" device from pngs in the vignette.

1.6.0
-------------

Expand Down
8 changes: 4 additions & 4 deletions R/confidence_distributions.R
Expand Up @@ -1957,8 +1957,8 @@ wilson_cicc <- function(
x <- round(estimate*n) # To get number of successes/failures
estimate_compl <- (1 - estimate) # Complement of estimate

lower <- max(0, (2*x + z^2 - 1 - z*sqrt(z^2 - 2 - 1/n + 4*estimate*(n*estimate_compl + 1)))/(2*(n + z^2)))
upper <- min(1, (2*x + z^2 + 1 + z*sqrt(z^2 + 2 - 1/n + 4*estimate*(n*estimate_compl - 1)))/(2*(n + z^2)))
lower <- max(0, (2*x + z^2 - 1 - z*sqrt(z^2 - 2 - 1/n + 4*estimate*(n*estimate_compl + 1)))/(2*(n + z^2)), na.rm = TRUE)
upper <- min(1, (2*x + z^2 + 1 + z*sqrt(z^2 + 2 - 1/n + 4*estimate*(n*estimate_compl - 1)))/(2*(n + z^2)), na.rm = TRUE)

c(lower, upper)

Expand Down Expand Up @@ -1992,8 +1992,8 @@ wilson_cicc_diff <- function(
l2 <- res2[1]
u2 <- res2[2]

lim1 <- max(-1, est_diff + sqrt((estimate[1] - l1)^2 + (u2 - estimate[2])^2))
lim2 <- min(1, est_diff - sqrt((u1 - estimate[1])^2 + (estimate[2] - l2)^2))
lim1 <- max(-1, est_diff - sqrt((estimate[1] - l1)^2 + (u2 - estimate[2])^2))
lim2 <- min(1, est_diff + sqrt((u1 - estimate[1])^2 + (estimate[2] - l2)^2))

sort(c(lim1, lim2), decreasing = FALSE)

Expand Down
49 changes: 26 additions & 23 deletions README.md
Expand Up @@ -19,11 +19,10 @@ pvaluefunctions

# *P*-value functions <img src="man/figures/logo3.svg" align="right" width="120" />

[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/pvaluefunctions)](https://cran.r-project.org/package=pvaluefunctions)
[![CRAN\_Status\_Badge](https://cranlogs.r-pkg.org:443/badges/grand-total/pvaluefunctions)](https://cran.r-project.org/package=pvaluefunctions)
[![downloads](https://cranlogs.r-pkg.org/badges/pvaluefunctions)](https://cran.r-project.org/package=pvaluefunctions)
[![total
downloads](https://cranlogs.r-pkg.org/badges/grand-total/pvaluefunctions)](http://cranlogs.r-pkg.org/badges/grand-total/pvaluefunctions)
[![Rdoc](http://www.rdocumentation.org/badges/version/pvaluefunctions)](http://www.rdocumentation.org/packages/pvaluefunctions)
<https://cranlogs.r-pkg.org/badges/grand-total/pvaluefunctions>
<https://www.rdocumentation.org/packages/pvaluefunctions>

## Accompanying paper

Expand Down Expand Up @@ -87,35 +86,40 @@ 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*
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.
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.
*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.
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
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.
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):
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
Expand All @@ -128,9 +132,9 @@ distribution estimator of a parameter: A review. *Internat Statist Rev.*

## Session info

#> R version 4.0.2 (2020-06-22)
#> R Under development (unstable) (2020-12-07 r79587)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 19041)
#> Running under: Windows 10 x64 (build 19042)
#>
#> Matrix products: default
#>
Expand All @@ -143,18 +147,17 @@ distribution estimator of a parameter: A review. *Internat Statist Rev.*
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] pvaluefunctions_1.6.0
#> [1] pvaluefunctions_1.6.1
#>
#> loaded via a namespace (and not attached):
#> [1] knitr_1.29 magrittr_1.5 tidyselect_1.1.0 munsell_0.5.0
#> [5] colorspace_1.4-1 R6_2.4.1 rlang_0.4.6 dplyr_1.0.0
#> [9] stringr_1.4.0 tools_4.0.2 grid_4.0.2 gtable_0.3.0
#> [13] xfun_0.15 htmltools_0.5.0 ellipsis_0.3.1 yaml_2.2.1
#> [17] digest_0.6.25 tibble_3.0.1 lifecycle_0.2.0 crayon_1.3.4
#> [21] farver_2.0.3 purrr_0.3.4 ggplot2_3.3.2 vctrs_0.3.1
#> [25] glue_1.4.1 evaluate_0.14 rmarkdown_2.3 pracma_2.2.9
#> [29] stringi_1.4.6 compiler_4.0.2 pillar_1.4.4 generics_0.0.2
#> [33] scales_1.1.1 pkgconfig_2.0.3
#> [1] knitr_1.30 magrittr_2.0.1 munsell_0.5.0 colorspace_2.0-0
#> [5] R6_2.5.0 rlang_0.4.9 stringr_1.4.0 tools_4.1.0
#> [9] grid_4.1.0 gtable_0.3.0 xfun_0.19 htmltools_0.5.0
#> [13] ellipsis_0.3.1 yaml_2.2.1 digest_0.6.27 tibble_3.0.4
#> [17] lifecycle_0.2.0 crayon_1.3.4 farver_2.0.3 ggplot2_3.3.2
#> [21] vctrs_0.3.5 glue_1.4.2 evaluate_0.14 rmarkdown_2.5
#> [25] pracma_2.2.9 stringi_1.5.3 compiler_4.1.0 pillar_1.4.7
#> [29] scales_1.1.1 pkgconfig_2.0.3

## License

Expand Down
Binary file modified build/vignette.rds
Binary file not shown.
30 changes: 15 additions & 15 deletions inst/doc/pvaluefun.R
Expand Up @@ -14,7 +14,7 @@ library(pvaluefunctions)
# source_url("https://raw.githubusercontent.com/DInfanger/pvaluefunctions/master/R/confidence_distributions.R")
#

## ----ttest, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----ttest, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dpi = 200----
#-----------------------------------------------------------------------------
# T-Test
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -49,7 +49,7 @@ res <- conf_dist(
)


## ----linreg_single_pval, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----linreg_single_pval, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dpi = 200----
#-----------------------------------------------------------------------------
# Model
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -84,7 +84,7 @@ res <- conf_dist(
, plot = TRUE
)

## ----linreg_single_cdf, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----linreg_single_cdf, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dpi = 200----
res <- conf_dist(
estimate = c(-0.02143)
, df = c(43)
Expand All @@ -107,7 +107,7 @@ res <- conf_dist(
, plot_counternull = FALSE
)

## ----linreg_multiple_pval, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----linreg_multiple_pval, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dpi = 200----
res <- conf_dist(
estimate = c(0.13115, 0.04913)
, df = c(43, 43)
Expand All @@ -130,7 +130,7 @@ res <- conf_dist(
, inverted = FALSE
)

## ----linreg_multiple_sval, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----linreg_multiple_sval, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dpi = 200----
res <- conf_dist(
estimate = c(0.13115, 0.04913)
, df = c(43, 43)
Expand All @@ -151,7 +151,7 @@ res <- conf_dist(
, plot_counternull = TRUE
)

## ----corr_pearson, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----corr_pearson, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dpi = 200----
#-----------------------------------------------------------------------------
# Calculate Pearson's correlation coefficient
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -181,7 +181,7 @@ res <- conf_dist(
, plot_counternull = FALSE
)

## ----logreg, message = FALSE, warning = FALSE, fig.width = 10.0, fig.height = 7.2, out.width = "80%", fig.align='center', dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----logreg, message = FALSE, warning = FALSE, fig.width = 10.0, fig.height = 7.2, out.width = "80%", fig.align='center', dev = "png", dpi = 200----
#-----------------------------------------------------------------------------
# Create p-value function
#-----------------------------------------------------------------------------
Expand All @@ -207,7 +207,7 @@ res <- conf_dist(
, x_scale = "default"
)

## ----prop, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----prop, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dpi = 200----
res <- conf_dist(
estimate = c(0.44)
, n = c(50)
Expand All @@ -229,7 +229,7 @@ res <- conf_dist(
, x_scale = "default"
)

## ----propdiff_Wilson, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----propdiff_Wilson, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dpi = 200----
res <- conf_dist(
estimate = c(68/100, 98/150)
, n = c(100, 150)
Expand All @@ -248,7 +248,7 @@ res <- conf_dist(
, plot_counternull = FALSE
)

## ----propdiff_agresticaffo, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----propdiff_agresticaffo, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dpi = 200----

# First proportion

Expand Down Expand Up @@ -295,7 +295,7 @@ res <- conf_dist(
)


## ----variance_calcs, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', eval = TRUE, echo = TRUE, fig.show = "hide", dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----variance_calcs, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', eval = TRUE, echo = TRUE, fig.show = "hide", dev = "png", dpi = 200----
# Simulate some data from a normal distribution

set.seed(142857)
Expand All @@ -322,12 +322,12 @@ res <- conf_dist(
)


## ----variance_plot, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', eval = TRUE, echo = TRUE, dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----variance_plot, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', eval = TRUE, echo = TRUE, dev = "png", dpi = 200----
# Add vertical lines at the point estimates (mode, median, mean)

res$plot + ggplot2::geom_vline(xintercept = as.numeric(res$point_est[1, 1:3]), linetype = 2, size = 1)

## ----rse_pval, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----rse_pval, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dpi = 200----
# Define the transformation function and its inverse for the relative survival effect

rse_fun <- function(x){
Expand Down Expand Up @@ -364,7 +364,7 @@ res <- conf_dist(
rm(rse_fun, rse_fun_inv)


## ----rse_cdf, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----rse_cdf, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dpi = 200----
# Define the transformation function and its inverse for the relative survival effect

rse_fun <- function(x){
Expand Down Expand Up @@ -400,7 +400,7 @@ res <- conf_dist(
rm(rse_fun, rse_fun_inv)


## ----aucc_comparison, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dev.args = list(type = "cairo-png"), dpi = 200----
## ----aucc_comparison, message = FALSE, warning = FALSE, fig.width = 9, fig.height = 7, out.width = "80%", fig.align='center', dev = "png", dpi = 200----

# Lungcancer dataset from the "meta" package

Expand Down

0 comments on commit 39d1f83

Please sign in to comment.