Edited at

分散を1回のループで求めるメモ

More than 5 years have passed since last update.

分散を1回のループで求めるメモ


分散.as

for each(x in nums)

{
s1 += x;
s2 += x * x;
}
avg = s1 / n;
v = s2 / n - avg * avg;
return v;


標準偏差.as

return Math.sqrt(v);



偏差値.as

return (10 * (nums[i] - avg)) / Math.sqrt(v) + 50;