Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
## simpleTest Shiny/R app ui.R
##
## Author(s) :
## -----------
## J.J.
## Orginal version by Grégoire Vincke http://www.uclouvain.be/gregoire.vincke
## For Statistical eLearning Tools http://sites.uclouvain.be/selt/
##
## Licences :
## ---------
## CC-BY for the web page http://sites.uclouvain.be/selt/shiny/testhypic
## see http://creativecommons.org/licenses/by/2.0/be/ for more informations
##
## GPLv2 for source code on https://github.com/uclouvain-selt/shiny
## See LICENCE.tx or http://www.gnu.org/licenses/old-licenses/gpl-2.0.html for more informations
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Test d'hypothèse sur la moyenne"),
conditionalPanel(
condition = "input.visM == false",
sidebarPanel(
tags$head(
tags$style(type="text/css", "label { display: inline; }"),
tags$style(type="text/css", '.checkbox input[type="checkbox"],.radio input[type="radio"] { float: none; }'),
tags$style(type="text/css", ".jslider { max-width: 250px; }"),
tags$style(type='text/css', ".well { max-width: 300px; }"),#class of the from inside sidebarPanel
tags$style(type='text/css', ".span4 { max-width: 310px; }"),#span4 is the span of sidebarPanel (span8 is for the mainPanel)
tags$style(type='text/css', "#complementinfos { width: 150px; }"),
tags$style(type='text/css', "#CVk { width: 150px; }"),
tags$style(type='text/css', "select#display { width: 150px; }"),
tags$style(type='text/css', "#mainInputs {margin : 0px 0px 4px 0px; }"),
tags$script(type="text/javascript",src="js/scripts.js")
),
## Hypothèse
selectInput("test", "",
list("Hypothèse bilateral" = "=",
"Hypothèse unilatéral à droite" = "<=",
"Hypothèse unilatéral à gauche" = "=>")),
conditionalPanel(
condition = "input.test == '='",
h5(HTML("Hypothèses: H<sub>0</sub>: μ = μ<sub>0</sub> vs. H<sub>1</sub>: μ<sub>0</sub> ≠ μ"))),
conditionalPanel(
condition = "input.test == '<='",
h5(HTML("Hypothèses: H<sub>0</sub>: μ ≤ μ<sub>0</sub> vs. H<sub>1</sub>: μ<sub>0</sub> < μ"))),
conditionalPanel(
condition = "input.test == '=>'",
h5(HTML("Hypothèses: H<sub>0</sub>: μ<sub>0</sub> ≤ μ vs. H<sub>1</sub>: μ < μ<sub>0</sub>"))),
HTML(" μ<sub>0</sub> : moyenne sous H<sub>0</sub> :"),
sliderInput("mx0","",min = 0,max = 60,value = 33, step=1),
conditionalPanel(
condition = "input.hypPl == 'realite' && input.mx0 == input.mx && input.test == '='",
h5(HTML("L'hypothèse H<sub>0</sub> est vraie!"), style = "color:green")),
conditionalPanel(
condition = "input.hypPl == 'realite' && input.mx0 != input.mx && input.test == '='",
h5(HTML("L'hypothèse nulle H<sub>0</sub> est fausse!"), style = "color:red")),
conditionalPanel(
condition = "input.hypPl == 'realite' && input.mx <= input.mx0 && input.test == '<='",
h5(HTML("L'hypothèse H<sub>0</sub> est vraie!"), style = "color:green")),
conditionalPanel(
condition = "input.hypPl == 'realite' && input.mx0 < input.mx && input.test == '<='",
h5(HTML("L'hypothèse nulle H<sub>0</sub> est fausse!"), style = "color:red")),
conditionalPanel(
condition = "input.hypPl == 'realite' && input.mx0 <= input.mx && input.test == '=>'",
h5(HTML("L'hypothèse H<sub>0</sub> est vraie!"), style = "color:green")),
conditionalPanel(
condition = "input.hypPl == 'realite' && input.mx < input.mx0 && input.test == '=>'",
h5(HTML("L'hypothèse nulle H<sub>0</sub> est fausse!"), style = "color:red")),
## Population
h5("Paramètres de la population d'origine:"),
conditionalPanel(
condition = "input.hypPl == 'realite'",
HTML("μ : moyenne de la population d'origine"),
sliderInput("mx","",min = 0,max = 60,value = sample(c(30:35),1), step=1)),
checkboxInput("sigKn",HTML(" σ : écart-type de la population d'origine"),FALSE),
conditionalPanel(
condition = "input.sigKn == true",
sliderInput("sx","",min = 0,max = 10,value = sample(seq(from = 2, to = 3.5, by = 0.5),1), step=0.5)),
## Sampling
h5("Paramètres de l'échantillonnage"),
sliderInput("n","n : nombre d'individus par échantillon :",min = 2,max = 50,value = 10, step=1),
sliderInput("ns","Nombre d'échantillons prélevés :",min = 1,max = 50,value = 1, step=1),#ns:number of samples
## Test d'hypothese
h5("Paramètres des tests"),
selectInput("hypPl", "",
list("Choix" = "false",
"Afficher les hypothèses" = "true",
"Comparer hypothèse avec realité" = "realite")),
conditionalPanel(
condition = "input.hypPl != 'false' && input.icPl == true",
selectInput("testicPl", "",
list("Choix" = "false",
"Indiquer couverture par les IC" = "cvPl",
"Indiquer la décision" = "testPl",
"Afficher % de rejet" = "rejFreqPl"))),
## IC parameter
h5("Paramètres des IC"),
checkboxInput("icPl",HTML("Afficher les intervalles de confiance"),FALSE),
conditionalPanel(
condition = "input.icPl == true",
selectInput("thresholds", "Seuils critiques :",
list("Afficher les formules théoriques" = "formula",
"Afficher le calcul détaillé" = "calcul",
"Afficher le résultat" = "result"))),
conditionalPanel(
condition = "input.icPl == true",
selectInput("CVk","Modèle :",
c("empirique" = "eCVk",
"σ connu" = "vCVk",
"σ inconnu" = "sCVk"))),
conditionalPanel(
condition = "input.CVk =='eCVk' && input.icPl == true",
HTML("c : demi amplitude des IC : [x̄ ± c ]")),
conditionalPanel(
condition = "input.CVk =='vCVk' && input.icPl == true",
HTML("c : seuil critique des IC : [x̄ ± c σ / √n ]")),
conditionalPanel(
condition = "input.CVk =='sCVk' && input.icPl == true",
HTML("c : seuil critique des IC : [x̄ ± c s / √n ]")),
conditionalPanel(
condition = "input.icPl == true",
sliderInput("k","",min = 1,max = 25,value = 5, step=0.5)),
## Graphic parameter
h5("Paramètres graphiques"),
checkboxInput("empPl",HTML("Afficher les statistiques descriptives"),TRUE),
br(),
checkboxInput("showreality",HTML("Afficher la densité d'origine"),FALSE),
sliderInput("nss","Nombre d'échantillons affichés :",min = 1,max = 50,value = 7, step=1),#nss: number of samples to show
selectInput("display", "Display :",
list("Default" = "default",
"1024x768" = "1024",
"800x600" = "800")),
HTML('<hr style="border:1px solid #ccc;"/>'),
HTML('<a rel="license" href="http://creativecommons.org/licenses/by/2.0/be/"><img alt="Licence Creative Commons" style="border-width:0" src="img/cc_by_80x15.png" /></a> Ce(tte) oeuvre de <span xmlns:cc="http://creativecommons.org/ns#" property="cc:attributionName">Statistical eLearning Tools</span> est mise à disposition selon les termes de la <a rel="license" href="http://creativecommons.org/licenses/by/2.0/be/">licence Creative Commons Attribution 2.0 Belgique</a>.'),
HTML('<p>Détails sur l\'utilisation de cette ressource sur <a href="http://sites.uclouvain.be/selt/ressources/194703" target="_blank">Statistics eLearning Tools</a><br/> Code source disponible sur <a href="https://github.com/uclouvain-selt/shiny/tree/master/simpletest" target="_blank">Github</a></p><p><a href="http://www.uclouvain.be/" target="_blank" title="Copyright - Université Catholique de Louvain"><img alt="Copyright - Université Catholique de Louvain" style="border-width:0" src="img/UCL_2018.png" width=150 /></a></p>')
)
),
mainPanel(
HTML("<div id='mainInputs'>"),
actionButton("takesample","Echantillonner"),actionButton("reset","Reset"),checkboxInput("visM",HTML("Plein écran"),FALSE),
HTML("</div>"),
tabsetPanel(id="Tabset",selected=1,
tabPanel(
"Vue graphique",
plotOutput("plotEmp",height='100%'),
#verbatimTextOutput("test1"),
value=1),
tabPanel("Données",value=2,
## conditionalPanel(
## condition = "input.visM0 == true",
## checkboxInput("visM1",HTML("Demasquer le menu"),FALSE)),
tableOutput("DataTable")
)#,
# tabPanel("Test",value=3,
# tableOutput("test1")
# )
)
)
))