{"id":16386102,"url":"https://github.com/tmalsburg/binomialcris","last_synced_at":"2026-05-24T06:30:20.036Z","repository":{"id":66385049,"uuid":"133151540","full_name":"tmalsburg/binomialCRIs","owner":"tmalsburg","description":"R package with functions for calculating and plotting binomial credible intervals","archived":false,"fork":false,"pushed_at":"2018-05-12T17:21:11.000Z","size":214,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-15T00:42:45.928Z","etag":null,"topics":["bayesian","r","statistics"],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmalsburg.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-05-12T14:02:09.000Z","updated_at":"2020-02-11T21:40:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"6166125b-02e7-4a41-b5d1-e6362afe7483","html_url":"https://github.com/tmalsburg/binomialCRIs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmalsburg%2FbinomialCRIs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmalsburg%2FbinomialCRIs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmalsburg%2FbinomialCRIs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmalsburg%2FbinomialCRIs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmalsburg","download_url":"https://codeload.github.com/tmalsburg/binomialCRIs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240136987,"owners_count":19753645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bayesian","r","statistics"],"created_at":"2024-10-11T04:16:13.174Z","updated_at":"2026-05-24T06:30:19.954Z","avatar_url":"https://github.com/tmalsburg.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+PROPERTY: header-args:R :session *R*\n\nAn R package for calculating and plotting binomial credible intervals.  It was written for educational purposes and not necessarily for serious use.  \n\n* Installation\n#+BEGIN_SRC R :exports both :results value output\ndevtools::install_github(\"tmalsburg/binomialCRIs\")\n#+END_SRC\n\n* Usage examples\nNote: When plotting to PDF, use the function ~cairo_pdf()~ instead of ~pdf()~ to get Greek characters in the results.\n\n50% credible intervals after seeing 6 successes out of 9 trials, with flat prior:\n\n#+BEGIN_SRC R :exports both :results value output\nlibrary(binomialCRIs)\n\nbinomial_hpdi(n_successes=6, n_trials=9, prob=0.5, prior_shape1=1, prior_shape2=1)\n#+END_SRC\n\n#+RESULTS:\n:      |0.5      0.5| \n: 0.5643603 0.7593849\n\n#+BEGIN_SRC R :exports both :results output graphics :file plots/hpdi1.png\nplot_binomial_hpdi(6, 9, 0.5)\n#+END_SRC\n\n#+RESULTS:\n[[file:plots/hpdi1.png]]\n\n#+BEGIN_SRC R :exports both :results value output\nbinomial_pi(6, 9, 0.5)\n#+END_SRC\n\n#+RESULTS:\n:      |0.5      0.5| \n: 0.5423038 0.7391494\n\n#+BEGIN_SRC R :exports both :results output graphics :file plots/pi1.png\nplot_binomial_pi(6, 9, 0.5)\n#+END_SRC\n\n#+RESULTS:\n[[file:plots/pi1.png]]\n\n50% credible intervals after seeing 6 successes out of 9 trials, with prior assuming one earlier success and one earlier failure:\n\n#+BEGIN_SRC R :exports both :results value output\nbinomial_hpdi(6, 9, 0.5, 2, 2)\n#+END_SRC\n\n#+RESULTS:\n:      |0.5      0.5| \n: 0.5419229 0.7242251\n\n#+BEGIN_SRC R :exports both :results output graphics :file plots/hpdi2.png\nplot_binomial_hpdi(6, 9, 0.5, 2, 2)\n#+END_SRC\n\n#+RESULTS:\n[[file:plots/hpdi2.png]]\n\n#+BEGIN_SRC R :exports both :results value output\nbinomial_pi(6, 9, 0.5, 2, 2)\n#+END_SRC\n\n#+RESULTS:\n:      |0.5      0.5| \n: 0.5269063 0.7101529\n\n#+BEGIN_SRC R :exports both :results output graphics :file plots/pi2.png\nplot_binomial_pi(6, 9, 0.5, 2, 2)\n#+END_SRC\n\n#+RESULTS:\n[[file:plots/pi2.png]]\n\n50% credible intervals after seeing 7 successes our of 11 trials (equivalent to 6/9 with prior_shape1=2, beta=2):\n\n#+BEGIN_SRC R :exports both :results value output\nbinomial_hpdi(7, 11, 0.5, 1, 1)\n#+END_SRC\n\n#+RESULTS:\n:      |0.5      0.5| \n: 0.5419229 0.7242251\n\n#+BEGIN_SRC R :exports both :results output graphics :file plots/hpdi3.png\nplot_binomial_hpdi(7, 11, 0.5)\n#+END_SRC\n\n#+RESULTS:\n[[file:plots/hpdi3.png]]\n\n#+BEGIN_SRC R :exports both :results value output\nbinomial_pi(7, 11, 0.5)\n#+END_SRC\n\n#+RESULTS:\n:      |0.5      0.5| \n: 0.5269063 0.7101529\n\n#+BEGIN_SRC R :exports both :results output graphics :file plots/pi3.png\nplot_binomial_pi(7, 11, 0.5)\n#+END_SRC\n\n#+RESULTS:\n[[file:plots/pi3.png]]\n\n50% credible intervals after seeing 1 successes out of 2 trials, with flat prior:\n\n#+BEGIN_SRC R :exports both :results value output\nbinomial_hpdi(1, 1, 0.5)\n#+END_SRC\n\n#+RESULTS:\n:      |0.5      0.5| \n: 0.7070744 0.9999771\n\n#+BEGIN_SRC R :exports both :results output graphics :file plots/hpdi4.png\nplot_binomial_hpdi(1, 1, 0.5)\n#+END_SRC\n\n#+RESULTS:\n[[file:plots/hpdi4.png]]\n\n#+BEGIN_SRC R :exports both :results value output\nbinomial_pi(1, 1, 0.5)\n#+END_SRC\n\n#+RESULTS:\n:      |0.5      0.5| \n: 0.5000000 0.8660254\n\n#+BEGIN_SRC R :exports both :results output graphics :file plots/pi4.png\nplot_binomial_pi(1, 1, 0.5)\n#+END_SRC\n\n#+RESULTS:\n[[file:plots/pi4.png]]\n\nProbability of parameter being larger than 0.5 after seeing 6 successes out of 9 trials with flat prior:\n\n#+BEGIN_SRC R :exports both :results value output\nbinomial_prob(6, 9, 0.5)\n#+END_SRC\n\n#+RESULTS:\n: [1] 0.828125\n\nProbability of parameter being larger than 0.5 after seeing 6 successes out of 9 trials with prior assuming one earlier success and one earlier failure:\n\n#+BEGIN_SRC R :exports both :results value output\nbinomial_prob(6, 9, 0.5, prior_shape1=2, prior_shape2=2)\n#+END_SRC\n\n#+RESULTS:\n: [1] 0.8061523\n\nProbability of parameter being smaller than 0.5 after seeing 6 successes out of 9 trials with prior assuming one earlier success and one earlier failure:\n\n#+BEGIN_SRC R :exports both :results value output\nbinomial_prob(6, 9, prob_upper=0.5, prior_shape1=2, prior_shape2=2)\n#+END_SRC\n\n#+RESULTS:\n: [1] 0.1938477\n\nProbability of parameter being larger than 0.5 and smaller than 0.75 after seeing 6 successes our of 9 trials:\n\n#+BEGIN_SRC R :exports both :results value output\nbinomial_prob(6, 9, 0.5, 0.75)\n#+END_SRC\n\n#+RESULTS:\n: [1] 0.6040001\n\nPlot the same interval:\n\n#+BEGIN_SRC R :exports both :results output graphics :file plots/some_interval.png\nplot_binomial_cri(6, 9, 0.5, 0.75)\n#+END_SRC\n\n#+RESULTS:\n[[file:plots/some_interval.png]]\n\nProbability of parameter being smaller than 0.5 after seeing 6 successes our of 9 trials:\n\n#+BEGIN_SRC R :exports both :results value output\nbinomial_prob(6, 9, prob_upper=0.5)\n#+END_SRC\n\n#+RESULTS:\n: [1] 0.171875\n\nPlot:\n\n#+BEGIN_SRC R :exports both :results output graphics :file plots/some_interval2.png\nplot_binomial_cri(6, 9, prob_upper=0.5)\n#+END_SRC\n\n#+RESULTS:\n[[file:plots/some_interval2.png]]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmalsburg%2Fbinomialcris","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmalsburg%2Fbinomialcris","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmalsburg%2Fbinomialcris/lists"}