找回密码
 注册
查看: 244|回复: 0

R语言 setRNG包 setRNG-package()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 01:32:51 | 显示全部楼层 |阅读模式
setRNG-package(setRNG)
setRNG-package()所属R语言包:setRNG

                                        setRNG
                                         setRNG

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Programs to set random number generator (and seed) in R and S.
程序来设置随机数发生器(及种子)的R和S中


用法----------Usage----------



<p>library("setRNG")
</p>



介绍----------Introduction----------

This library provides tools to simplify recording and resetting the random  number generator, to help make monte carlo experiments easily reproducible.  It uses the R/S tools for setting the seed, but also records and sets the mechanism for converting uniform numbers to normally distributed numbers. (It could be extended to other transformations, but I have not done that.)
该库提供了工具,以简化记录和重置随机数发生器,以帮助Monte Carlo实验很容易重复的。它使用的R / S工具,用于设置种子,而且还记录和设置的机制,用于将均匀的编号,以正态分布号码。 (可以扩展到其他的转换,但我没有这样做。)

The setRNG function would typically be called by simulation programs (see example) to set the  RNG information if given, and record the RNG information in all cases. This information can be returned with the result of the simulation. That way the simulation can always be reproduced if necessary.
通常被称为setRNG功能的模拟程序(参见示例)设置RNG如果给定的信息,并记录在所有情况下的RNG信息。此信息可以被返回的仿真结果。这样的模拟可以总是被再现(如果必要)。

The library also implements an approach to random number generation  which allows the same random experiments to be replicated in S and R. The functions in the S/ directory allow the R results using  Wichmann-Hill and Box-Muller to be replicated in S. These were done with  the aid of an example from B. D. Ripley. (The files in the S/  directory of the package are for use with S not R.) These functions are intended primarily as a way to confirm that simulations and estimations with simulated data work in  the same way in both S and R, not as an improved RNG. (It has only been tested in Splus 3.3) Default and other RNGs can still be used and are preferred for both speed and  theoretical reasons.
该库还实现了一个随机数生成的方法,它允许在S和R的相同的随机实验要被复制在S /目录的功能允许在S.这些要被复制的R结果使用Wichmann  - 希尔和Box-穆勒进行,BD里普利的一个例子援助。 (在S /的包目录中的文件是用于与S不R.)这些功能的主要目的是作为一种方法来确认,使用模拟数据在S和R都以同样的方式工作的模拟和估计,而不是作为改进的RNG。 (已经过测试,在S-PLUS 3.3)默认的和其他的随机数据生成器仍然可以使用,是首选的速度和理论方面的原因。


实例----------Examples----------


setRNG(kind="Wichmann-Hill", seed=c(979,1479,1542), normal.kind="Box-Muller")
rnorm(10)

sim <-function(rng=NULL)
{if(!require("setRNG")) stop("This function requires the setRNG package.")
  if(is.null(rng)) rng &lt;- setRNG() # returns setting so don't skip if NULL[不要跳过回报率设置,以便如果NULL]
  else        {old.rng <- setRNG(rng);  on.exit(setRNG(old.rng))  }
  x <- list(numbers=rnorm(10))
  x$rng <- rng
  x
}

z <- sim()
sim()$numbers
sim(rng=getRNG(z))$numbers
z$numbers


转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-5-20 23:14 , Processed in 0.063017 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表