The SOCR RShiny probability distribution calculators provide interactive vizualizations of probability densities, mass functions, and cumulative distributions, e.g., bivariate normal distribution.
The most current version is V0.9, deployed at here. The release can be find here.
SOCR Team including Ivo D. Dinov, Jared Chai, and others.
The code is organized as follows:
ui.Randserver.Rare the main files for the RShiny app.global.Rcontains the global variables and functions.dataset.Rcontains the initialization and pre-processing of the dataset.fitFunctions.Rcontains the functions for fitting the distribution in modeler.distributionInfo.Rcontains the functions for getting the distribution information. The information is stored indistribution_info.yaml.plotlyFunctions/*.Rcontain the functions for plotting distributions.renderMainPlot.Rcontains the functions for rendering the main plot.renderProbabilitt.Rcontains the functions for rendering the probabilities calculated.
Other files are mostly for testing and debugging and less important.
-
Using RStudio is the easiest way to develop and the app almost out-of-box. However, if you want to use other IDEs like VSCode, use
renvto manage the packages. Therenv.lockfile is already included in the repo. To install the packages, runrenv::restore()in the R console. You may need to install other dependencies manually to install the packages, if there's error message saying so. -
To support a new distribution:
- Add the distribution information in
distribution_info.yaml. Note that thefitFuncfield indicates the function for fitting the distribution in modeler, and theplotlyFuncfield indicates the function for plotting the distribution in calculator. - This distribution will be read by functions in
distributionInfo.Rinto a list of typedistributionInfoClass. - Then the corresponding distributionInfo object will be included in the
distributionInfoListinglobal.R. - Add corresponding functions in
plotlyFunctions/*.Rfor plotting the distribution in calculator, and add functions infitFunctions.Rfor fitting the distribution in modeler.
- Add the distribution information in
-
To support more existing distributions in modeler:
- Implement the corresponding fitting function in
fitFunctions.R. - That's it! The distribution will be automatically supported by the modeler.
- Implement the corresponding fitting function in
This work is supported in part by NIH grants P20 NR015331, UL1TR002240, P30 DK089503, UL1TR002240, and NSF grants 1916425, 1734853, 1636840, 1416953, 0716055 and 1023115. Students, trainees, scholars, and researchers from SOCR, BDDS, MIDAS, MICHR, and the broad R-statistical computing community have contributed ideas, code, and support.
- Probability Distributome Calculators, the Distributome Navigator, XML distribution metadata, and XML DB validator.
- Deployed RShiny Webapp.
- Bivariate Normal Distribution Calculator and the SOCR Bivariate Normal Distribution Activity.
- SOCR Distributions and distribution activities.
- Sample finished to-do item.
- There should be histogram indicating the original dataset along with the distribution curve plot. Part of the code is already in the branch
sub, but it only works for the normal distribution. Need to generalize it. - To generalize the histogram, we may need to extract the similar code in plotlyFunctions into a separate function. Otherwise we have to repeat the code for histogram 70+ times for each distribution. Currently the code is mostly duplicated but slightly different in these functions, which makes it very hard to extract the common code.
- Deploy to SOCR server. Update the
LINK_NEEDEDin this README. - Support more existing distributions in modeler. Currently only very few distributions are supported in modeler. To do this, follow the guidelines in the section above.

