November 19, 2017

Histogram of Random Numbers

I have developed this for tutors of stats. The tutors can use this to show that as sample size goes below 30, the distributions becomed more skewed. Higher sample sizes gives a bell shaped curve which is indicative of normality. The codes for this are based on the tutorials by the course lecturer Brian Caffo.

The Architectural Elements

  • An Input field for selecting the sample size
  • A field to select the range of standard deviation
  • An output panel that displays the histogram
  • ui.R and server.R files are created and deployed on shiny server

Resources Used

  • ShinyR
  • R Studio

Link to Shiny App

The codes are below:

ui.R

shinyUI(fluidPage( titlePanel("Check how distribution of random number changes for values > than 30"), sidebarLayout( sidebarPanel( numericInput("numeric", "How Many Random Numbers Should be Plotted (between 1 and 50000)", value = 30, min = 1, max = 50000, step = 1), sliderInput("sliderX", "choose the minimum and maximum standardised values", -3, 3, value = c(-2, 2)) ), mainPanel( h3("histogram of your selection"), plotOutput("histogram") ) ) )) ### server.R library(shiny) shinyServer(function(input, output) { output\(histogram <- renderPlot({ set.seed(5000) number_of_points <- input\)numeric minX <- input\(sliderX[1] maxX <- input\)sliderX[2] dataX <- runif(number_of_points, minX, maxX) hist(dataX, xlim = c(-3, 3)) }) })