Compare Statistical Distributions by Density Plot | shiny Application -Part2

Comparing two distribution functions
Computer Softwares R langauageLeave a Comment on Compare Statistical Distributions by Density Plot | shiny Application -Part2

Compare Statistical Distributions by Density Plot | shiny Application -Part2

In the previous article entitled Statistical Distribution and Its Density Plot Shiny Application – Part 1, we learned how to draw the graph of the density function of a distribution by generating random numbers from that distribution. In this article, we will solve the disadvantages and problems that existed in the previous program and provide the possibility of Compare Statistical Distributions by density plot.


We mentioned that if the parameters selected by the user do not match the statistical distribution, the previous program would not report an error, but it would not be able to draw the statistical distribution graph either. In this section, we want to fix this problem and if the user parameter does not match the set of parameter values, an error message will appear. On the other hand, to compare two statistical distributions, we also want to draw two overlapped graphs of the density function of both distributions. We will also use a list to select each distribution. The choice of color as well as the parameters of each distribution will be specified in this section of the article. Remember that we will do this using the shiny library.

Compare Statistical Distributions by Density Plot

Part 1

First of all, a library (shinyalert) is added to the program for handling errors of out-of-range parameters.

Part 2

Now, some codes are added to recognized errors and alarm the user. This part must lay down on server part. beware that these functions are related to shinyalert library.

Part 3

Other parameters (such as normal or F distributions) values are check by their values limitation. such as the code below:

Compare statistical distributions by density plot must ensure that all parameters are suitable and compatible for that distribution.

The min value controls the minimum value to the parameter and value shows its default value.

Part 4

The GUI interface to show two distributions and their parameters are in the part 4

Even if you change the order of each part of codes, the result will not change.

Part 5

Notice that some changes must be done in UI layer for comparing two distributions.

Part 6

Ruuning code and show the interface is located in this part.

Whole code and orders of procedures

The result is something like window as picture below.

Compare Statistical Distributions by Density Plot| A Shiny Application

Compare Statistical Distribution
Compare Statistical Distribution

 

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top