File tree Expand file tree Collapse file tree 2 files changed +78
-0
lines changed Expand file tree Collapse file tree 2 files changed +78
-0
lines changed Original file line number Diff line number Diff line change 1+ #
2+ library(shiny )
3+
4+ # Define server logic required to draw a histogram
5+ shinyServer(function (input , output ) {
6+
7+ value <- reactive({
8+ means_n <- numeric (10000 ) # Vecteur de 10000 valeurs
9+
10+ for (i in 1 : 10000 )
11+ means_n [i ] <- mean(rnorm(input $ numb , mean = 8 , sd = 2 ))
12+
13+ df_test <- tibble :: enframe(means_n , name = NULL )
14+ df_test
15+ })
16+
17+ output $ mean_value <- renderText({
18+ t <- value()
19+ mean(t $ value )
20+ })
21+
22+ output $ sd_value <- renderText({
23+ t <- value()
24+ sd(t $ value )
25+ })
26+
27+ output $ mean_plot <- renderPlot({
28+ t <- value()
29+ # hist(t$value)
30+
31+ chart :: chart(data = t , ~ value ) +
32+ ggplot2 :: geom_histogram(bins = 30 ) +
33+ ggplot2 :: labs(x = " Moyenne des échantillons" , y = " Dénombrement" )
34+ })
35+
36+ })
Original file line number Diff line number Diff line change 1+ #
2+ library(shiny )
3+
4+ # Define UI for application that draws a histogram
5+ shinyUI(fluidPage(
6+ # Application title
7+ titlePanel(" Effet de l'effectif" ),
8+
9+ # Sidebar with a slider input for number of bins
10+ sidebarLayout(
11+ sidebarPanel(
12+ sliderInput(" numb" ,
13+ " Nombre d'individus échantillonner observations" ,
14+ min = 3 ,
15+ max = 100 ,
16+ value = 9 ),
17+ withMathJax(),
18+ p(" La moyenne d'un échantillon suit l'équation suivante :" ),
19+ helpText(" $$\\ bar{x}=\\ sum_{i=1}^n{\\ frac{x_i}{n}}$$" ),
20+ p(" L'écart-type d'un échantillon suit l'équation suivante : " ),
21+ helpText(" $$s_x = \\ sqrt{\\ sum_{i=1}^n{\\ frac{(x_i - \\ bar{x})^2}{n-1}}}$$" ),
22+ hr(),
23+ helpText(" La moyenne de la distribution d’échantillonnage" ),
24+ verbatimTextOutput(" mean_value" ),
25+ helpText(" L'écart-type de la la distribution d’échantillonnage" ),
26+ verbatimTextOutput(" sd_value" ),
27+ hr()
28+ ),
29+
30+ # Show a plot of the generated distribution
31+ mainPanel(
32+ withMathJax(),
33+ helpText(" Partons d'une distribution théorique de la population
34+ qui soit normale, de moyenne \\ (\\ mu = 8\\ ) et d'écart
35+ type \\ (\\ sigma = 2\\ )." ),
36+ strong(" Comment varie la moyenne et l'écart-type de la distribution
37+ d'échantillonnage ?" ),
38+ plotOutput(" mean_plot" ),
39+ hr()
40+ )
41+ )
42+ ))
You can’t perform that action at this time.
0 commit comments