simhelpers
Helper package to assist in running simulation studies
Science Score: 39.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 4 DOI reference(s) in README -
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.5%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
Helper package to assist in running simulation studies
Basic Info
Statistics
- Stars: 12
- Watchers: 2
- Forks: 3
- Open Issues: 6
- Releases: 2
Created over 6 years ago
· Last pushed 11 months ago
Metadata Files
Readme
Changelog
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/",
out.width = "100%"
)
```
# simhelpers
[](https://github.com/meghapsimatrix/simhelpers/actions/workflows/R-CMD-check.yaml) [](https://app.codecov.io/gh/meghapsimatrix/simhelpers?branch=master) [](https://CRAN.R-project.org/package=simhelpers) [](https://lifecycle.r-lib.org/articles/stages.html#stable) [](https://CRAN.R-project.org/package=simhelpers) [](https://CRAN.R-project.org/package=simhelpers)
Monte Carlo simulations are computer experiments designed to study the performance of statistical methods under known data-generating conditions (Morris, White, & Crowther, 2019). Methodologists use simulations to examine questions such as: (1) how does ordinary least squares regression perform if errors are heteroskedastic? (2) how does the presence of missing data affect treatment effect estimates from a propensity score analysis? (3) how does cluster robust variance estimation perform when the number of clusters is small? To answer such questions, we conduct experiments by simulating thousands of datasets based on pseudo-random sampling, applying statistical methods, and evaluating how well those statistical methods recover the true data-generating conditions (Morris et al., 2019).
The goal of `simhelpers` is to assist in running simulation studies. The package includes two main tools. First, it includes a collection of functions to calculate measures of estimator performance such as bias, root mean squared error, rejection rates, and confidence interval coverage. The functions also calculate the associated Monte Carlo standard errors (MCSE) of the performance measures. These functions are divided into three major categories of performance criteria: absolute criteria, relative criteria, and criteria to evaluate hypothesis testing. The functions are designed to play well with [`dplyr`](https://dplyr.tidyverse.org/index.html) and fit easily into a `%>%`-centric workflow (Wickham et al., 2019).
In addition to the set of functions that calculates performance measures and MCSE, the package includes some further convenience functions to assist in programming simulations. These include `bundle_sim()`, which can be used to create a single function for running a simulation from component pieces. The function takes a function for generating data, a function for analyzing the data, and (optionally) a function for summarizing the results, and constructs a single function for running a full simulation given a set of parameter values and optional arguments, or what we call a "simulation driver." The simulation driver function can then be applied to a parameter set using `evaluate_by_row()` to execute simulations across multiple conditions.
Finally, the package also includes a function, `create_skeleton()`, that generates a skeleton outline for a simulation study. Another function, `evaluate_by_row()`, runs the simulation for each combination of conditions row by row. This function uses [`future_pmap()`](https://davisvaughan.github.io/furrr/reference/future_map2.html) from the [`furrr`](https://davisvaughan.github.io/furrr/) package, making it easy to run the simulation in parallel (Vaughan & Dancho, 2018). The package also includes several datasets that contain results from example simulation studies.
## Installation
Install the latest release from CRAN:
``` r
install.packages("simhelpers")
```
Install the development version from [GitHub](https://github.com/):
``` r
# install.packages("devtools")
devtools::install_github("meghapsimatrix/simhelpers")
```
## Related Work
Our explanation of MCSE formulas and our general simulation workflow is closely aligned with the approach described by Morris et al. (2019). We want to recognize several other R packages that offer functionality for conducting Monte Carlo simulation studies. In particular, the [`rsimsum`](https://CRAN.R-project.org/package=rsimsum) package (which has a lovely name that makes me hungry) also calculates Monte Carlo standard errors (Gasparini, 2018). The [`SimDesign`](https://CRAN.R-project.org/package=SimDesign) package implements a generate-analyze-summarize model for writing simulations, which provided inspiration for our `bundle_sim()` tools. [`SimDesign`](https://CRAN.R-project.org/package=SimDesign) also includes tools for error handling and parallel computing (Chalmers, 2019).
In contrast to the two packages mentioned above, our package is designed to be used with [`dplyr`](https://dplyr.tidyverse.org/index.html), [`tidyr`](https://tidyr.tidyverse.org/) and [`purrr`](https://purrr.tidyverse.org/) syntax (Wickham et al., 2019). The functions that calculate MCSEs are easy to run on grouped data. For parallel computing, `evaluate_by_row()` uses the [`furrr`](https://davisvaughan.github.io/furrr/) and [`future`](https://rstudio.github.io/promises/articles/futures.html) packages (Bengtsson, 2020; Vaughan & Dancho, 2018). Moreover, in contrast to the `rsimsum` and `SimDesign` packages, `simhelpers` provides jack-knife MCSE for variance estimators. It also provides jack-knife MCSE estimates for root mean squared error.
Another related project is [`DeclareDesign`](https://declaredesign.org/), a suite of packages that allow users to declare and diagnose research designs, fabricate mock data, and explore tradeoffs between different designs (Blair et al., 2019). This project follows a similar model for how simulation studies are instantiated, but it uses a higher-level API, which is tailored for simulating certain specific types of research designs. In contrast, our package is a simpler set of general-purpose utility functions.
Other packages that have similar aims to `simhelpers` include: [MonteCarlo](https://CRAN.R-project.org/package=MonteCarlo), [parSim](https://CRAN.R-project.org/package=parSim), [simsalapar](https://CRAN.R-project.org/package=simsalapar), [simulator](https://CRAN.R-project.org/package=simulator), [simstudy](https://CRAN.R-project.org/package=simstudy), [simTool](https://CRAN.R-project.org/package=simTool), [simSummary](https://CRAN.R-project.org/package=simSummary), and [ezsim](https://CRAN.R-project.org/package=ezsim).
# Acknowledgments
We are grateful for the feedback provided by Danny Gonzalez, [Sangdon Lim](https://sdlim.com/), Man Chen, and [Edouard Bonneville](https://github.com/edbonneville).
# References
Bengtsson, H. (2020). future: Unified parallel and distributed processing in r for everyone. Retrieved from
Blair, G., Cooper, J., Coppock, A., & Humphreys, M. (2019). Declaring and diagnosing research designs. American Political Science Review, 113(3), 838–859. Retrieved from
Chalmers, P. (2019). SimDesign: Structure for organizing Monte Carlo simulation designs. Retrieved from
Gasparini, A. (2018). rsimsum: Summarise results from Monte Carlo simulation studies. Journal of Open Source Software, 3(26), 739.
Morris, T. P., White, I. R., & Crowther, M. J. (2019). Using simulation studies to evaluate statistical methods. Statistics in Medicine, 38(11), 2074–2102.
Vaughan, D., & Dancho, M. (2018). furrr: Apply mapping functions in parallel using futures. Retrieved from
Wickham, H., Averick, M., Bryan, J., Chang, W., McGowan, L. D., François, R., … Yutani, H. (2019). Welcome to the tidyverse. Journal of Open Source Software, 4(43), 1686.
Owner
- Name: Megha Joshi
- Login: meghapsimatrix
- Kind: user
- Location: Austin, TX
- Website: meghapsimatrix.com
- Repositories: 5
- Profile: https://github.com/meghapsimatrix
Quantitative Methodologist. Statistician. Interested in causal inference, meta-analysis, and R. she/her/hers
GitHub Events
Total
- Issues event: 5
- Watch event: 2
- Delete event: 2
- Issue comment event: 2
- Push event: 26
- Pull request event: 11
- Create event: 2
Last Year
- Issues event: 5
- Watch event: 2
- Delete event: 2
- Issue comment event: 2
- Push event: 26
- Pull request event: 11
- Create event: 2
Committers
Last synced: over 3 years ago
All Time
- Total Commits: 589
- Total Committers: 3
- Avg Commits per committer: 196.333
- Development Distribution Score (DDS): 0.031
Top Committers
| Name | Commits | |
|---|---|---|
| meghapsimatrix | 3****x@u****m | 571 |
| jepusto | j****o@g****m | 16 |
| sangdonlim | 4****m@u****m | 2 |
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 27
- Total pull requests: 12
- Average time to close issues: 5 months
- Average time to close pull requests: about 11 hours
- Total issue authors: 7
- Total pull request authors: 2
- Average comments per issue: 1.37
- Average comments per pull request: 0.0
- Merged pull requests: 10
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 6
- Pull requests: 9
- Average time to close issues: about 1 month
- Average time to close pull requests: about 2 hours
- Issue authors: 2
- Pull request authors: 1
- Average comments per issue: 0.33
- Average comments per pull request: 0.0
- Merged pull requests: 7
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- jepusto (10)
- meghapsimatrix (9)
- lmiratrix (4)
- manchen07 (1)
- DMSwan (1)
- edbonneville (1)
- DavisVaughan (1)
Pull Request Authors
- jepusto (13)
- SangdonLim (1)
Top Labels
Issue Labels
enhancement (4)
help wanted (1)
bug (1)
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 354 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 7
- Total maintainers: 1
cran.r-project.org: simhelpers
Helper Functions for Simulation Studies
- Homepage: https://meghapsimatrix.github.io/simhelpers/
- Documentation: http://cran.r-project.org/web/packages/simhelpers/simhelpers.pdf
- License: GPL-3
-
Latest release: 0.3.1
published over 1 year ago
Rankings
Forks count: 14.9%
Stargazers count: 17.0%
Dependent packages count: 29.8%
Average: 31.6%
Dependent repos count: 35.5%
Downloads: 60.7%
Maintainers (1)
Last synced:
11 months ago
Dependencies
DESCRIPTION
cran
- R >= 2.10 depends
- Rdpack * imports
- dplyr * imports
- furrr * imports
- magrittr * imports
- rlang * imports
- rstudioapi * imports
- stats * imports
- tibble * imports
- tidyr * imports
- broom * suggests
- covr * suggests
- future * suggests
- ggplot2 * suggests
- kableExtra * suggests
- knitr * suggests
- pkgdown * suggests
- plyr * suggests
- purrr * suggests
- rmarkdown * suggests
- testthat * suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/build.yml
actions
- JamesIves/github-pages-deploy-action 4.1.4 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage-covr.yaml
actions
- actions/checkout v4 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite