Interactive Clinical Research Simulator - Shiny Application. The simulator serves as a platform for learning important statistical concepts and interactive software for performing common clinical research tasks
- Motivation
- Blocks
- Requirements
- Download the app
- Install dependencies
- Run the app
- Project structure
- Troubleshooting
- Future plans
- Authors
- Researchers often do not code in R
- Interactive and visual approach makes easier to understand main statistical concepts
- Modelling clinical trials is an easy and effective way to explore statistical methods without having a real data
- Educational purposes: visual explanation of complex statistical ideas
Shiny allows to create interactive applications to make statistical decisions easier, visually and without coding
Important
Currently, the entire interface text is only in Russian
The first block is designed for modelling and testing statistical hypotheses. It allows you to see how sample means, confidence intervals, and p-values change when certain parameters are modified. The parameters are set in the sidebar: distribution type, mathematical expectation, sample size, and number of simulations, hypothesis, confidence level, and significance level.
This block includes five tabs:
-
The first tab presents the t-test results for a single generated sample. It displays the observations, sample mean, and confidence interval, indicating whether the confidence interval covers both the true and hypothetical mean. Below, the numerical results and the decision on whether to reject the null hypothesis are provided.
-
This tab shows the distribution of sample means when the experiment is repeated multiple times. When the true mean coincides with the hypothetical value, the distribution of sample means is centred around it. When the true mean differs, the distribution remains centred around the true value and is shifted relative to the hypothetical mean.
-
Here you can see the behaviour of confidence intervals in a series of repeated experiments. When the null hypothesis is true, most intervals cover the hypothetical value, and the rare cases of non-coverage correspond to a type I error. When the true mean differs from the hypothetical mean, the proportion of intervals that do not cover this value increases, leading to more frequent rejection of the null hypothesis.
-
On this tab the distribution of p-values is showed. When the null hypothesis is true, p-values are distributed approximately uniformly from 0 to 1. When the null hypothesis is false, p-values tend to be small and skewed towards zero.
-
Help tab, where you can find information about selected disribution and simulation structure.
The functionality of the second block allow simulating thousands of experiments and studying the dependence of Type 1 and Type 2 errors on various parameters. For each test you can select parameter and specify the grid (from, to, by) to iterate over. On each step N samples are generated, thus simulation may take a long time. You can specify number of CPUs for simulation for faster computation.
Parallel computation is implemented using furrr and future packages
| Number of CPUs used | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|
| Simulation time of Chi-Square test (29 steps grid, 10000 samples), s |
49.5 | 30.6 | 22.6 | 18.9 | 16.5 | 15.5 | 14 |
| Simulation time Brunner-Munzel test (9 steps grid, 1000 samples), s |
25 | 14.3 | 11.4 | 10.8 | 8.5 | 8.6 | 9.3 |
Tested on 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz, 8 cores. OS: Windows
- Compare the stability (Type I error) of Mann-Whitney and Brunner-Muzel tests to the difference in variances (SD) of two compared samples
- See Type I error dependence on non-normally distributed samples size when using t-test
- See sensitivity (Type I error) of the chi-square test to events with very low probabilities
This section helps to calculate sample size using classical methods.
For our application, we used the TrialSize (ver. 1.4.1) and two main functions: TwoSampleProportion and TwoSampleMean.
You can calculate sample size for both non-inferiority and superiority hypotheses types. You can specify the data type in the sidebar: whether it is quantitative or qualitative and so determine which formula will be used. The application displays text you can copy by clicking on the button and paste into your synopsis.
- R (>= 4.5 recommended)
- Internet access for first-time package installation
Clone with Git:
git clone https://github.com/BIOSTAT/CLISHI_PROJECT.git
cd CLISHI_PROJECTOR download a ZIP:
- Go to the GitHub repository page.
- Click Code → Download ZIP.
- Unzip the archive and open the folder in R.
From the project root in R:
source("install.R")OR install dependencies manually:
ggplot2dplyrtidyrshinyshinydashboardshinyjsshinycssloadersDTrclipboardfurrrfuturefuture.callrcheckmateTrialSize
From the project root in R:
shiny::runApp("app.R")app.R- main Shiny app entry pointscripts/- modular code for UI, calculations, and plotswww/- static assets (CSS/JS/images)install.R- installs required R packages
- If you see missing-package errors, rerun
source("install.R"). - If a CRAN mirror is required, set one before installing:
options(repos = c(CRAN = "https://cloud.r-project.org"))- Sequential/adaptive designs
- Bioequivalence studies
- Survival analysis
- Longitudinal studies
- Regression modeling (linear, logistic, Cox)



