gpt4 book ai didi

r - rnorm 函数使用的算法

转载 作者:行者123 更新时间:2023-12-03 18:16:44 24 4
gpt4 key购买 nike

rnorm 正在使用哪种算法函数默认生成标准正态分布的随机数?

最佳答案

?RNGkind .默认是反演算法:

normal.kind can be "Kinderman-Ramage", "Buggy Kinderman-Ramage" (not for set.seed), "Ahrens-Dieter", "Box-Muller", "Inversion" (the default), or "user-supplied". (For inversion, see the reference in qnorm.) The Kinderman-Ramage generator used in versions prior to 1.7.1 (now called "Buggy") had several approximation errors and should only be used for reproduction of old results. The "Box-Muller" generator is stateful as pairs of normals are generated and returned sequentially. The state is reset whenever it is selected (even if it is the current normal generator) and when kind is changed.



您可以通过以下方式更改算法
RNGkind(normal.kind = "Box-Muller")

您可以通过查看 RNGkind()[2] 找到当前设置的内容。 .

关于r - rnorm 函数使用的算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15369639/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com