-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathttest.html
298 lines (277 loc) · 13.8 KB
/
ttest.html
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<!DOCTYPE html>
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-131282143-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-131282143-1');
</script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>EZ Statistics: T-test</title>
<meta name="description" content="EZ Statistics t-test">
<link rel="stylesheet" href="style/stats.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-csv/0.71/jquery.csv-0.71.min.js"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="jstat.js"></script>
<script src="ezstatistics-0.30.js"></script>
</head>
<body onload="javascript:set_test_type()">
<center><img class="round" src="style/logo.png" height="105"/></center>
<div style="text-align: right"><a href="index.html">Back to main page</a></div>
<h3 class="f18b">T-test</h3>
Requires that the samples are normally distributed. Select the type of test depending on if the samples are independent or paired, and if sample variances are equal or not.
<br> <br>
Tests the hypotheses:
<table>
<tr>
<th class="dark" width="110">H<sub>0</sub></th>
<td class="border">There is no difference between the means of the samples </td>
</tr>
<tr>
<th class="dark">H<sub>1</sub> (two-tailed)</th>
<td class="border">The mean of sample A is different than the mean of sample B </td>
</tr>
<tr>
<th class="dark">H<sub>1</sub> (one-tailed)</th>
<td class="border">The mean of sample A is either less than or greater than the mean of sample B </td>
</tr>
</table>
<div class="smalltext">
<div class="label16">
<h3 class="f16"> Test Type</h3>
</div>
<br/>
<form action="" id="testtype">
<input class="type" type="radio" name="type" id="1" value="1" checked> Independent, equal variances<br>
<input class="type" type="radio" name="type" id="2" value="2"> Independent, unequal variances<br>
<input class="type" type="radio" name="type" id="3" value="3"> Paired
</form>
<div class="label16">
<h3 class="f16"> Test Hypothesis</h3>
</div>
<br/>
<form action="" id="testtype">
<input class="type" type="radio" name="hyp" id="1" value="1" checked> <b>≠</b> The mean of sample A is different than the mean of sample B (two-tailed)<br>
<input class="type" type="radio" name="hyp" id="2" value="2"> <b><</b> The mean of sample A is less than the mean of sample B (one-tailed)<br>
<input class="type" type="radio" name="hyp" id="3" value="3"> <b>></b> The mean of sample A is greater than the mean of sample B (one-tailed)
</form>
<div class="label16">
<h3 class="f16"> Data Entry</h3>
</div>
<br/>
<table>
<tr>
<td>Sample A:</td>
<td><input class="sample" name="sampA" id="samp1" value="13, 17, 19, 11, 20, 15, 18, 9, 12, 16"></td>
<tr/>
<tr>
<td>Sample B:</td>
<td><input class="sample" name="sampB" id="samp2" value="12, 8, 6, 16, 12, 14, 10, 18, 4, 11"></td>
<tr/>
<tr>
<td>Significance level α: </td>
<td><input class="value" name="alpha" id="alpha" value="0.05"></td>
</tr>
<tr>
<td>Upload CSV file:</td>
<td>
<input type="file" name="File Upload" id="txtFileUpload" accept=".csv" />
</td>
</tr>
</table>
<br>
<button class="test" onclick="javascript:run_ttest()">Run Test</button>
<button class="clear" onclick="javascript:clear_fields(2)">Clear</button>
<div id="error">
</div>
<div id="test_results" style="display: none;">
<div class="label16">
<h3 class="f16"> Test Result</h3>
</div>
<br/>
<table class="border">
<thead>
<tr>
<th colspan=4 class="dark">Data Summary</th>
</tr>
<tr>
<th class="dark" width="70">Sample</th>
<th class="dark" width="40">N</th>
<th class="dark" width="100">Mean</th>
<th class="dark" width="100">Stdev</th>
</tr>
</thead>
<tbody>
<tr>
<th class="dark">A</th>
<td class="border" id="n1"> </td>
<td class="border" id="mean1"> </td>
<td class="border" id="stdev1"> </td>
</tr>
<tr>
<th class="dark">B</th>
<td class="border" id="n2"> </td>
<td class="border" id="mean2"> </td>
<td class="border" id="stdev2"> </td>
</tr>
</tbody>
</table>
<br/>
<table class="border">
<thead>
<tr>
<th class="dark" width="550" colspan="2">Result</th>
</tr>
</thead>
<tbody>
<tr>
<td class="dark" width="130"><b>Mean<sub>A</sub> - Mean<sub>B</sub>:</b></td>
<td class="border" width="420" id="mean"> </td>
</tr>
<tr>
<td class="dark"><b>Significance level α:</b></td>
<td class="border" id="sign_level"> </td>
</tr>
<tr>
<td class="dark"><b>P-value:</b></td>
<td class="border" id="p"> </td>
</tr>
<tr>
<td class="dark"><b>T-score:</b></td>
<td class="border" id="t"> </td>
</tr>
<tr>
<td class="dark"><b>Result:</b></td>
<td class="border" id="res"> </td>
</tr>
</tbody>
</table>
<div id="power">
<div class="label16">
<h3 class="f16"> Power Analysis <button class="help" onclick="javascript:toggle('pahelp')";>?</button></h3>
</div>
<div id="pahelp" style="display: none;">
<br>
The first table shows the minimum required sample sizes for low, medium and high statistical power respectively.
The second table shows the current statistical power for the samples and test type.
</div>
<br>
<table class="border">
<thead>
<tr>
<th colspan=3 class="dark">Required sample sizes</th>
</tr>
<tr>
<th class="dark" width="120">Power</th>
<th class="dark" width="150">Min sample size</th>
</tr>
</thead>
<tbody>
<tr>
<td class="border">Low (20%)</td>
<td class="border" id="n_low"> </td>
</tr>
<tr>
<td class="border">Medium (50%)</td>
<td class="border" id="n_medium"> </td>
</tr>
<tr>
<td class="border">High (80%)</td>
<td class="border" id="n_high"> </td>
</tr>
</tbody>
</table>
<br>
<table class="border">
<thead>
<tr>
<th class="dark" width="150">Current power</th>
</tr>
</thead>
<tbody>
<tr>
<td class="border" id="pwr"> </td>
</tr>
</tbody>
</table>
</div>
<div id="assumptions">
<div class="label16">
<h3 class="f16"> Check test assumptions <button class="help" onclick="javascript:toggle('ashelp')";>?</button></h3>
</div>
<div id="ashelp" style="display: none;">
<br>
The samples should be normally distributed. If not, consider using <a href="wilcoxon.html">Wilcoxon tests</a> instead.
Note that the normality test is not entirely accurate for sample sizes under 20.
<p class="tab">Select correct test type depnding on if the variances are equal or not.</p>
</div>
<br>
<div id="vartest">
<table class="border">
<thead>
<tr>
<th class="dark" width="550" colspan="2">F-test for equal variances</th>
</tr>
</thead>
<tbody>
<tr>
<td class="dark" width="100"><b>Result:</b></td>
<td class="border" id="f_res"> </td>
</tr>
<tr>
<td class="dark"><b>P-value:</b></td>
<td class="border" id="f_p"> </td>
</tr>
</tbody>
</table>
<br>
</div>
<div id="normtest">
<table class="border">
<thead>
<tr>
<th class="dark" width="550" colspan="2">Shapiro-Wilk test for normally distributed samples</th>
</tr>
</thead>
<tbody>
<tr>
<td class="dark" colspan="2"><center><b>Sample A</b></center></td>
</tr>
<tr>
<td class="dark" width="100"><b>Result:</b></td>
<td class="border" id="sw_res_1"> </td>
</tr>
<tr>
<td class="dark"><b>P-value:</b></td>
<td class="border" id="sw_p_1"> </td>
</tr>
<tr>
<td class="dark" colspan="2"><center><b>Sample B</b></center></td>
</tr>
<tr>
<td class="dark" width="100"><b>Result:</b></td>
<td class="border" id="sw_res_2"> </td>
</tr>
<tr>
<td class="dark"><b>P-value:</b></td>
<td class="border" id="sw_p_2"> </td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="viz">
<div class="label16">
<h3 class="f16"> Data Visualization</h3>
</div>
<div id="chart"></div>
</div>
</div>
</div>
</body>
</html>