Spaces:
Sleeping
Sleeping
FreddyHernandez
commited on
Commit
•
abd9fac
1
Parent(s):
dca48dd
Upload 2 files
Browse files
server.R
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
library(shiny)
|
2 |
+
|
3 |
+
shinyServer(function(input, output)
|
4 |
+
{
|
5 |
+
|
6 |
+
output$grafico1 <- renderPlot({
|
7 |
+
curve(dweibull(x, shape=input$shape, scale=input$scale),
|
8 |
+
from=0, to=input$x.max, ylab="Densidad",
|
9 |
+
las=1, lwd=3, col="deepskyblue3")
|
10 |
+
grid()
|
11 |
+
})
|
12 |
+
|
13 |
+
output$med_var <- renderText({
|
14 |
+
a <- input$shape
|
15 |
+
b <- input$scale
|
16 |
+
esperanza <- b * gamma(1+1/a)
|
17 |
+
varianza <- b^2 * (gamma(1 + 2/a) - (gamma(1 + 1/a))^2)
|
18 |
+
paste(c("Para esta configuración E(X) =", round(esperanza, 2),
|
19 |
+
"con Var(X) =", round(varianza, 2)))
|
20 |
+
})
|
21 |
+
|
22 |
+
})
|
ui.R
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
library(shiny)
|
2 |
+
|
3 |
+
shinyUI(fluidPage(
|
4 |
+
|
5 |
+
# Application title
|
6 |
+
titlePanel("Distribución Weibull"),
|
7 |
+
|
8 |
+
sidebarLayout(
|
9 |
+
sidebarPanel(
|
10 |
+
HTML("Modifique los valores de los parámetros y
|
11 |
+
observe lo que sucede con la densidad."),
|
12 |
+
br(),
|
13 |
+
br(),
|
14 |
+
sliderInput(inputId = "shape",
|
15 |
+
label = HTML("Ingrese el valor del parámetro shape:"),
|
16 |
+
min = 0.001,
|
17 |
+
max = 30,
|
18 |
+
value = 1.7,
|
19 |
+
step= 0.1,
|
20 |
+
animate =TRUE),
|
21 |
+
sliderInput(inputId = "scale",
|
22 |
+
label = HTML("Ingrese el valor del parámetro scale:"),
|
23 |
+
min = 0.001,
|
24 |
+
max = 30,
|
25 |
+
value = 1.5,
|
26 |
+
step= 0.1,
|
27 |
+
animate =TRUE),
|
28 |
+
sliderInput(inputId = "x.max",
|
29 |
+
label = "Ingrese el máximo valor de x para
|
30 |
+
mostrar en el gráfico:",
|
31 |
+
min = 1,
|
32 |
+
max = 100,
|
33 |
+
value = 9,
|
34 |
+
step = 1),
|
35 |
+
br(),
|
36 |
+
p("App creada por el Semillero de R de la Universidad Nacional de Colombia:"),
|
37 |
+
tags$a(href="https://srunal.github.io/",
|
38 |
+
"https://srunal.github.io/")
|
39 |
+
),
|
40 |
+
|
41 |
+
# Show a plot of the generated distribution
|
42 |
+
mainPanel(
|
43 |
+
h3("Densidad para la distribución Weibull", align = "center"),
|
44 |
+
plotOutput("grafico1"),
|
45 |
+
verbatimTextOutput('med_var')
|
46 |
+
)
|
47 |
+
)
|
48 |
+
))
|