Re: InverseCumulativeRsg

Posted by andrea loddo-2 on
URL: http://quantlib.414.s1.nabble.com/InverseCumulativeRsg-tp937p942.html

Thanks guys, everything works perfectly. :)

 Just one consideration regarding low discrepancy sequences.  If I run  your code, Francois,
as well as mine, the first sequence I get is just a series of zeros. Then the sequences start to have some variability.  But still each one of them looks everything but "random". This is due to the nature of low discrepancy sequences.

 So, let's suppose that I have to price a contingent claim, such as a plain Vanilla call option. In this case the dimension will be simply the number of time steps from the settlement date to the maturity date. Is then reasonable to have one entire path where the generated sample is either a series of zeros or it has very low variability?

Regards,
Andrea.

On 5/31/07, DU VIGNAUD DE VILLEFORT FRANCOIS GASAPRD PHI <[hidden email]> wrote:

 

 

Hi Andrea,

 

Here is a sample code which produces the "expected" results

 

typedef InverseCumulativeRsg<SobolRsg , InverseCumulativeNormal> SobolGenerator;

typedef SobolGenerator::sample_type SobolGeneratorSampleType;

typedef SobolGeneratorSampleType::value_type SobolGeneratorValueType;

 

void main() {

    Size dimension = 3;

    SobolRsg sobol (dimension , 0) ;

    InverseCumulativeNormal invCumNorm (0 , 1) ;

    SobolGenerator myRSG (sobol, invCumNorm);

    for (Size i=0; i< 50; ++i) {

        const SobolGeneratorSampleType& sample = myRSG.nextSequence();

        const SobolGeneratorValueType& values = sample.value;

        copy(values.begin(), values.end(), ostream_iterator<Real>( cout, "\t" ) );

        cout << "\n";

    }

}

 

hope this help,

François

 

 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Andrea Loddo
Sent:
Thursday, May 31, 2007 2:12 PM
To: [hidden email]
Subject: [Quantlib-users] InverseCumulativeRsg

 

Hi all,

What I need a random sequence generator that I instantiate in this way:

Size dimension = 3;
SobolRsg sobol ( dimension , 0 ) ;
InverseCumulativeNormal invCumNorm ( 0 , 1 ) ;
InverseCumulativeRsg<SobolRsg , InverseCumulativeNormal> myRSG ( sobol , invCumNorm ) ;

Everything works perfectly. The only thing I don't get is the concept of dimensionality. I would expect the member

x_.value

of myRSG to be an Array of 3 elements. The member n_,  which should be the dimension of the Array, is correctly set to 3 but apparently just one normal random number is generated. Is there any way to generate as many numbers as I need through the parameter dimension?

Any help will be appreciated.

Andrea.



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users