-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats.html
661 lines (601 loc) · 30.2 KB
/
stats.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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<title lang="en">Statistics Tools</title>
</head>
<body>
<header>
<div class="navbar navbar-dark bg-dark box-shadow">
<div class="container d-flex justify-content-between">
<a href="index.html" class="navbar-brand d-flex align-items-center">
<strong>OpenSource Code Monkey</strong>
</a>
<button class="navbar-toggler" type="button" onclick="window.location = 'stats.html';">
<span lang="en">Statistics Tools</span>
</button>
</div>
</div>
</header>
<main role="main">
<div class="container" style="margin-top: 25px;">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<button class="nav-link active" id="nav-home-tab" data-bs-toggle="tab" data-bs-target="#nav-home" type="button" role="tab" aria-controls="nav-home" aria-selected="true">
<span lang="en">Input Data</span>
</button>
<button class="nav-link disabled" id="nav-frequencies-tab" data-bs-toggle="tab" data-bs-target="#nav-frequencies" type="button" role="tab" aria-controls="nav-frequencies" aria-selected="false">
<span lang="en">Frequency Table(s)</span>
</button>
<button class="nav-link disabled" id="nav-results-tab" data-bs-toggle="tab" data-bs-target="#nav-results" type="button" role="tab" aria-controls="nav-results" aria-selected="false">
<span lang="en">Results</span>
</button>
<button class="nav-link disabled" id="nav-box-tab" data-bs-toggle="tab" data-bs-target="#nav-box" type="button" role="tab" aria-controls="nav-box" aria-selected="false">
<span lang="en">Box Diagram(s)</span>
</button>
<button class="nav-link disabled" id="nav-regression-tab" data-bs-toggle="tab" data-bs-target="#nav-regression" type="button" role="tab" aria-controls="nav-regression" aria-selected="false">
<span lang="en">Linear Regression</span>
</button>
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab">
<form style="margin-top: 0px;padding: 50px;" onsubmit="return calculateStats();">
<div class="mb-3 row">
<label class="col-sm-2 col-form-label" lang="en">Type of Data</label>
<div class="col-sm-10">
<div class="form-check form-check-inline" style="margin-top: 7px;">
<input class="form-check-input" type="radio" name="population" id="population" value="population" checked>
<label class="form-check-label" for="population" lang="en">Population</label>
</div>
<div class="form-check form-check-inline" style="margin-top: 7px;">
<input class="form-check-input" type="radio" name="population" id="sanple" value="sample">
<label class="form-check-label" for="sanple" lang="en">Sample</label>
</div>
</div>
</div>
<div class="mb-3 row">
<label class="col-sm-2 col-form-label" lang="en">Input Mode</label>
<div class="col-sm-10">
<div class="form-check form-check-inline" style="margin-top: 7px;">
<input class="form-check-input" type="radio" name="rawData" id="rawData" value="rawData" checked onclick="initRawDataFrequencies();">
<label class="form-check-label" for="rawData" lang="en">Raw Data</label>
</div>
<div class="form-check form-check-inline" style="margin-top: 7px;">
<input class="form-check-input" type="radio" name="rawData" id="frequencyDataAbsolute" value="frequencyDataAbsolute" onclick="clearRawDataFrequencies();">
<label class="form-check-label" for="frequencyDataAbsolute" lang="en">Absolute Frequencies</label>
</div>
<!--
<div class="form-check form-check-inline" style="margin-top: 7px;">
<input class="form-check-input" type="radio" name="rawData" id="frequencyDataRelative" value="frequencyDataRelative" onclick="clearRawDataFrequencies();">
<label class="form-check-label" for="frequencyDataRelative" lang="en">Relative Frequencies</label>
</div>
-->
</div>
</div>
<table class="table">
<thead>
<tr>
<th>
<input type="text" name="xLabel" id="xLabel" value="" class="form-control" placeholder="Var X"/>
</th>
<th>
<input type="text" name="yLabel" id="yLabel" value="" class="form-control" placeholder="Var Y"/>
</th>
<th colspan="2"></th>
</tr>
<tr>
<th lang="en">Value</th>
<th lang="en">Value</th>
<th lang="en">Frequency</th>
<th></th>
</tr>
</thead>
<tbody id="inputTBody"/>
</table>
<table class="table">
<tbody>
<tr>
<td colspan="5">
<button onclick="return addRow();" class="btn btn-outline-secondary" lang="en">Add Row</button>
</td>
</tr>
</tbody>
</table>
<div class="mb-3 row">
<input type="submit" class="btn btn-primary btn-lg btn-block" value="Calculate"/>
</div>
</form>
</div>
<div class="tab-pane fade" id="nav-frequencies" role="tabpanel" aria-labelledby="nav-frequencies-tab">
<div class="container" style="margin-top: 50px;" id="frequencyDiv">
</div>
<h2 id="frequencyLabel" lang="en" style="display: none">Variable</h2>
<table id="frequencyDivTable" class="table" style="display: none">
<thead>
<tr>
<th lang="en">Value</th>
<th lang="en">Absolute Frequency</th>
<th lang="en">Relative Frequency</th>
<th lang="en">Accumulated Absolute Frequency</th>
<th lang="en">Accumulated Relative Frequency</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<div class="tab-pane fade" id="nav-results" role="tabpanel" aria-labelledby="nav-results-tab">
<div class="container" style="margin-top: 50px;">
<h3 lang="en">Statistics</h3>
<table class="table">
<thead>
<tr>
<th lang="en">Variable</th>
<th lang="en">Number of Observations</th>
<th lang="en">Sum</th>
<th lang="en">Min</th>
<th lang="en">Max</th>
<th lang="en">Average</th>
<th lang="en">Mode</th>
<th lang="en">Mean</th>
<th lang="en">1st Quantile</th>
<th lang="en">3rd Quantile</th>
</tr>
</thead>
<tbody id="basicStats">
</tbody>
</table>
<h3 lang="en">Percentiles</h3>
<table class="table">
<thead>
<tr>
<th lang="en">Variable</th>
<th>10 %</th>
<th>20 %</th>
<th>30 %</th>
<th>40 %</th>
<th>50 %</th>
<th>60 %</th>
<th>70 %</th>
<th>80 %</th>
<th>90 %</th>
</tr>
</thead>
<tbody id="percentileStats">
</tbody>
</table>
<h3 lang="en">Dispersion</h3>
<table class="table">
<thead>
<tr>
<th lang="en">Variable</th>
<th lang="en">Variance</th>
<th lang="en">Standard Deviation</th>
<th lang="en">Median Absolute Deviation</th>
<th lang="en">InterQuantile Range</th>
<th lang="en">Coefficient of Variation</th>
</tr>
</thead>
<tbody id="dispursionStats">
</tbody>
</table>
<table class="table">
<thead>
<tr>
<th lang="en">Variable</th>
<th lang="en">Outlier Interval</th>
<th lang="en">Extreme Outlier Interval</th>
<th lang="en">Outliers</th>
<th lang="en">Extreme Outliers</th>
</tr>
</thead>
<tbody id="outlierStats">
</tbody>
</table>
</div>
</div>
<div class="tab-pane fade" id="nav-box" role="tabpanel" aria-labelledby="nav-box-tab">
<div class="row" style="padding: 50px;">
<div class="col">
<figure class="highcharts-figure">
<div id="boxPlotContainerX"></div>
</figure>
</div>
<div class="col">
<figure class="highcharts-figure">
<div id="boxPlotContainerY"></div>
</figure>
</div>
</div>
</div>
<div class="tab-pane fade" id="nav-regression" role="tabpanel" aria-labelledby="nav-regression-tab">
<div class="row" style="padding: 50px;">
<h3 lang="en">Similarity</h3>
<table class="table">
<thead>
<tr>
<th lang="en">Correlation (R)</th>
<th lang="en">Covariance</th>
<th>R²</th>
</tr>
</thead>
<tbody>
<tr>
<td id="sampleCorrelation"></td>
<td id="sampleCovariance"></td>
<td id="sampleCorrelationCoeficient"></td>
</tr>
</tbody>
</table>
<h3 lang="en">Linear Regression</h3>
<table class="table">
<thead>
<tr>
<th>a</th>
<th>b</th>
<th lang="en">Line Formula</th>
</tr>
</thead>
<tbody>
<tr>
<td id="linearRegressionA"></td>
<td id="linearRegressionB"></td>
<td id="linearRegressionFormula"></td>
</tr>
</tbody>
</table>
<div id="linearRegressionLineDiv">
</div>
</div>
</div>
</div>
</div>
</main>
<footer style="text-align: center;">
<script>document.write(new Date().getFullYear())</script>
©
<a href="https://github.com/opencodemonkey">opencodemonkey</a>
</footer>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4"
crossorigin="anonymous"></script>
<script src="simple-statistics.js" type="text/javascript"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<script>
function clearRows(id) {
var tbody = document.getElementById(id);
for (i = tbody.rows.length; i > 0; i--) {
tbody.deleteRow(i - 1);
}
}
function calculateStats() {
document.getElementById('frequencyDiv').innerHTML = '';
clearRows("basicStats");
clearRows("percentileStats");
clearRows("dispursionStats");
clearRows("outlierStats");
var xl = document.getElementById("xLabel").value;
var frequencyA = Array.from(document.getElementsByName("frequency")).map(x => +x.value);
var xa = Array.from(document.getElementsByName("x")).map(x => +x.value);
var xdata = resolve(frequencyA, xa);
var ya = Array.from(document.getElementsByName("y")).map(x => +x.value);
report("X", xl, xdata);
if (hasValues(ya) === true) {
var yl = document.getElementById("yLabel").value;
var ydata = resolve(frequencyA, ya);
report("Y", yl, ydata);
var sc = sampleCorrelation(xa, ya);
document.getElementById('sampleCorrelation').innerHTML = sc.toFixed(3);
document.getElementById('sampleCovariance').innerHTML = sampleCovariance(xa, ya).toFixed(3);
document.getElementById('sampleCorrelationCoeficient').innerHTML = Math.pow(sc, 2).toFixed(3);
var sdata = [];
for (i = 0; i < xdata.length; i++) {
sdata.push([xdata[i], ydata[i]]);
}
var lr = linearRegression(sdata);
document.getElementById('linearRegressionA').innerHTML = lr.b.toFixed(3);
document.getElementById('linearRegressionB').innerHTML = lr.m.toFixed(3);
document.getElementById('linearRegressionFormula').innerHTML = 'y = a + bx = ' + lr.b.toFixed(3) + " + " + lr.m.toFixed(3) + " x";
drawRegressionLine(xdata, ydata, sdata);
document.getElementById("nav-regression-tab").classList.remove("disabled");
}
document.getElementById("nav-frequencies-tab").classList.remove("disabled");
document.getElementById("nav-results-tab").classList.remove("disabled");
document.getElementById("nav-box-tab").classList.remove("disabled");
document.getElementById("nav-results-tab").click();
return false;
}
function resolve(frequencies, values) {
var data = [];
frequencies.forEach((f, i) => {
for (j = 0; j < f; j++) {
data.push(values[i]);
}
});
return data;
}
function hasValues(arr) {
for (let i = 0; i < arr.length; i++) {
if (arr[i] !== 0) {
return true;
}
}
return false;
}
function drawRegressionLine(vxa, vya, sdata) {
var r = linearRegression(sdata);
var rl = linearRegressionLine(r);
var minX = min(vxa);
var minY = rl(minX);
var maxX = max(vxa);
var maxY = rl(maxX);
Highcharts.chart('linearRegressionLineDiv', {
title: {
text: ''
},
xAxis: {
min: minX,
max: maxX,
title: { text: '' }
},
yAxis: {
min: min(vya),
max: max(vya),
title: { text: '' }
},
series: [{
type: 'line',
name: 'Regression Line',
data: [[minX, minY], [maxX, maxY]],
marker: {
enabled: false
},
states: {
hover: {
lineWidth: 0
}
},
enableMouseTracking: false
}, {
type: 'scatter',
name: 'Observations',
data: sdata,
marker: {
radius: 4
}
}]
});
}
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
function count(array, val) {
var c = 0;
for(var i = 0; i < array.length; ++i){
if(array[i] === val)
c++;
}
return c;
}
function report(vi, vlabel, vdata) {
var frequencyDiv = document.getElementById('frequencyDiv');
var frequencyDivTable = document.getElementById('frequencyDivTable');
var fTable = frequencyDivTable.cloneNode(true);
fTable.style.display = "block";
fTable.id = "frequencyDivTable" + (Math.random() * 1000);
var values = vdata.filter(onlyUnique).sort((a,b) => a-b);
var counts = [];
values.forEach(v => {
counts.push(count(vdata, v))
});
var accumulated = 0;
for (var i = 0; i < values.length; i++) {
var trow = fTable.tBodies[0].insertRow();
accumulated += counts[i];
trow.insertCell().innerHTML = values[i];
trow.insertCell().innerHTML = counts[i];
trow.insertCell().innerHTML = (counts[i] / vdata.length).toFixed(3);
trow.insertCell().innerHTML = accumulated
trow.insertCell().innerHTML = (accumulated / vdata.length).toFixed(3);
}
var label = document.getElementById('frequencyLabel').cloneNode(true);
label.id = "frequencyDivTable" + (Math.random() * 1000);
label.style.display = "block";
label.innerHTML += ' ' + vlabel;
frequencyDiv.appendChild(label);
frequencyDiv.appendChild(fTable);
var trow = document.getElementById('basicStats').insertRow();
trow.insertCell().innerHTML = vlabel;
trow.insertCell().innerHTML = vdata.length;
trow.insertCell().innerHTML = sum(vdata).toFixed(3);
trow.insertCell().innerHTML = min(vdata).toFixed(3);
trow.insertCell().innerHTML = max(vdata).toFixed(3);
var q1 = quantile(vdata, 0.25);
var q3 = quantile(vdata, 0.75);
trow.insertCell().innerHTML = mean(vdata).toFixed(3);
trow.insertCell().innerHTML = mode(vdata).toFixed(3);
trow.insertCell().innerHTML = median(vdata).toFixed(3);
trow.insertCell().innerHTML = q1.toFixed(3);
trow.insertCell().innerHTML = q3.toFixed(3);
var prow = document.getElementById('percentileStats').insertRow();
prow.insertCell().innerHTML = vlabel;
prow.insertCell().innerHTML = quantile(vdata, 0.1).toFixed(3);
prow.insertCell().innerHTML = quantile(vdata, 0.2).toFixed(3);
prow.insertCell().innerHTML = quantile(vdata, 0.3).toFixed(3);
prow.insertCell().innerHTML = quantile(vdata, 0.4).toFixed(3);
prow.insertCell().innerHTML = quantile(vdata, 0.5).toFixed(3);
prow.insertCell().innerHTML = quantile(vdata, 0.6).toFixed(3);
prow.insertCell().innerHTML = quantile(vdata, 0.7).toFixed(3);
prow.insertCell().innerHTML = quantile(vdata, 0.8).toFixed(3);
prow.insertCell().innerHTML = quantile(vdata, 0.9).toFixed(3);
var v = document.getElementById('population').checked ? variance(vdata) : sampleVariance(vdata);
var sd = document.getElementById('population').checked ? standardDeviation(vdata) : sampleStandardDeviation(vdata);
var cv = sd / mean(vdata);
var drow = document.getElementById('dispursionStats').insertRow();
var iqr = interquartileRange(vdata);
drow.insertCell().innerHTML = vlabel;
drow.insertCell().innerHTML = v.toFixed(3);
drow.insertCell().innerHTML = sd.toFixed(3);
drow.insertCell().innerHTML = (medianAbsoluteDeviation(vdata)).toFixed(3);
drow.insertCell().innerHTML = iqr.toFixed(3);
drow.insertCell().innerHTML = cv.toFixed(3);
var oimin = q1 - 1.5*iqr;
var oimax = q3 + 1.5*iqr;
var eoimin = q1 - 3*iqr;
var eoimax = q3 + 3*iqr;
var ol = [];
var eol = [];
values.forEach(v => {
if (v < oimin || v > oimax) {
ol.push(v);
}
if (v < eoimin || v > eoimax) {
eol.push(v);
}
});
var orow = document.getElementById('outlierStats').insertRow();
orow.insertCell().innerHTML = vlabel;
orow.insertCell().innerHTML = '[' + oimin + "; " + oimax + ']';
orow.insertCell().innerHTML = '[' + eoimin + "; " + eoimax + ']';
orow.insertCell().innerHTML = ol;
orow.insertCell().innerHTML = eol;
Highcharts.chart('boxPlotContainer' + vi, {
chart: { type: 'boxplot' },
title: { text: '' },
legend: { enabled: false },
xAxis: {
categories: [vlabel],
title: { text: '' }
},
yAxis: {
title: { text: '' }
},
series: [{
name: 'Observations',
data: [
[min(vdata), quantile(vdata, 0.25), median(vdata), quantile(vdata, 0.75), max(vdata)]
]
}]
});
}
var tbody = document.getElementById("inputTBody");
var trash = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">\
<path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"/>\
<path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"/>\
</svg>';
function removeRow(b) {
var trow = b.parentElement.parentElement;
tbody.removeChild(trow);
return false;
}
function addRow() {
var isRawData = document.getElementById("rawData").checked;
var trow = tbody.insertRow();
trow.insertCell().innerHTML = '<input type="number" name="x" value="" class="form-control" required />';
if (isRawData) {
trow.insertCell().innerHTML = '<input type="number" name="y" value="" class="form-control" step="0.001" />';
trow.insertCell().innerHTML = '<input type="number" name="frequency" value="1" class="form-control" required />';
} else {
trow.insertCell().innerHTML = '<input type="number" name="y" value="0" class="form-control" required />';
trow.insertCell().innerHTML = '<input type="number" name="frequency" value="" class="form-control" required />';
}
trow.insertCell().innerHTML = '<button onclick="removeRow(this);" class="btn btn-outline-danger">' + trash + '</button>';
return false;
}
function initRawDataFrequencies() {
document.getElementsByName("frequency").forEach((element) => {
element.value = 1;
});
document.getElementsByName("y").forEach((element) => {
element.value = '';
});
return false;
}
function clearRawDataFrequencies() {
document.getElementsByName("frequency").forEach((element) => {
element.value = '';
});
document.getElementsByName("y").forEach((element) => {
element.value = 0;
});
return false;
}
for (i = 0; i < 3; i++) {
addRow();
}
function translate(text) {
if (text === "Statistics Tools") return "Ferramentas Estatísticas";
if (text === "Input Data") return "Dados de Entrada";
if (text === "Frequency Table(s)") return "Tabela(s) de Frequência";
if (text === "Results") return "Resultados";
if (text === "Box Diagram(s)") return "Diagrama(s) de Caixa";
if (text === "Linear Regression") return "Regressão Linear";
if (text === "Type of Data") return "Tipo Dados";
if (text === "Population") return "População";
if (text === "Sample") return "Amostra";
if (text === "Add Row") return "Adicionar Linha";
if (text === "Calculate") return "Calcular";
if (text === "Statistics") return "Estatísticas";
if (text === "Variable") return "Variável";
if (text === "Number of Observations") return "Número de Observações";
if (text === "Sum") return "Soma";
if (text === "Min") return "Min";
if (text === "Max") return "Max";
if (text === "Average") return "Média";
if (text === "Mode") return "Moda";
if (text === "Mean") return "Mediana";
if (text === "1st Quantile") return "1º Quartil";
if (text === "3rd Quantile") return "3º Quartil";
if (text === "Percentiles") return "Percentis";
if (text === "Dispersion") return "Dispersão";
if (text === "Variance") return "Variancia";
if (text === "Standard Deviation") return "Desvio Padrão";
if (text === "Median Absolute Deviation") return "Desvio Absoluto da Mediana";
if (text === "InterQuantile Range") return "Distância Interquartil";
if (text === "Similarity") return "Comparação";
if (text === "Correlation (R)") return "Correlação (R)";
if (text === "Covariance") return "Covariancia";
if (text === "Linear Regression") return "Regressão Linear";
if (text === "Input Mode") return "Formato Dados";
if (text === "Raw Data") return "Dados em Bruto";
if (text === "Absolute Frequencies") return "Frequências Absolutas";
if (text === "Relative Frequencies") return "Frequências Relativas";
if (text === "Value") return "Valor";
if (text === "Frequency") return "Frequência";
if (text === "Absolute Frequency") return "Frequência Absoluta";
if (text === "Relative Frequency") return "Frequência Relativa";
if (text === "Accumulated Absolute Frequency") return "Frequência Absoluta Acumulada";
if (text === "Accumulated Relative Frequency") return "Frequência Relativa Acumulada";
if (text === "Coefficient of Variation") return "Coeficiente de Variação";
if (text === "Line Formula") return "Fórmula da Reta de Regressão";
if (text === "Outlier Interval") return "Intervalo Outliers";
if (text === "Extreme Outlier Interval") return "Intervalo Outliers Extremos";
if (text === "Outliers") return "Outliers";
if (text === "Extreme Outliers") return "Outliers Extremos";
if (text === "") return "";
alert("No translation for [" + text + "]");
return text;
}
if (navigator.language && (navigator.language.startsWith("pt") || navigator.language.startsWith("PT"))) {
document.querySelectorAll("[lang]").forEach((element) => {
if (element.parentElement != null && element.text != null) {
element.text = translate(element.text);
} else if (element.parentElement != null && element.textContent != null) {
element.textContent = translate(element.textContent);
} else if (element.parentElement != null) {
alert("Xpto: " + element.textContent);
}
});
}
</script>
</body>
</html>