FreddyHernandez commited on
Commit
78e71c1
1 Parent(s): 7977508

Upload 2 files

Browse files
Files changed (2) hide show
  1. server.R +22 -0
  2. ui.R +52 -0
server.R ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ library(shiny)
2
+
3
+ shinyServer(function(input, output)
4
+ {
5
+
6
+ output$grafico1 <- renderPlot({
7
+ require(gamlss)
8
+ curve(dZAGA(x, input$mu, input$sigma, input$nu),
9
+ from=0, to=input$x.max, ylab="Densidad",
10
+ las=1, lwd=3, col="deepskyblue3")
11
+ grid()
12
+ })
13
+
14
+ output$github <- renderText({
15
+ esperanza <- (1 - input$nu) * input$mu
16
+ varianza <- (1 - input$nu) * input$mu^2 * (input$nu + input$sigma^2)
17
+ paste(c("Para esos parametros E(X)=", esperanza,
18
+ "con Var(X)=", varianza))
19
+ })
20
+
21
+ })
22
+
ui.R ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ library(shiny)
3
+
4
+ # Define UI for application that draws a histogram
5
+ shinyUI(fluidPage(
6
+
7
+ # Application title
8
+ titlePanel("Distribución Gamma aumentada con ceros"),
9
+
10
+ # Sidebar with a slider input for the number of bins
11
+ sidebarLayout(
12
+ sidebarPanel(
13
+ p("Zero Adjusted Gamma distribution (ZAGA)"),
14
+ br(),
15
+ p("Modifique los valores de los parámetros y observe
16
+ lo que sucede con la densidad."),
17
+ br(),
18
+ numericInput(inputId = "mu",
19
+ label = HTML("Ingrese el valor de &mu;:"),
20
+ min = 0.1,
21
+ value = 0.7,
22
+ step= 0.1),
23
+ numericInput(inputId = "sigma",
24
+ label = HTML("Ingrese el valor de &sigma;:"),
25
+ min = 0.1,
26
+ value = 0.3,
27
+ step= 0.1),
28
+ sliderInput(inputId = "nu",
29
+ label = HTML("Ingrese el valor de &nu;:"),
30
+ min = 0.01,
31
+ max = 0.99,
32
+ value = 0.2,
33
+ step = 0.01),
34
+ sliderInput(inputId = "x.max",
35
+ label = "Ingrese el máximo valor de x para mostrar en el gráfico:",
36
+ min = 5,
37
+ max = 20,
38
+ value = 5,
39
+ step = 1),
40
+ br(),
41
+ p("App creada por el Semillero de R de la Universidad Nacional de Colombia:"),
42
+ tags$a(href="https://srunal.github.io/", "https://srunal.github.io/")
43
+ ),
44
+
45
+ # Show a plot of the generated distribution
46
+ mainPanel(
47
+ h3("Densidad para la distribución ZAGA", align = "center"),
48
+ plotOutput("grafico1"),
49
+ verbatimTextOutput('github')
50
+ )
51
+ )
52
+ ))