Re: [問題] central limit theorem
底下是我找到的演算法 (參考於http://www.dspguru.com/howto/tech/wgn.htm)
The Central Limit Theorm states that the sum of N randoms will approach normal distribution as N approaches infinity.
We can outline an algorithm that uses this approach as:
X=0
for i = 1 to N
U = uniform()
X = X + U
end
/* for uniform randoms in [0,1], mu = 0.5 and var = 1/12 */
/* adjust X so mu = 0 and var = 1 */
X = X - N/2 /* set mean to 0 */
X = X * sqrt(12 / N) /* adjust variance to 1 */
=============================================================
Q1:在統計上,uniform 跟 normal 有什麼差別嗎?(因為 大大提到,用
rand()所產生出來的隨機值除32767,會得到uniform的隨機值(值介於0~1)
固有此一問)
Q2:剛剛大大提到,若是將所有取樣做平均,即可得到具有 normal特性的隨機值
可是上面的演算法中,只有把取樣加起來而已,那?
擷取如下 :
X=0
for i = 1 to N
U = uniform()
X = X + U
end
Q3:那關於如何改變隨機值中 normal的特性,演算法中也有提到
,我不了解他為什麼可以這樣做?
截取如下 :
X = X - N/2 /* set mean to 0 */
X = X * sqrt(12 / N) /* adjust variance to 1 */
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.230.227.14
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 4 之 8 篇):