Some test functions for Sobol sequences
Some test functions for Sobol sequences
sobol.directions(polycoef, deg, prevmj, nbpoint, echo=FALSE) sobol.basic(n, polycoef, deg, prevmj, echo=FALSE, output=c("real", "integer")) sobol.R(n, d, echo=FALSE) int2bit(x) bit2int(x) bit2unitreal(x)
n |
number of observations. |
d |
dimension of observations. |
polycoef |
binary coefficients of the primitive polynomial. |
deg |
degree of the primitive polynomial. |
prevmj |
matrix where each column is the binary representation of integers m_j |
nbpoint |
number of additionnal integers m_j. |
echo |
a logical to show some traces. |
output |
a character string either |
x |
an integer to convert in base 2 or its binary representation |
sobol.directions
computes the direction numbers used when computing Sobol sequences.
sobol.basic
compute the Sobol sequence in one dimension according to a primitive
polynomial and specified integers m_j.
int2bit
computes the binary representation of the integer part of a real,
bit2int
computes an integer from its binary representation.
bit2unitreal
computes the radical inverse function in base 2.
a vector of length n
for sobol.basic
or a matrix for sobol.directions
.
Christophe Dutang
Glasserman P., (2003); Monte Carlo Methods in Financial Engineering, Springer.
quasiRNG
for quasi random number generation.
#page 306 of Glassermann p13 <- int2bit(13) prevterm <- sapply(c(1,3,3), int2bit) colnames(prevterm) <- apply(prevterm, 2, bit2int) sobol.directions(p13, 3, prevterm, 2, echo=FALSE) sobol.basic(15, p13, 3, c(1,3,3), echo=FALSE) sobol.basic(15, p13, 3, c(1,3,3), echo=FALSE, output="i") #page 307 of Glassermann trueval <- c(16, 24, 8, 12, 28, 20, 4, 30, 14, 6, 22, 18, 2, 10, 26, 5, 21, 29, 13, 9, 25, 17, 1, 27, 11, 3, 19, 23, 7, 15, 31)/32 cbind(sobol.basic(31, p13, 3, prevterm, echo=FALSE, output="r") , trueval)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.