Giter VIP home page Giter VIP logo

presize's Introduction

presize

Actions Status Codecov test coverage DOI metacran downloads

Bland (2009) 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:

install.packages("presize")

You can install the development version of presize with:

install.packages('presize', repos = 'https://ctu-bern.r-universe.dev')

Overview

presize provides functions for

Measure Function Methods available
Descriptive measures
Mean prec_mean
Proportion prec_prop Wilson, Agresti-Coull, exact, Wald (see Brown, Cai, and DasGupta 2001)
Rate prec_rate Score, variance stabilizing, exact, Wald (see Barker 2002)
Absolute differences
Mean difference prec_meandiff
Risk difference prec_riskdiff Newcombe (Newcombe 1998), Miettinen-Nurminen (Miettinen and Nurminen 1985), Agresti-Caffo (Agresti and Caffo 2000), Wald
Relative differences
Odds ratio prec_or Gart, Wolff, independence smoothed logit (see Fagerland, Lydersen, and Laake 2015)
Risk ratio prec_riskratio Koopman (Koopman 1984), Katz (Katz et al. 1978)
Rate ratio prec_rateratio Rothman (Rothman and Greenland 2018)
Correlation measures
Correlation coefficient prec_cor Pearson, Kendall, Spearman (see Bonnett and Wright 2000)
Intraclass correlation prec_icc Bonnett (2002)
Limit of agreement prec_lim_agree Bland and Altman (1986)
Cohen’s kappa prec_kappa Rotondi and Donner (2012)
Cronbach’s alpha prec_cronb Bonett and Wright (2015)
Diagnostic measures
Sensitivity1 prec_sens As per prec_prop
Specificity1 prec_spec As per prec_prop
Area under the curve prec_auc Hanley and McNeil (1982)
Negative likelilood ratio2 preg_neg_lr Simel, Samsa, and Matchar (1991)
Positive likelilood ratio2 preg_pos_lr Simel, Samsa, and Matchar (1991)
Generic likelilood ratio preg_lr Simel, Samsa, and Matchar (1991)

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% (Emerging Risk Factors Collaboration et al. (2010)). 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:

library(presize) # load the package
prec_prop(p = 0.15, conf.width = 0.05)
#> Warning in prec_prop(p = 0.15, conf.width = 0.05): more than one method was
#> chosen, 'wilson' will be used
#> 
#>      sample size for a proportion with Wilson confidence interval. 
#> 
#>      p      padj        n conf.width conf.level       lwr       upr
#> 1 0.15 0.1517077 783.4897       0.05       0.95 0.1267077 0.1767077
#> 
#> NOTE: padj is the adjusted proportion, from which the ci is calculated.

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.

prec_prop(p = 0.15, n = 600)
#> Warning in prec_prop(p = 0.15, n = 600): more than one method was chosen,
#> 'wilson' will be used
#> 
#>      precision for a proportion with Wilson confidence interval. 
#> 
#>      p      padj   n conf.width conf.level       lwr       upr
#> 1 0.15 0.1522266 600 0.05713404       0.95 0.1236596 0.1807936
#> 
#> NOTE: padj is the adjusted proportion, from which the ci is calculated.

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:

prec_prop(p = 0.15, n = seq(600, 800, 50))
#> Warning in prec_prop(p = 0.15, n = seq(600, 800, 50)): more than one method was
#> chosen, 'wilson' will be used
#> 
#>      precision for a proportion with Wilson confidence interval. 
#> 
#>      p      padj   n conf.width conf.level       lwr       upr
#> 1 0.15 0.1522266 600 0.05713404       0.95 0.1236596 0.1807936
#> 2 0.15 0.1520563 650 0.05489329       0.95 0.1246097 0.1795030
#> 3 0.15 0.1519102 700 0.05289705       0.95 0.1254617 0.1783588
#> 4 0.15 0.1517835 750 0.05110386       0.95 0.1262316 0.1773355
#> 5 0.15 0.1516726 800 0.04948148       0.95 0.1269319 0.1764133
#> 
#> NOTE: padj is the adjusted proportion, from which the ci is calculated.

Shiny app

An online interactive version of the package is available here. The app can also be launched locally via launch_presize_app() in RStudio.

Getting help

The package website, including more details on the functions, can be found here.

If you have a question, feel free to make a thread on the discussion page.

If you encounter a bug, please create an issue.

Contributing

Contributions to presize are welcome. If you have ideas, open an issue or a discussion thread 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.

Funding

presize was largely developed at CTU Bern, with collaboration from CTU Basel. Funding was provided by the Swiss Clinical Trial Organisation.

Citation DOI

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 and hexSticker with icons from Font Awesome (via the emojifont package).

References

Agresti, A, and B Caffo. 2000. “Simple and Effective Confidence Intervals for Proportions and Differences of Proportions Result from Adding Two Successes and Two Failures.” The Americal Statistician 54 (4): 280–88. https://doi.org/10.2307/2685779.

Barker, L. 2002. “A Comparison of Nine Confidence Intervals for a Poisson Parameter When the Expected Number of Events Is ≤ 5.” The Americal Statistician 56 (2): 85–89. https://doi.org/10.1198/000313002317572736.

Bland, J M, and D G Altman. 1986. “Statistical Methods for Assessing Agreement Between Two Methods of Clinical Measurement.” Lancet i(8476): 307–10. https://doi.org/10.1016/S0140-6736(86)90837-8.

Bonett, Douglas G., and Thomas A. Wright. 2015. “Cronbach’s Alpha Reliability: Interval Estimation, Hypothesis Testing, and Sample Size Planning.” Journal of Organizational Behavior 36 (1): 3–15. https://doi.org/https://doi.org/10.1002/job.1960.

Bonnett, D G. 2002. “Sample Size Requirements for Estimating Intraclass Correlations with Desired Precision.” Statistics in Medicine 21: 1331–5. https://doi.org/10.1002/sim.1108.

Bonnett, D G, and T A Wright. 2000. “Sample Size Requirements for Estimating Pearson, Kendall and Spearman Correlations.” Psychometrika 65: 23–28. https://doi.org/10.1007/BF02294183.

Brown, L D, T T Cai, and A DasGupta. 2001. “Interval Estimation for a Binomial Proportion.” Statistical Science 16 (2): 101–17. https://doi.org/10.1214/ss/1009213286.

Emerging Risk Factors Collaboration, N Sarwar, P Gao, S R Seshasai, R Gobin, S Kaptoge, E Di Angelantonio, et al. 2010. “Diabetes Mellitus, Fasting Blood Glucose Concentration, and Risk of Vascular Disease: A Collaborative Meta-Analysis of 102 Prospective Studies.” Lancet 375 (9733): 2215–22. https://doi.org/10.1016/S0140-6736(10)60484-9.

Fagerland, M W, S Lydersen, and P Laake. 2015. “Recommended Confidence Intervals for Two Independent Binomial Proportions.” Statistical Methods in Medical Research 24 (2): 224–54. https://doi.org/10.1177/0962280211415469.

Hanley, J A, and B J McNeil. 1982. “The Meaning and Use of the Area Under a Receiver Operating Characteristic (Roc) Curve.” Radiology 148: 29–36. https://doi.org/10.1148/radiology.143.1.7063747.

Katz, D, J Baptista, S P Azen, and M C Pike. 1978. “Obtaining Confidence Intervals for the Risk Ratio in Cohort Studies.” Biometrics 34: 469–74. https://doi.org/10.2307/2530610.

Koopman, P A R. 1984. “Confidence Intervals for the Ratio of Two Binomial Proportions.” Biometrics 40: 513–17. https://doi.org/10.2307/2531551.

Miettinen, O, and M Nurminen. 1985. “Comparative Analysis of Two Rates.” Statistics in Medicine 4: 213–26. https://doi.org/10.1002/sim.4780040211.

Newcombe, R G. 1998. “Interval Estimation for the Difference Between Independent Proportions: Comparison of Eleven Methods.” Statistics in Medicine 17: 873–90. https://doi.org/10.1002/(sici)1097-0258(19980430)17:8<873::aid-sim779>3.0.co;2-i.

Rothman, K J, and S Greenland. 2018. “Planning Study Size Based on Precision Rather Than Power.” Epidemiology 29: 599–603. https://doi.org/10.1097/EDE.0000000000000876.

Rotondi, M A, and A Donner. 2012. “A Confidence Interval Approach to Sample Size Estimation for Interobserver Agreement Studies with Multiple Raters and Outcomes.” Journal of Clinical Epidemiology 65: 778–84. https://doi.org/10.1016/j.jclinepi.2011.10.019.

Simel, D L, G P Samsa, and D B Matchar. 1991. “Likelihood Ratios with Confidence: Sample Size Estimation for Diagnostic Test Studies.” Journal of Clinical Epidemiology 44 (8): 763–70. https://doi.org/10.1016/0895-4356(91)90128-v.

presize's People

Contributors

a-lenz avatar actions-user avatar aghaynes avatar arnaudkunzi avatar majensen avatar mroumet avatar ostalder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

presize's Issues

Zenodo

As a part of the JOSS review/acceptance procedure, the package had to be uploaded to an archive. It have been uploaded to Zenodo.

DOI

JOSS review

Submission: openjournals/joss-reviews#3118
Status: Conditional accept

Hey @aghaynes & @majensen,

I've finished my review and was able to check off most items but a few remain.
The submission is in very good shape overall and I think the changes are minor.

First off, kudos @aghaynes to you and your team for producing such a nicely put together package.
Your description of the background for this work and your accompanying documentation made it easy for me to get familiar with the technique and explore the functionality of the package.
The documentation looked very complete and the Shiny app is nice touch, especially in the way it automatically generates R code to match.

Below are the items I'd like to see addressed before I can change my review to an Accept:

Contribution and authorship

I see different sets of authors in a few places and wanted to make sure everything was complete and correct:

  • Paper: Haynes, Lenz, Stalder, Limacher
  • R package: Lenz [aut], Haynes [cre,aut], Limacher [aut], Stalder [ctb]
  • git commit history: Haynes, Lenz, Stalder (by order of commits)
  • pkgdown site: Lenz, Haynes, Limacher

First, could you clarify Limacher's association and contribution to the package? Second, is the above information (including ordering) correct?

Functionality

Everything worked great except the Shiny app.
When I install the package, load the package, and attempt to run the Shiny app, I get an error and the app does not launch:

Error: In sliderInput(): min, max, and value cannot be NULL, NA, or empty. 24.
stop(call. = FALSE, sprintf("In %s(): min, max, and value cannot be NULL, NA, or empty.", fun)) 23.

I had a hunch and checked to see if the Shiny app worked under the development version and it does.
I assume the authors are aware of this but I think it warrants ensuring JOSS archives a fixed version of the software and not 0.1.3.

Let me know if you can reproduce my issue. If so, I think generating a new release and updating this submission is warranted.

Community guidelines

Community guidelines: Are there clear guidelines for third parties wishing to 1) Contribute to the software 2) Report issues or problems with the software 3) Seek support

I wasn't able to find any of these three bits of information in the README file.
Please add them.

Paper

The paper is overall well-written and quite useful.
However, I believe it doesn't fit in with the JOSS guidelines in two ways:

  1. It does not contain an initial, high-level summary paragraph entitled Summary
  2. It contains too much detail about the package. That said, the information that falls outside the scope of the JOSS paper is very useful information and could be moved elsewhere

Other, non-review details

These are outside the JOSS guidelines so the review is not contingent on addressing them:

  • You might link your pkg site, https://ctu-bern.github.io/presize from GitHub (and possibly other places)

  • There's a typo at the bottom of the Example section in the README, "THe" instead of "The"

  • The image at the bottom of your pkgdown site under the Funding header isn't working for me

  • I noticed some scenarios where passing nonsense output produces cryptic errors both when calling functions directly or calling them indirectly using the Shiny app. For example, if I mistakenly specified the conf.width argument in percent points (e.g., 5) rather than as a proportion (e.g., 0.05),

    prec_prop(p = 0.5, conf.width = 5, conf.level = 0.95, method = 'wilson')
    Error in uniroot(function(n) eval(quo) - prec, c(1, 1e+07), ...) :
      f() values at end points not of opposite sign
    

    or in the Shiny app:

    Error: An error has occurred. Check your logs or contact the app author for clarification.

    I don't think these are deal breakers and I know writing tons of validation logic can be time-consuming but I thought I'd point out that I ran into it.

Please let me know if you have any questions of if I can clarify anything.

Equivalent of power for presize functions

Power is currently ca 50% - half the trials will find a larger CI

Could abuse the closed formulae to estimate the power...

> mu <- 5
> sd <- 2
> n <- 20
> presize::prec_mean(mu, sd, n)

     precision for mean 

  mean sd  n conf.width conf.level      lwr      upr
  1    5  2 20   1.872058       0.95 4.063971 5.936029

> power.t.test(delta = 0.94, sd = 2, power = .5, sig.level = .05, type = "one.sample")

     One-sample t test power calculation 

              n = 19.3697
          delta = 0.94
             sd = 2
      sig.level = 0.05
          power = 0.5
    alternative = two.sided

> power.t.test(delta = 0.94, sd = 2, power = .8, sig.level = .05, type = "one.sample")

     One-sample t test power calculation 

              n = 37.49745
          delta = 0.94
             sd = 2
      sig.level = 0.05
          power = 0.8
    alternative = two.sided

clarify ICC description regarding interactions

The description of the ICC page should mention that it makes the assumption that no interaction effect exists between rater and subject.
This is mentioned in passing in the Bonett reference, but only under "model 3". Non-statisticians are unlikely to understand this from the formulas.

`prec_alpha` method for Cronbach's alpha

Cronbach's alpha method is also defined in

Bonett, D. G. and Wright, T. A. (2015) Cronbach's alpha reliability: Interval estimation, hypothesis testing, and sample size planning, J. Organiz. Behav., 36, pages 3– 15. doi: 10.1002/job.1960.

Describe the solution you'd like
prec_alpha implementing functions 3 and 4 in the appendix. Maybe 2? Plus equivilents to get N given a CI width.

Improve manuscript for JOSS Review

Review: manuscript

Part of review for JOSS.

Overall

Firstly, let me thank the authors for their efforts to prepare an excellent package. It's certainly of wide interest for the research community and particularly providing a Shiny App is a great way to make it accessible to those without programming expertise. As R is popular in statistics, life sciences and biomedical research, an R package would be widely used in these fields.

I agree that PR #64 significantly improves the manuscript as discussion in Issue #61. Overall the paper nicely summarises the functionality of the package and provides some examples of use cases. I have some minor feedback on structure and grammar. Generally, I believe the paper is worth of acceptance with minor editing.

Contributions

  • Contribution and authorship: Has the submitting author (@aghaynes) made major contributions to the software Does the full list of paper authors seem appropriate and complete?
  • Substantial scholarly effort: Does this submission meet the scope eligibility described in the JOSS guidelines

As shown here @aghaynes has prepared the manuscript and got feedback other authors. Authorship seems to be appropriate to me.

Structure

  • Summary: Has a clear description of the high-level functionality and purpose of the software for a diverse, non-specialist audience been provided?
  • A statement of need: Does the paper have a section titled 'Statement of Need' that clearly states what problems the software is designed to solve and who the target audience is?

These are both well covered but I'd recommend merging them into one "Summary" section to avoid repetition. For example lines 9, 19, and 22 are similar.

Introduction

  • State of the field: Do the authors describe how this software compares to other commonly-used packages?

Normally I'd expect some discussion of alternatives but none seem to be available for "precision" sample sizes (or confidence intervals). I'd be willing to make an exception to this as under the circumstances but it could be helpful to provide some examples of "power" calculations for hypothesis testing. JOSS manuscripts are meant to be short but I think some comparisons here would be informative and related software (e.g., for power calculations in R) should be cited. As pointed out the paper this is complementary work.

Usage

As discussed in #61 I think this section is appropriate, especially as long-form vignette documentation (discussed here: #66) is not yet available.

Grammar

The writing is overall of high quality and easy to understand for non-experts. Some statistical jargon is unavoidable in this kind of work. There are a few sections that could be rephrased for clarity. These should be minor changes that will not take long. Please read the manuscript carefully for similar issues.

line 9, 20: we have therefore...

line 13: Sample size is a crucial step in for planning a clinical study.

line 13-14: A too small study that is too small leads to inconclusive results.

line 18: man research projects aim at to...

line 22: We programmed have developed an R package that...

Change "first" and "second" to "firstly" and "secondly".

line 35: we have also

line 42: can be installed and loaded into the R session...

line 53: we have developed

line 61: We often observe in our consulting activity that researchers try to implement a hypothesis-based approach

line 64 fascilitate -> facilitate, adequate -> appropriate

  • correct spelling and grammar (above)

References

References are formatted correctly but a few notable citations are missing.

  • Cite R packages for power calculations
  • Cite the R core team
> citation()

To cite R in publications use:

  R Core Team (2020). R: A language and environment for statistical computing. R Foundation for
  Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.

A BibTeX entry for LaTeX users is

  @Manual{,
    title = {R: A Language and Environment for Statistical Computing},
    author = {{R Core Team}},
    organization = {R Foundation for Statistical Computing},
    address = {Vienna, Austria},
    year = {2020},
    url = {https://www.R-project.org/},
  }

We have invested a lot of time and effort in creating R, please cite it when using it for data
analysis. See also ‘citation("pkgname")’ for citing R packages.

Questions

A limitation of the package is that it does not allow calculating the probability of a CI, i.e. the probability that a future confidence interval will have at least the desired precision.

It's great that the authors have acknowledged clearly and as it stands the packages is already very useful. Are there plans to add this in the future? How difficult would it be? Maintaining an R package is a commitment and I understand that time and funding to support this may be limited. As mentioned in the paper, investing in this will reduce the burden on consulting activities and aid researchers that do not have this expertise available.


This completes my review of the manuscript. I will test the latest version of the software and shiny app to complete the JOSS review.

Adding template text for sample size calculation reporting

Is your feature request related to a problem? Please describe.
Sample size calculation is often not transparently reported.

Describe the solution you'd like
This feature will help alleviate this issue by providing a paragraph to copy-paste/paraphrase into the publication/SAP/protocol. The paragraph could be displayed on each measures page below the replication code

Describe alternatives you've considered
None, I am all-in.

Please assign me the issue.

vignette

Is your feature request related to a problem? Please describe.
Not a problem, add a vignette as extra documentation.

mention in the JOSS review

Describe the solution you'd like
"real world" examples of how to use the package/functions.

Could also compare using classical power analysis...??

pre_riskratio lwr limit setting

Hi I need to extract sample size and rr possibilities which return a lwr >2.
How can I set this lwr in prec_riskratio?

Thank for your support
Pia

prediction model methods

error at installation due to remotes

remotes upgrades warnings during installation to errors resulting in the following (or a similar) error message...

√ checking for file 'C:\Users\XXX\AppData\Local\Temp\Rtmp8EQc6a\remotes1f3864265efc\CTU-Bern-presize-03aeee1/DESCRIPTION' ...

  • preparing 'presize':
    √ checking DESCRIPTION meta-information ...
  • checking for LF line-endings in source and make files and shell scripts
  • checking for empty or unneeded directories
  • building 'presize_0.0.1.9005.tar.gz'
  • installing source package 'presize' ...
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    Fehler: (konvertiert von Warnung) Paket 'ggplot2' wurde unter R Version 3.6.3 erstellt
    Ausführung angehalten
    ERROR: lazy loading failed for package 'presize'
  • removing 'C:/Program Files/R/R-3.6.0/library/presize'
    Error: Failed to install 'presize' from GitHub:
    (converted from warning) installation of package ‘C:/Users/XXX/AppData/Local/Temp/Rtmp8EQc6a/file1f387af6bc9/presize_0.0.1.9005.tar.gz’ had non-zero exit status

use Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS="true") to rectify.

Link to JOSS review

Review here

Code for badge:

Markdown:
[![DOI](https://joss.theoj.org/papers/10.21105/joss.03118/status.svg)](https://doi.org/10.21105/joss.03118)

HTML:
<a style="border-width:0" href="https://doi.org/10.21105/joss.03118">
  <img src="https://joss.theoj.org/papers/10.21105/joss.03118/status.svg" alt="DOI badge" >
</a>

reStructuredText:
.. image:: https://joss.theoj.org/papers/10.21105/joss.03118/status.svg
   :target: https://doi.org/10.21105/joss.03118

Badge looks like this
DOI

Citation (bibtex):

@article{Haynes2021,
  doi = {10.21105/joss.03118},
  url = {https://doi.org/10.21105/joss.03118},
  year = {2021},
  publisher = {The Open Journal},
  volume = {6},
  number = {60},
  pages = {3118},
  author = {Alan G. Haynes and Armando Lenz and Odile Stalder and Andreas Limacher},
  title = {`presize`: An R-package for precision-based sample size calculation in clinical research},
  journal = {Journal of Open Source Software}
}

Reporting error: sensitivity and specificity in shiny app

Describe the bug
Shiny app () returns error as shown:

ntot' required when 'prev' is specified

To Reproduce
See screenshots. Hosted locally with:

launch_presize_app()

Development version installed with remotes::install_github("aghaynes/presize"). Commit: aghaynes@a917c32

Expected behavior
Prevalence input is required by ShinyApp. It is possible to use a button to disable it. Slider could be removed from UI with conditional input.

Estimating sample size from conf.width without specifying n is not currently supported in Shiny App. Cannot specify ntot from Shiny App.

Screenshots

Screen Shot 2021-04-07 at 15 05 15
Screen Shot 2021-04-07 at 15 05 30

Desktop (please complete the following information):

R version 4.0.3 (2020-10-10)
 os       macOS Catalina 10.15.7      
 system   x86_64, darwin17.0          
   presize        * 0.2.2      2021-04-07 [1] Github (aghaynes/presize@a917c32)

Improve documentation

Review: documentation

Part of review for JOSS.

Examples

The following functions do not have an @examples or \examples field in their "man" or R files. Please add these so they are displayed in the R/RStudio help system.

  • prec_cor
  • prec_lim_agree
  • prec_or

Ideally several examples should be given, e.g., for Pearson and Spearman correlation and all examples should be well commented to explain the context for understanding use cases.

  • all examples commented

- [ ] usage for parameters without defaults explained in examples

Shiny App

The documentation for the shiny app needs more details. It is not clear before launching what the app does.

  • launch_presize_app

Building dev version of documentation

Documentation is not available for the dev version 0.2.1 installed from GitHub. These comments above are based on CRAN release 0.1.3 because of this, although the GitHub source seems to have missing examples also. Building the docs with devtools or roxygen2 before pushing to GitHub is recommended (it is required for uploading to CRAN)

  • build updated documentation
  • check docs are available in R help system before pushing to GitHub

Suggestions

The review does not hinge on these but are recommended for benefit of users understanding the software.

  • README: Providing a screenshot of the Shiny App would give a good preview on GitHub. Images can also be displayed in the R help system.
  • The package itself does not have a documentation page that can be accessed by help(presize-package) or just help(precize). See the examples "help(igraph-package)" or help(ggplot2-package).

Optional:

  • Vignette: A vignette is not required by CRAN but can be helpful to provide further context for examples.

sens/spec

prec_spec(spec=c(0.6, 0.7, 0.8, 0.9), n=56, method="wilson") 

     precision for a Specificity with wilson confidence interval. 

  sens   sensadj  n conf.width conf.level       lwr       upr
1  0.6 0.5935806 56  0.2485780       0.95 0.4692916 0.7178696

Issues:

  • The resulting CIs do not coincide with the method in Stata (cii proportions)
  • It should read: precision for a specificity with Wilson confidence interval
  • The column names should read ‘spec’ and ‘specadj’
  • It would be nice if the routine also runs if the total number (i.e. number of cases plus number of non-cases) and the prevalence (of cases) are given.

Improve community guidelines

Review: Community guidelines

Part of review for JOSS.

Contributing guidelines

Regarding this criteria, the Contributing guidleines are available (as requested in #61).

  1. Contribute to the software 2) Report issues or problems with the software 3) Seek support

However, efforts should be made to direct users to these and guide new users through this process (I note some have been made already).

  • provide contributing guidelines
  • direct users to them in the README
  • direct users to the GitHub repository from CRAN (DESCRIPTION)
  • direct users to the Issues for Bug Reports from CRAN (DESCRIPTION)
  • GitHub issues template for bug reports and feature requests
  • GitHub pull request template

Some of these are not strictly necessary for publication but are minor efforts that aid novice R users for bug reporting or seeking support via GitHub. See the community GitHub page for further recommendations.

Error in prec_meandiff()?

The function prec_meandiff(), in differences.R, has an expression called "md" where s is calculated with denominator n1 + n2 + 2 (line 98). Shouldn't that be n1 + n2 - 2?

Thanks,
Clay Ford

condition > 1 warning if passing multiple `conf.width`s to `prec_prop`

Describe the bug
warning re condition > 1 if passing multiple conf.widths to prec_prop

To Reproduce

> prec_prop(p = .36, conf.width = c(0.07, 0.08, 0.09, 0.1, 0.11))

     sample size for a proportion with Wilson confidence interval. 

     p      padj        n conf.width conf.level       lwr       upr
1 0.36 0.3607440 718.9930       0.07       0.95 0.3257440 0.3957440
2 0.36 0.3609716 549.6552       0.08       0.95 0.3209716 0.4009716
3 0.36 0.3612296 433.5577       0.09       0.95 0.3162296 0.4062296
4 0.36 0.3615177 350.5139       0.10       0.95 0.3115177 0.4115177
5 0.36 0.3618361 289.0708       0.11       0.95 0.3068361 0.4168361

NOTE: padj is the adjusted proportion, from which the ci is calculated.

Warning messages:
1: In prec_prop(p = 0.36, conf.width = c(0.07, 0.08, 0.09, 0.1, 0.11)) :
  more than one method was chosen, 'wilson' will be used
2: In if (conf.width < min(p)) { :
  the condition has length > 1 and only the first element will be used

Expected behavior
No warning

mean or mu?

The current arguments of prec_mean are mu and sigma, where statistically, it would make a lot of sense if they were mu and sigma, or mean and sd. I would opt for mu and sigma, since it describes the assumed true distribution.

Correcting this scores not so well on the tradeoff of correctness and backward compatibility. Maybe you could add a little comment in the argument descriptions.

checks

Range checks for all params complete

  • prec_auc
  • prec_cor
  • prec_icc
  • prec_kappa
  • prec_lim_agree
  • prec_lr
  • prec_mean
  • prec_meandiff
  • prec_neg_lr
  • prec_or
  • prec_pos_lr
  • prec_prop
  • prec_rate
  • prec_rateratio
  • prec_riskdiff
  • prec_sens
  • prec_spec

When a function is done, just check the box

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.