Spaces:
Sleeping
Sleeping
FreddyHernandez
commited on
Commit
•
a1a40ff
1
Parent(s):
cf7c92e
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 |
+
varianza <- pi^2/(3*input$scale^2)
|
8 |
+
desv <- sqrt(varianza)
|
9 |
+
curve(dlogis(x, input$location, input$scale),
|
10 |
+
from=-input$distribuciones*desv+input$location, to=input$location + input$distribuciones*desv, ylab="Densidad",
|
11 |
+
las=1, lwd=3, col="deepskyblue3")
|
12 |
+
grid()
|
13 |
+
})
|
14 |
+
|
15 |
+
output$github <- renderText({
|
16 |
+
esperanza <- input$location
|
17 |
+
varianza <- pi^2/(3*input$scale^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,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
library(shiny)
|
2 |
+
|
3 |
+
shinyUI(fluidPage(
|
4 |
+
|
5 |
+
# Application title
|
6 |
+
titlePanel("Distribución Logística"),
|
7 |
+
|
8 |
+
sidebarLayout(
|
9 |
+
sidebarPanel(
|
10 |
+
p("Modifique los valores de los parámetros y observe
|
11 |
+
lo que sucede con la densidad."),
|
12 |
+
br(),
|
13 |
+
numericInput(inputId = "location",
|
14 |
+
label = p("Ingrese el valor del parámetro Location:"),
|
15 |
+
min = -Inf,
|
16 |
+
max = Inf,
|
17 |
+
value = 0.7,
|
18 |
+
step= 0.1),
|
19 |
+
sliderInput(inputId = "scale",
|
20 |
+
label = p("Ingrese el valor del parámetro Scale:"),
|
21 |
+
min = 0.1,
|
22 |
+
max = 10,
|
23 |
+
value = 0.3,
|
24 |
+
step= 0.1,
|
25 |
+
animate = TRUE),
|
26 |
+
numericInput(inputId = "distribuciones",
|
27 |
+
label = p("Ingrese el valor de desviaciones estándar
|
28 |
+
para modificar el rango horizontal:"),
|
29 |
+
min = 1,
|
30 |
+
value = 0.5,
|
31 |
+
step= 0.5),
|
32 |
+
br(),
|
33 |
+
p("App creada por el Semillero de R de la Universidad Nacional de Colombia:"),
|
34 |
+
tags$a(href="https://srunal.github.io/",
|
35 |
+
"https://srunal.github.io/")
|
36 |
+
),
|
37 |
+
|
38 |
+
# Show a plot of the generated distribution
|
39 |
+
mainPanel(
|
40 |
+
h3("Densidad para la distribución Logística", align = "center"),
|
41 |
+
plotOutput("grafico1"),
|
42 |
+
verbatimTextOutput('med_var')
|
43 |
+
)
|
44 |
+
)
|
45 |
+
))
|