presize
presize: An R-package for precision-based sample size calculation in clinical research - Published in JOSS (2021)
Science Score: 93.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 9 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
○Committers with academic emails
-
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
confidence-intervals
precision
sample-size-calculation
shiny-app
Scientific Fields
Medicine
Life Sciences -
40% confidence
Last synced: 4 months ago
·
JSON representation
Repository
Precision Based Sample Size Calculation
Basic Info
- Host: GitHub
- Owner: CTU-Bern
- License: gpl-3.0
- Language: R
- Default Branch: master
- Homepage: https://ctu-bern.github.io/presize/
- Size: 2.81 MB
Statistics
- Stars: 18
- Watchers: 2
- Forks: 14
- Open Issues: 3
- Releases: 3
Topics
confidence-intervals
precision
sample-size-calculation
shiny-app
Created about 7 years ago
· Last pushed about 1 year ago
Metadata Files
Readme
Changelog
Contributing
License
README.Rmd
---
output: github_document
bibliography: paper/paper.bib
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# presize
[](https://cran.r-project.org/package=presize)
`r badger::badge_custom("dev version", as.character(packageVersion("presize")), "blue", "https://github.com/CTU-Bern/presize")`
[](https://github.com/CTU-Bern/presize/actions)
[](https://codecov.io/gh/CTU-Bern/presize?branch=master)
[](https://doi.org/10.21105/joss.03118)
[](https://cran.r-project.org/package=presize)
[Bland (2009)](https://www.bmj.com/content/339/bmj.b3985) recommended to
base study sizes on the width of the confidence interval rather the power of
a statistical test. The goal of `presize` is to provide functions for such
precision based sample size calculations. For a given sample size, the
functions will return the precision (width of the confidence interval), and
vice versa.
## Installation
`presize` can be installed from CRAN in the usual manner:
```{r cran-installation, eval = FALSE}
install.packages("presize")
```
You can install the development version of `presize` with:
```{r gh-installation, eval = FALSE}
install.packages('presize', repos = c('https://ctu-bern.r-universe.dev', 'https://cloud.r-project.org'))
```
## Overview
`presize` provides functions for
Measure | Function | Methods available
-------- | ---------- | --------
**Descriptive measures** | |
Mean | `prec_mean` |
Proportion | `prec_prop` | Wilson, Agresti-Coull, exact, Wald [see @brown2001]
Rate | `prec_rate` | Score, variance stabilizing, exact, Wald [see @barker2002]
**Absolute differences** | |
Mean difference | `prec_meandiff` |
Risk difference | `prec_riskdiff` | Newcombe [@newcombe1998], Miettinen-Nurminen [@mn1985], Agresti-Caffo [@ac2000], Wald
**Relative differences** | |
Odds ratio | `prec_or` | Gart, Wolff, independence smoothed logit [see @fll2015]
Risk ratio | `prec_riskratio` | Koopman [@koopman1984], Katz [@kbap1978]
Rate ratio | `prec_rateratio` | Rothman [@rg2018]
**Correlation measures** | |
Correlation coefficient | `prec_cor` | Pearson, Kendall, Spearman [see @bw2000]
Intraclass correlation | `prec_icc` | @bonnett2002
Limit of agreement | `prec_lim_agree` | @ba1986
Cohen's kappa | `prec_kappa` | @rd2012
Cronbach’s alpha | `prec_cronb` | @bonet10
**Diagnostic measures** | |
Sensitivity1 | `prec_sens` | As per `prec_prop`
Specificity1 | `prec_spec` | As per `prec_prop`
Area under the curve | `prec_auc` | @hm1982
Negative likelihood ratio2 | `prec_neg_lr` | @simel1991
Positive likelihood ratio2 | `prec_pos_lr` | @simel1991
Generic likelihood ratio | `prec_lr` | @simel1991
1 Simple wrappers for `prec_prop`.
2 Wrappers for `prec_lr` with values provided via sens and spec
## Example
Suppose we want to estimate the proportion of hospital admissions with diabetes.
Diabetes has a prevalence of approximately 10% (@diab). We assume a
slightly higher proportion of diabetics,
15%, as diabetes is a risk factor for a wide range of conditions. We want to
estimate the prevalence of diabetes to within 5% (plus/minus 2.5%). With `presize`,
this is simple. We use the `prec_prop` (precision of a proportion) function and pass
our 15% and 5% as arguments `p` and `conf.width`:
```{r}
library(presize) # load the package
prec_prop(p = 0.15, conf.width = 0.05)
```
In the n column, we see that we would need to ask 784 (rounding 783.5 up) patients to achieve the desired CI width.
Disappointingly, we also know that we only have funds to collect the data from
600 patients.
We wonder if 600 patients would yield sufficient precision - we could
also accept a CI width of 6% (plus/minus 3%).
In such a case, we can pass the arguments `p` and `n`.
```{r}
prec_prop(p = 0.15, n = 600)
```
Now we see that with 600 patients, the CI would have a width of
5.7%. We are happy with this and continue planning our study with those values.
All of the functions listed in Table 1 can be used similarly.
We can also look at a range of scenarios simulatenously by passing a vector to
one of the arguments, which could be used to create something analogous to a
power curve:
```{r}
prec_prop(p = 0.15, n = seq(600, 800, 50))
```
## Shiny app
An online interactive version of the package is available [here](https://shiny.ctu.unibe.ch/presize). The app can also be launched locally via `launch_presize_app()` in RStudio.
```{r, echo=FALSE}
knitr::include_graphics("man/figures/app.png")
```
## Getting help
The package website, including more details on the functions, can be found [here](https://ctu-bern.github.io/presize/).
If you have a question, feel free to make a thread on the [discussion](https://github.com/CTU-Bern/presize/discussions) page.
If you encounter a bug, please create an [issue](https://github.com/CTU-Bern/presize/issues).
## Contributing
Contributions to `presize` are welcome. If you have ideas, open an [issue](https://github.com/CTU-Bern/presize/issues) or a [discussion thread](https://github.com/CTU-Bern/presize/discussions) on GitHub.
If you want to contribute code, please feel free to fork the repository, make your changes and make a pull request to have them integrated into the package. New functionality should have accompanying tests and pass continuous integration. See also the [contributing guidelines](https://github.com/CTU-Bern/presize/blob/master/CONTRIBUTING.md).
## Funding
`presize` was largely developed at CTU Bern, with collaboration from CTU Basel. Funding was provided by the Swiss Clinical Trial Organisation.
```{r, echo=FALSE}
knitr::include_graphics("man/figures/SCTO_Platforms.png")
```
## Citation [](https://doi.org/10.21105/joss.03118)
If you use `presize`, please cite it in your publication as:
Haynes et al., (2021). presize: An R-package for precision-based sample size calculation in clinical research. Journal of Open Source Software, 6(60), 3118, https://doi.org/10.21105/joss.03118
### Acknowledgements
The package logo was created with [`ggplot2`](https://ggplot2.tidyverse.org/) and [`hexSticker`](https://github.com/GuangchuangYu/hexSticker) with icons from [Font Awesome](https://fontawesome.com/) (via the [emojifont package](https://github.com/GuangchuangYu/emojifont)).
## References
Owner
- Name: CTU Bern
- Login: CTU-Bern
- Kind: organization
- Location: Switzerland
- Website: https://www.ctu.unibe.ch/index_eng.html
- Twitter: CTUBern
- Repositories: 14
- Profile: https://github.com/CTU-Bern
CTU Bern is the Clinical Trials Unit of the Faculty of Medicine of the University of Bern and the Inselspital, Bern University Hospital.
JOSS Publication
presize: An R-package for precision-based sample size calculation in clinical research
Published
April 14, 2021
Volume 6, Issue 60, Page 3118
Authors
Alan G. Haynes
CTU Bern, University of Bern, Bern, Switzerland, Statistics and Methodology Platform of the Swiss Clinical Trial Organisation (SCTO), Bern, Switzerland
CTU Bern, University of Bern, Bern, Switzerland, Statistics and Methodology Platform of the Swiss Clinical Trial Organisation (SCTO), Bern, Switzerland
Armando Lenz
CTU Bern, University of Bern, Bern, Switzerland, Statistics and Methodology Platform of the Swiss Clinical Trial Organisation (SCTO), Bern, Switzerland
CTU Bern, University of Bern, Bern, Switzerland, Statistics and Methodology Platform of the Swiss Clinical Trial Organisation (SCTO), Bern, Switzerland
Tags
R software clinical trials sample size calculationGitHub Events
Total
- Watch event: 3
- Issue comment event: 2
- Push event: 8
Last Year
- Watch event: 3
- Issue comment event: 2
- Push event: 8
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| aghaynes | a****s@g****m | 397 |
| a-lenz | a****z@c****h | 42 |
| ostalder | 6****r | 33 |
| Render action | r****n@g****m | 31 |
| GitHub Actions | a****s@g****m | 21 |
| Marie | 5****t | 7 |
| runner | r****r@M****l | 4 |
| runner | r****r@M****l | 2 |
| Arnaud Künzi | 2****i | 1 |
| Mark A. Jensen | m****t@f****s | 1 |
| runner | r****r@M****l | 1 |
| runner | r****r@M****l | 1 |
| runner | r****r@M****l | 1 |
| runner | r****r@M****l | 1 |
| runner | r****r@M****l | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 23
- Total pull requests: 81
- Average time to close issues: 2 months
- Average time to close pull requests: 5 days
- Total issue authors: 7
- Total pull request authors: 8
- Average comments per issue: 2.04
- Average comments per pull request: 0.68
- Merged pull requests: 74
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: 8 minutes
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.5
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- aghaynes (13)
- TomKellyGenetics (4)
- ArnaudKunzi (2)
- clayford (1)
- gillesdutilh (1)
- amoeba (1)
- piaclarapafundi (1)
Pull Request Authors
- aghaynes (65)
- ostalder (9)
- a-lenz (3)
- TomKellyGenetics (2)
- ArnaudKunzi (1)
- mroumet (1)
- majensen (1)
- qpmnguyen (1)
Top Labels
Issue Labels
bug (2)
enhancement (1)
good first issue (1)
FAQ (1)
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 420 last-month
- Total docker downloads: 41,971
- Total dependent packages: 1
- Total dependent repositories: 0
- Total versions: 5
- Total maintainers: 1
cran.r-project.org: presize
Precision Based Sample Size Calculation
- Homepage: https://github.com/CTU-Bern/presize
- Documentation: http://cran.r-project.org/web/packages/presize/presize.pdf
- License: GPL-3
-
Latest release: 0.3.7
published almost 3 years ago
Rankings
Forks count: 6.5%
Stargazers count: 15.6%
Dependent packages count: 18.7%
Average: 19.9%
Downloads: 23.3%
Dependent repos count: 35.5%
Maintainers (1)
Last synced:
4 months ago
Dependencies
DESCRIPTION
cran
- kappaSize >= 1.2 imports
- shiny * imports
- Hmisc * suggests
- binom * suggests
- dplyr * suggests
- ggplot2 * suggests
- gt * suggests
- knitr * suggests
- magrittr * suggests
- markdown * suggests
- rmarkdown * suggests
- shinydashboard * suggests
- shinytest * suggests
- testthat * suggests
- tidyr * suggests
.github/workflows/R-CMD-full.yaml
actions
- actions/cache v1 composite
- actions/checkout v2 composite
- actions/upload-artifact master composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
.github/workflows/R-CMD-release.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v1 composite
- r-lib/actions/setup-r v2 composite
.github/workflows/pkgdown.yaml
actions
- actions/cache v2 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc master composite
- r-lib/actions/setup-r master composite
.github/workflows/render-readme.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v1 composite
- r-lib/actions/setup-r v1 composite
docker/Dockerfile
docker
- rocker/shiny latest build