- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
I'm trying to generate N-dimensional Gaussian Sobol sequences with mean 0 and std. dev of 1, but I'm noticing that the sample mean of the Nth dimension is quite off. Additionally, this column has no values that are >0, whereas all other columns seem to be properly distributed. Any ideas?
For example (check of return values removed for brevity):
const int METHOD=0, DIMENS=5, SAMPLES=100000;
VSLStreamStatePtr stream;
vslNewStream( &stream, VSL_BRNG_SOBOL, DIMENS );
double *MAT = new double[DIMENS*SAMPLES];
vdRngGaussian( METHOD, stream, DIMENS*SAMPLES, MAT, 0.0, 1.0 );
// if MAT is written to csv file, loaded into excel
// and sorted by column, it becomes apparent that
// the maximum value of the last column (5 in this case)
// is never >0. the mean of this column is also not close
// to 0 as one should expect(?). all other columns are
// distributed between -4 and 4, while column 5 is between
// 0 and 4.
For example (check of return values removed for brevity):
const int METHOD=0, DIMENS=5, SAMPLES=100000;
VSLStreamStatePtr stream;
vslNewStream( &stream, VSL_BRNG_SOBOL, DIMENS );
double *MAT = new double[DIMENS*SAMPLES];
vdRngGaussian( METHOD, stream, DIMENS*SAMPLES, MAT, 0.0, 1.0 );
// if MAT is written to csv file, loaded into excel
// and sorted by column, it becomes apparent that
// the maximum value of the last column (5 in this case)
// is never >0. the mean of this column is also not close
// to 0 as one should expect(?). all other columns are
// distributed between -4 and 4, while column 5 is between
// 0 and 4.
Link kopiert
5 Antworten
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Please try it:
#define SEED 1
.......................
double a=0.0,sigma=1.0;
.......................
/***** Initialize *****/
vslNewStream( &stream, VSL_BRNG_SOBOL, SEED );//Not vslNewStream( &stream, VSL_BRNG_SOBOL, DIMENS );
/***** Call RNG *****/
vdRngGaussian( METHOD, stream, DIMENS*SAMPLES, MAT, a, sigma );
.........................
.........................
/***** Deinitialize *****/
vslDeleteStream( &stream );
#define SEED 1
.......................
double a=0.0,sigma=1.0;
.......................
/***** Initialize *****/
vslNewStream( &stream, VSL_BRNG_SOBOL, SEED );//Not vslNewStream( &stream, VSL_BRNG_SOBOL, DIMENS );
/***** Call RNG *****/
vdRngGaussian( METHOD, stream, DIMENS*SAMPLES, MAT, a, sigma );
.........................
.........................
/***** Deinitialize *****/
vslDeleteStream( &stream );
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
vslNewStream( &stream, VSL_BRNG_SOBOL, SEED );/*Not vslNewStream( &stream, VSL_BRNG_SOBOL, DIMENS );*/
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
vslNewStream( &stream, BRNG, SEED );
vdRngGaussian( METHOD, stream, N, r, a, sigma );
In the case of vdRngGaussian(...) called only once:
In fact, the "random" values are always fixed and not changed, if BRNG and SEED are not change.
But you can call vdRngGaussian() many times to generate the random values.
vdRngGaussian( METHOD, stream, N, r, a, sigma );
In the case of vdRngGaussian(...) called only once:
In fact, the "random" values are always fixed and not changed, if BRNG and SEED are not change.
But you can call vdRngGaussian() many times to generate the random values.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Or you can try:
#define SEED 7
#define SEED 7
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Box-Muller methodfor generation of one Gaussian random number uses a pair of uniform random variates. So, in order to obtain N samples of normally distributed random vectors of dimension DIM one needs to initialize Sobol quasi-random number generator with dimension (seed)2*DIM:
#define BRNG VSL_BRNG_SOBOL
#define SEED 10
#define SEED 10
#define METHOD 0
#define DIMENS 5
#define N 1000
#define N 1000
...
vslNewStream( &stream, BRNG, SEED );
vdRngGaussian( METHOD, stream, DIMENS*N, r, 0.0, 1.0 );
vdRngGaussian( METHOD, stream, DIMENS*N, r, 0.0, 1.0 );
vslDeleteStream( &stream );
...
Please, find additional information about methods of generation of Gaussian rundom numbers and quasi-random random generators implemented in VSL
and MKL Manual http://www.intel.com/software/products/mkl/docs/mklman.htm
Antworten
Themen-Optionen
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite