回答編集履歴

1

実際にsimple-statisticsで平均・標準偏差・偏差値を計算したものを追記

2021/07/29 10:30

投稿

momotuwo
momotuwo

スコア155

test CHANGED
@@ -35,3 +35,71 @@
35
35
 
36
36
 
37
37
  https://www.monotalk.xyz/blog/Find-variance-standard-deviation-z-score-deviation-value-in-JavaScript-library-simple-statistics/
38
+
39
+
40
+
41
+ ```html
42
+
43
+ <!DOCTYPE html>
44
+
45
+ <html lang="ja" dir="ltr">
46
+
47
+ <head>
48
+
49
+ <meta charset="utf-8" />
50
+
51
+ <meta http-equiv="Content-Type" content="text/html; charset=shift_jis" />
52
+
53
+ <script src="https://unpkg.com/simple-statistics@7.7.0/dist/simple-statistics.min.js"></script>
54
+
55
+ <title></title>
56
+
57
+ </head>
58
+
59
+ <body>
60
+
61
+ <script>
62
+
63
+ var x = [
64
+
65
+ 65, 73, 42, 81, 60, 75, 62, 53, 69, 77, 83, 65, 72, 65, 81, 66, 69, 73,
66
+
67
+ 88, 53,
68
+
69
+ ];
70
+
71
+ var mean = ss.mean(x);
72
+
73
+ var s = ss.standardDeviation(x);
74
+
75
+ var hensa = (10 * (81 - mean)) / s + 50;
76
+
77
+
78
+
79
+ document.write('平均:' + mean);
80
+
81
+ document.write('<br>');
82
+
83
+ document.write('標準偏差:' + s);
84
+
85
+ document.write('<br>');
86
+
87
+
88
+
89
+ for (score of x) {
90
+
91
+ var d = (10 * (score - mean)) / s + 50;
92
+
93
+ document.write('得点' + score + 'の偏差値:' + d + '<br>');
94
+
95
+ }
96
+
97
+ </script>
98
+
99
+ </body>
100
+
101
+ </html>
102
+
103
+
104
+
105
+ ```