TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Visualization of randomness

4 点作者 matthiasb大约 14 年前

1 comment

foob大约 14 年前
It's a fun little visualization but it's also worth noting that a chi square test would achieve the same result but in a much more quantitative manner. Using his example, we'll generate N integers ranging from 0-9. Let n(0) denote the number of 0's we get, n(1) the number of 1's, and so on. Then our expected value for n(0) is N/10 and likewise for each of the other n(i). The distribution of n(0) will be Gaussian for sufficiently large N and the standard deviation will be sqrt(N/10). Then if we take the sum over i from 0 to 9 of [(n(i)-N/10)^2]10/N and call this quantity Q then it can be shown that Q will follow a chi-square distribution with k=9 degrees of freedom (one less than ten because the tenth is determined by N and the other 9). If we then take [(Q/k)-1]/sqrt(2k) then this tells us how many standard deviations away from our expected chi-square value we fall. If there's a mistake with the distribution of numbers then the number of standard deviations will tend to drift farther and farther from 0 as N gets bigger, a rule of thumb being that if you're more than two or three sigma out you might want to run a few more times to double check and if you fall five or more sigmas out then there's most probably a mistake in your algorithm.<p>EDIT: I tried to figure out how to make an asterisk and not just <i>italics</i> but couldn't do it.
评论 #2605762 未加载