{"id":21348074,"url":"https://github.com/vikjam/pwrcalc","last_synced_at":"2025-07-12T17:32:10.201Z","repository":{"id":144968026,"uuid":"72649268","full_name":"vikjam/pwrcalc","owner":"vikjam","description":"Power calculations in R that produce results familiar to Stata users.","archived":false,"fork":false,"pushed_at":"2025-06-20T05:06:52.000Z","size":1698,"stargazers_count":5,"open_issues_count":5,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-20T06:20:42.541Z","etag":null,"topics":["economics","experimental-design","statistics"],"latest_commit_sha":null,"homepage":"http://pwrcalc.readthedocs.io/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vikjam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-11-02T14:44:00.000Z","updated_at":"2025-06-20T05:06:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"12f22759-23b9-43f0-91e1-03e4dbf31328","html_url":"https://github.com/vikjam/pwrcalc","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/vikjam/pwrcalc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikjam%2Fpwrcalc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikjam%2Fpwrcalc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikjam%2Fpwrcalc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikjam%2Fpwrcalc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vikjam","download_url":"https://codeload.github.com/vikjam/pwrcalc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikjam%2Fpwrcalc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265025551,"owners_count":23699769,"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":["economics","experimental-design","statistics"],"created_at":"2024-11-22T02:17:48.653Z","updated_at":"2025-07-12T17:32:10.188Z","avatar_url":"https://github.com/vikjam.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pwrcalc \u003ca href=\"https://dplyr.tidyverse.org\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"138\" /\u003e\u003c/a\u003e\n\nPower calculations in R that produce results familiar to Stata users.\n\n[![Travis-CI Build Status](https://travis-ci.org/vikjam/pwrcalc.svg?branch=master)](https://travis-ci.org/vikjam/pwrcalc) [![Documentation Status](https://readthedocs.org/projects/pwrcalc/badge/?version=latest)](http://pwrcalc.readthedocs.io/en/latest/?badge=latest) [![Join the chat at https://gitter.im/pwrcalc/Lobby](https://badges.gitter.im/pwrcalc/Lobby.svg)](https://gitter.im/pwrcalc/Lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n## Quick Start\nCheck out the [Read the Docs](http://pwrcalc.readthedocs.io/en/latest/?badge=latest) page for more detailed information.\n\n### Installation\n\nUsing the R package [`devtools`](https://www.rstudio.com/products/rpackages/devtools/), you can easily install `pwrcalc`.\n```{r}\ndevtools::install_github('vikjam/pwrcalc')\n```\n\n`devtools`includes a lot of extras functionality and dependencies. Alternatively, you just want to use [`remotes`](https://github.com/r-lib/remotes). \n```{r}\ninstall.packages(\"remotes\")\nremotes::install_github('vikjam/pwrcalc')\n```\n\nIf you'd prefer installing the package without `devtools` or `ghit`, you can download the [latest release](https://github.com/vikjam/pwrcalc/releases) and [install the zipped packaged](http://outmodedbonsai.sourceforge.net/InstallingLocalRPackages.html).\n\n### Usage\nSuppose we want to detect a difference of 4 between two groups (e.g., control and treatment). For example, we anticipate the control group mean being 12 and the treatment group mean being 16. In addition, suppose the standard deviation of each group is 5. We can calculate the sample size required with `pwrcalc`,\n\n```{r}\nlibrary(pwrcalc)\ntwomeans(m1 = 12, m2 = 16, sd = 5)\n```\nwhich gives us the following output.\n```{r}\n     Two-sample t-test power calculation \n\n             m1 = 12\n             m2 = 16\n             n1 = 25\n             n2 = 25\n      sig.level = 0.05\n          power = 0.8\n    alternative = two.sided\n\nNOTE: m1 and m2 are the means of group 1 and 2, respectively.\nn1 and n2 are the obs. of group 1 and 2, respectively.\n```\nNow suppose we're worried about correlation between clusters. Then use the `clustered` command to account for the correlation,\n```{r}\ntwomeans(m1 = 12, m2 = 16, sd = 5) %\u003e% clustered(obsclus = 10, rho = 0.3)\n```\nwhich tells us we'll need a larger sample to detect the same effect.\n```{r}\n     Two-sample t-test power calculation \n\n                m1 = 12\n                m2 = 16\n   n1 (unadjusted) = 25\n   n2 (unadjusted) = 25\n     n1 (adjusted) = 93\n     n2 (adjusted) = 93\n               rho = 0.3\n  Avg. per cluster = 93\nMin. # of clusters = 10\n         sig.level = 0.05\n             power = 0.8\n       alternative = two.sided\n\nNOTE: m1 and m2 are the means of group 1 and 2, respectively.\nn1 and n2 are the obs. of group 1 and 2, respectively.\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikjam%2Fpwrcalc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvikjam%2Fpwrcalc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikjam%2Fpwrcalc/lists"}