
shinySim
[!IMPORTANT] You are viewing the
developmentbranch. It has new features and bug fixes that are not yet in the stable version onmain, including exact expected variances for interactions of any order, built-in checks of the printed code, and fixes for printed code that could fail or simulate a different model. See what’s new and fixed and how to install either version.
shinySim is a point-and-click interface to the squidSim package. It lets you build structured simulations — predictors and variance components across the levels of a hierarchical data structure — without writing the simulation call by hand.
Features
-
Start from your data structure. Pass in a structure made with
squidSim::make_structure()(or any data frame of grouping factors) and build the simulation on its levels. - Set variance components per level. Add random effects, predictors, fixed (categorical) effects, covariates and interactions, with their betas, means and (co)variances.
- See the equations as you go. The app writes out the model being simulated, so what you are building stays legible.
- See the expected variance decomposition. The app calculates the expected mean and variance of the response, and how the variance divides among hierarchical levels and predictors. The grand variance and the predictor table include the covariances that fixed effects, interactions and covariates create; the table by level leaves out covariances between components, so it may not add up to the grand variance. Each time you add or update a component, the app also runs a quick squidSim simulation and warns you if its variance differs from the expected value by more than 10%, or its mean by more than 0.1 standard deviations.
-
Get the code back. The app shows the
parameterslist for squidSim, with a button to copy it, so simulations remain reproducible outside the app. To generate data, paste it into R and runsim <- squidSim::simulate_population(data_structure = data_test, parameters = parameters), thensquidSim::get_population_data(sim). If you used no data structure, give the sample size withn =instead ofdata_structure =. - Runs locally. Nothing is uploaded anywhere.
Installation
shinySim is not on CRAN, but you can install it from GitHub using the pak package. There are two versions:
Stable version (the main branch):
install.packages("pak")
pak::pak("squidgroup/shinySim")Development version (the development branch), with the latest features and bug fixes (what’s new and fixed):
pak::pak("squidgroup/shinySim@development")To check which version you have, run packageVersion("shinySim"): 0.0.0.9000 is the stable version and 0.0.0.9001 the development version. To switch between them, run the other install command.
Then load it with library(shinySim).
This will also install squidSim, which is not on CRAN.
Usage
The only function is shinySim(). It can be run without any arguments:
Or you can provide a data structure created in squidSim (or elsewhere):
Arguments
| Argument | Purpose |
|---|---|
data.struc |
A data structure created with squidSim::make_structure() or an equivalent data frame. Optional — without one, only observation-level predictors and interactions can be added. |
Bug reports and contributions
Please file issues and feature requests at https://github.com/squidgroup/shinySim/issues. Pull requests are welcome.
Before reporting a bug, please install the development version (see Installation) and check whether the problem is still there. Many bugs are already fixed on the development branch; they are listed in NEWS.md. When you file an issue, please include the output of packageVersion("shinySim") and sessionInfo().
Issues with the underlying simulation engine belong upstream at squidgroup/squidSim.
Citation
Please cite the package:
Ivimey-Cook, E. R., & Pick, J. L. (2026). shinySim: Build squidSim simulations of hierarchical data in a point-and-click app. R package version 0.0.0.9001. https://github.com/squidgroup/shinySim
A machine-readable CITATION.cff is included, so GitHub’s “Cite this repository” button gives formatted APA and BibTeX.
Contact
Edward R. Ivimey-Cook — e.ivimeycook@gmail.com — ORCID 0000-0003-4910-0443
License
Released under the MIT License.
