rstream.mrg32k3a-class(rstream)
rstream.mrg32k3a-class()所属R语言包:rstream
Class "rstream.mrg32k3a" – Multiple streams with MRG32k3a
的类“rstream.mrg32k3a” - 多数据流MRG32k3a
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This class implements the "rstream" interface for Pierre L'Ecuyer's RngStreams package with the MRG32K3a multiple recursive generator as its backbone generator. This package is well suited for multiple independent streams of uniform random numbers. In particular it provides antithetic variates and substreams. A very important feature is that different streams are stochastically independent (in opposition to many other random number generators where the uses has to choose seeds carefully). For that reason there only exists a package seed for all streams and indiviual seeds should be avoided (and requires expertise).
这类实现了的“rstream”的接口,的皮埃尔·LEcuyers RngStreams包的MRG32K3a多个作为其骨干发电机的递归发电机。这个软件包以及适合于多个独立的数据流的均匀分布的随机数。特别是,它提供了对偶变元和子流。一个非常重要的特点是,不同的数据流是随机独立(在反对很多其他的用途,仔细选择种子的随机数生成器)。出于这个原因,只存在一个包种子,所有的流和indiviual的种子应该避免的(而且需要专业知识)。
类对象----------Objects from the Class----------
Objects can be created by calls of the form new("rstream.mrg32k3a", name, seed, force.seed, antithetic, incprecision).
可以创建对象通过调用的形式new("rstream.mrg32k3a", name, seed, force.seed, antithetic, incprecision)。
name: An arbitrary string to name the stream object. If omitted a string that consists of mrg32k3a and some number (which is increased every time when a new rstream
名称:任意字符串命名的流对象。如果一个字符串组成的mrg32k3a和一些数字(这是增加每次当一个新的rstream的省略
seed: An array of six numbers. The seed for the RngStreams package. If omitted a random seed is used. It should only be set at the first creation of an instance of
种子:一组六个数字。的种子的RngStreams包。如果省略了随机种子。它应该只在第一次创建的一个实例
force.see: A boolean. If the RngStreams package should be reseeded (which is not recommended) it must be TRUE.
force.see:一个布尔值。如果RngStreams包应重新接种(不推荐),它必须是TRUE。
antithetic: A boolean. Whether or not antithetic random numbers should be produced.
对立的:一个布尔值。无论是或不是对立的随机数产生。
incprecision: A boolean. Whether or not random numbers with increased precision should be produced.
incprecision:一个布尔值。应产生与否的随机数与增加的精确度。
扩展----------Extends----------
Class "rstream", directly.
类"rstream",直接。
方法----------Methods----------
The class "rstream.mrg32k3a" provides the following methods for handling "rstream.mrg32k3a" objects. Some methods that return parameters of the stream object have a variant that uses <- to change the respective parameters. See the man pages for the respective methods for details.
类“rstream.mrg32k3a”提供了以下方法用于处理“rstream.mrg32k3a”的对象。参数返回的流对象的一些方法,有一个变种,使用<-改变相应的参数。相应的方法的详细信息,请参阅手册页。
Methods to use the stream:
使用流的方法:
rstream.sample signature(object = "rstream.mrg32k3a"):
rstream.samplesignature(object = "rstream.mrg32k3a"):
r signature(object = "rstream.mrg32k3a"):
Rsignature(object = "rstream.mrg32k3a"):
rstream.reset signature(object = "rstream.mrg32k3a"):
rstream.resetsignature(object = "rstream.mrg32k3a"):
rstream.nextsubstream signature(object = "rstream.mrg32k3a"):
rstream.nextsubstreamsignature(object = "rstream.mrg32k3a"):
rstream.resetsubstream signature(object = "rstream.mrg32k3a"):
rstream.resetsubstreamsignature(object = "rstream.mrg32k3a"):
Antithetic random streams and increased precision:
对偶随机流和更高的精确度:
rstream.antithetic signature(object = "rstream.mrg32k3a"): Whether or not the stream object returns antithetic random
rstream.antithetic signature(object = "rstream.mrg32k3a"):是否返回的流对象对偶随机
rstream.antithetic<- signature(object = "rstream.mrg32k3a"):
rstream.antithetic < - signature(object = "rstream.mrg32k3a"):
rstream.incprecision signature(object = "rstream.mrg32k3a"): Whether or not the stream object returns random numbers with
rstream.incprecisionsignature(object = "rstream.mrg32k3a"):不管是不是流对象返回随机数
rstream.incprecision<- signature(object = "rstream.mrg32k3a"):
rstream.incprecision < - signature(object = "rstream.mrg32k3a"):
Handling "rstream.mrg32k3a" objects:
处理“rstream.mrg32k3a”对象:
print signature(x = "rstream.mrg32k3a"):
打印signature(x = "rstream.mrg32k3a"):
rstream.name signature(object = "rstream.mrg32k3a"):
rstream.namesignature(object = "rstream.mrg32k3a"):
rstream.name<- signature(object = "rstream.mrg32k3a"):
rstream.name < - signature(object = "rstream.mrg32k3a"):
rstream.clone signature(object = "rstream.mrg32k3a"):
rstream.clonesignature(object = "rstream.mrg32k3a"):
initialize signature(.Object = "rstream.mrg32k3a"):
初始化signature(.Object = "rstream.mrg32k3a"):
When a "rstream.mrg32k3a" object should be used in another R session or saved for some kind of later reuse all information about the object must be packed. Notice no method other than unpacking can be applied to a packed object. It must be unpacked before.
当“rstream.mrg32k3a”对象应使用在另一个R会话或保存为某种重用的对象必须装的所有信息。请注意,没有其他方法比拆包可以应用到压缩对象。它之前必须先解压缩。
rstream.packed signature(object = "rstream.mrg32k3a"):
rstream.packedsignature(object = "rstream.mrg32k3a"):
rstream.packed<- signature(object = "rstream.mrg32k3a"):
rstream.packed < - “signature(object = "rstream.mrg32k3a"):
警告----------Warning ----------
The underlying RngStreams library uses a global variable to store the package seed. This variable is also stored inside R. Whenever a new instance of a "rstream.mrg32k3a" object is created the value of global variable is set to the value of the R object. Thus there is no problem when such "rstream.mrg32k3a" objects are packed for using in later R sessions. However, if such packed objects are not stored in the workspace image, then the R variable gets lost and there is a (extremely small) chance that newly created objects are not stochastically independent from restored objects.
的基本RngStreams库使用一个全局变量来存储包种子。每当一个“rstream.mrg32k3a”对象的一个新实例创建全局变量的值被设置为R对象的值,该变量也被存储内部R.。因此,不存在问题时,的这种“rstream.mrg32k3a”对象被打包在购买R会话使用。但是,如果这样的包装对象不存储在工作区中的图像,然后R变量会丢失,有一个非常小的机会,新创建的对象从恢复的对象是随机独立。
注意----------Note----------
The slots of this class must not be accessed directly. Use the above methods instead.
不能直接访问这个类的插槽。用上面的方法。
"rstream" objects cannot simply be copied by <-. The new variable does not hold a copy of an "rstream" object but just points to the old object which might not be the wanted result (similar to R environments). Use rstream.clone instead.
不能简单地复制<-“rstream”的对象。新的变量不持有一个的“rstream”的对象的副本,但只是点到老的对象,这可能不是所希望的结果(类似的R环境)。使用rstream.clone“。
One may miss a method for reseeding a random stream. However, there is no need for such a method as there is a method for resetting the stream to its initial state. I one needs a stream with a different stream, then a new rstream object should be created at all.
有人可能会错过补种一个随机的数据流的方法。然而,也没有必要为这样的方法,有一种方法用于复位到其初始状态的流。我需要用不同的流流,然后一个新的rstream对象应在所有创建。
Packed objects must be unpacked before any other method can be applied.
可应用于任何其他方法之前,必须先解压缩盒装对象。
(作者)----------Author(s)----------
Josef Leydold <a href="mailto:josef.leydold@wu.ac.at">josef.leydold@wu.ac.at</a>
underlying generator: Pierre L'Ecyuer and Richard Simard
参考文献----------References----------
An object-oriented random-number package with many long streams and substreams. Operations Research 50(6), 1073-1075.
参见----------See Also----------
rstream, rstream.antithetic-methods, rstream.clone-methods, rstream.incprecision-methods, rstream.name-methods, rstream.packed-methods, rstream.reset-methods, rstream.sample-methods, rstream.nextsubstream-methods, rstream.RNG.
rstream,rstream.antithetic-methods,rstream.clone-methods,rstream.incprecision-methods,rstream.name-methods,rstream.packed-methods,rstream.reset-methods,rstream.sample-methods,rstream.nextsubstream-methods,rstream.RNG。
实例----------Examples----------
## create a new rstream.mrg32k3a object[#创建一个新的rstream.mrg32k3a对象]
s <- new("rstream.mrg32k3a")
## show state of this object[#显示该对象的状态]
print(s)
## show and change name of stream object[#显示和更改名称的流对象]
rstream.name(s)
rstream.name(s) <- "mystream"
## get a random number[#得到一个随机数]
x <- rstream.sample(s)
## get a random sample of size 100[#得到一个随机样本大小为100]
x <- rstream.sample(s,100)
## reset random stream[#重置随机流]
rstream.reset(s)
## show and set antithetic flag[#显示和设置对立的标志]
rstream.antithetic(s)
rstream.antithetic(s) <- TRUE
## jump to next substream[#跳转到下一个子]
rstream.nextsubstream(s)
## make a clone of the rstream object[的rstream对象的克隆]
sc <- rstream.clone(s)
## pack and unpack the rstream object[#包装和解压的rstream的的对象]
rstream.packed(s) <- TRUE
rstream.packed(s) <- FALSE
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|