QUnif(sfsmisc)
QUnif()所属R语言包:sfsmisc
Quasi Randum Numbers via Halton Sequences
哈尔顿的准Randum数通过序列
译者:生物统计家园网 机器人LoveR
描述----------Description----------
These functions provide quasi random numbers or space filling or low discrepancy sequences in the p-dimensional unit cube.
这些功能提供准随机数字或p维单位立方体空间填充或低的差异序列。
用法----------Usage----------
sHalton(n.max, n.min = 1, base = 2, leap = 1)
QUnif (n, min = 0, max = 1, n.min = 1, p, leap = 1)
参数----------Arguments----------
参数:n.max
maximal (sequence) number.
最大(序列)号。
参数:n.min
minimal sequence number.
最小的序列号。
参数:n
number of p-dimensional points generated in QUnif. By default, n.min = 1, leap = 1 and the maximal sequence number is n.max = n.min + (n-1)*leap.
数p维点在QUnif。默认情况下,n.min = 1, leap = 1和最大的序列号是n.max = n.min + (n-1)*leap。
参数:base
integer >= 2: The base with respect to which the Halton sequence is built.
整数>= 2:基方面,建造哈尔顿序列。
参数:min, max
lower and upper limits of the univariate intervals. Must be of length 1 or p.
的上限和下限的单变量的时间间隔。必须是长度为1或p。
参数:p
dimensionality of space (the unit cube) in which points are generated.
维空间(单位立方体)点生成。
参数:leap
integer indicating (if > 1) if the series should be leaped, i.e., only every leapth entry should be taken.
整数,表示(如果> 1)系列是否跳了起来,也就是说,只有每leap个条目应采取。
值----------Value----------
sHalton(n,m) returns a numeric vector of length n-m+1 of values in [0,1].
sHalton(n,m)返回一个数值向量的长度n-m+1在[0,1]值。
QUnif(n, min, max, n.min, p=p) generates n-n.min+1 p-dimensional points in [min,max]^p returning a numeric matrix with p columns.
QUnif(n, min, max, n.min, p=p)产生n-n.min+1p维点[min,max]^p返回一个数字矩阵p列。
注意----------Note----------
For leap Kocis and Whiten recommend values of L=31,61,149,409, and particularly the L=409 for dimensions up to 400.
leap Kocis和美白的建议值L=31,61,149,409,特别是L=409尺寸为400。
(作者)----------Author(s)----------
Martin Maechler
参考文献----------References----------
Random Number Generation and Monte Carlo Simulation; sec.\ 6.3. Springer.
Computationsl Investigations of Low-Discrepancy Sequences. ACM Transactions of Mathematical Software 23, 2, 266–294.
实例----------Examples----------
32*sHalton(20, base=2)
stopifnot(sHalton(20, base=3, leap=2) ==
sHalton(20, base=3)[1+2*(0:9)])
## ------- a 2D Visualization -------[#-------一个二维的可视化-------]
Uplot <- function(xy, axes=FALSE, xlab="", ylab="", ...) {
plot(xy, xaxs="i", yaxs="i", xlim=0:1, ylim=0:1, xpd = FALSE,
axes=axes, xlab=xlab, ylab=ylab, ...)
box(lty=2, col="gray40")
}
do4 <- function(n, ...) {
op <- mult.fig(4, main=paste("n =", n,": Quasi vs. (Pseudo) Random"),
marP=c(-2,-2,-1,0))$old.par
on.exit(par(op))
for(i in 1:2) {
Uplot(QUnif(n, p=2), main="QUnif", ...)
Uplot(cbind(runif(n), runif(n)), main="runif", ...)
}
}
do4(100)
do4(500)
do4(1000, cex = 0.8, col="slateblue")
do4(10000, pch= ".", col="slateblue")
do4(40000, pch= ".", col="slateblue")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|