Serving the Quantitative Finance Community

 
User avatar
animeshsaxena
Topic Author
Posts: 18
Joined: June 19th, 2008, 2:56 pm

Sobol Numbers

July 25th, 2011, 9:59 am

I am using the direction numbers given by this websitehttp://web.maths.unsw.edu.au/~fkuo/sobol/index.htmlI understand it's widely used so direction numbers are bound to be correct!When i use them to generate a sample path for 1 year stock then max the stock price is reaching is <106. I am not sure weather the numbers are crappy or something else. I rechecked my code many times, but it's fairly simple. double expiry=1.0; int dimensions = 50; int nsims = 10; double **phi = sobolnumbers(dimensions,nsims); double **paths; //each simulation consists of 1000 dimensions paths = new double*[dimensions]; for(int i=0;i<dimensions;i++) { paths = new double[nsims]; } for(int i=0;i<nsims;i++) paths[0]=100; double dt = 1.0/50; printf("%.5f",dt*dimensions); //perfect sobol numbers working! for(int j=0;j<nsims;j++) { for(int i=1;i<dimensions;i++) { paths[j] = paths[i-1][j]*exp((0.05-0.20*0.20*0.5)*dt + inverse(phi[j])*0.2*pow(dt,0.5)); printf("%.2f\t",paths[j]); } printf("\n\n\n"); }dt = 1/50 so that dt * dimensions -> dt * 50 = 1 or 1 year. ///Sample output100.06 98.23 100.18 99.34 102.69 99.46 100.42 99.10 101.68 97.4297.91 95.55 96.93 96.56 100.90 100.74 106.25 104.01 105.79 101.98102.73 101.63 104.63 101.75 102.98 102.35 106.30 104.63 107.02 101.59101.88 100.15 102.28 96.30 96.46 93.62 94.64 93.95 97.34 93.5794.15 93.02 95.61 95.35 100.03 97.77 99.32 97.36 99.16100.06 98.23 100.18 101.15 97.97 101.27 100.42 104.94 104.53 106.05103.49 102.13 104.79 100.40 100.90 100.74 106.25 104.01 105.79 108.92107.75 108.54 104.63 104.93 99.60 101.88 100.28 97.52 98.69 98.09101.88 103.49 101.15 106.12 105.83 101.73 102.36 101.14 103.95 102.19104.36 98.25 98.42 101.97 101.23 102.33 99.32 101.74 100.28100.06 98.23 100.18 103.56 102.69 103.68 100.42 100.04 104.53 102.00103.49 104.01 99.65 102.25 100.90 102.12 99.30 103.14 102.51 100.90103.21 97.97 98.24 101.15 100.07 100.80 97.17 95.12 96.75 96.59101.88 102.28 97.60 99.98 98.54 98.05 102.13 99.49 100.81 107.21107.15 109.13 106.98 103.39 104.27 103.27 106.53 103.39 104.52100.06 102.05 100.18 99.34 102.69 103.68 100.42 100.93 96.70 95.4397.91 102.32 101.93 99.46 100.90 99.32 101.59 101.88 96.71 94.0495.17 98.85 98.24 101.15 100.07 96.46 97.17 98.84 96.75 96.59101.88 98.88 99.95 103.55 102.80 101.06 103.21 103.39 97.34 98.8896.64 96.38 101.11 103.92 102.68 98.71 99.32 98.82 102.93100.06 102.05 100.18 97.03 97.97 101.27 100.42 99.10 101.68 102.2097.91 97.54 101.93 103.41 100.90 106.43 106.25 104.01 105.79 108.92107.75 103.87 104.63 105.90 102.98 102.35 106.30 106.60 101.19 99.60101.88 106.11 105.58 102.85 104.22 106.76 105.23 100.41 100.81 102.67100.65 100.60 106.98 107.89 104.27 103.27 106.53 102.40 103.04100.06 98.23 100.18 99.34 102.69 99.46 100.42 100.04 104.53 102.00103.49 99.15 99.65 98.34 100.90 101.19 96.05 98.24 96.71 100.4499.83 101.03 98.24 103.62 103.45 105.23 103.00 103.76 100.02 102.98101.88 104.36 102.86 103.27 98.54 99.85 97.27 101.31 100.81 102.67100.65 107.04 106.98 110.36 109.31 110.23 106.53 104.72 106.96100.06 102.05 100.18 103.56 102.69 99.46 100.42 104.94 104.53 102.00103.49 99.15 99.65 102.25 100.90 103.89 102.78 99.08 99.80 97.6999.37 104.80 104.63 101.75 102.98 106.95 106.30 108.72 107.02 101.59101.88 103.23 100.56 100.06 104.22 102.72 105.23 105.64 100.81 99.85103.00 103.87 100.38 102.24 100.22 100.17 106.53 106.24 111.46100.06 102.05 100.18 103.56 102.69 99.46 100.42 104.94 104.53 102.00103.49 99.15 99.65 102.25 100.90 100.74 106.25 108.07 105.79 106.57102.73 101.63 104.63 104.93 99.60 98.05 100.28 99.67 103.52 104.77101.88 108.34 108.29 106.15 108.12 104.48 105.37 108.69 107.66 102.74103.14 105.65 104.14 108.46 107.92 105.13 106.53 106.71 100.47100.06 102.05 100.18 101.15 97.97 97.15 100.42 99.10 101.68 102.2097.91 102.32 101.93 99.46 100.90 98.12 99.30 103.14 102.51 102.8097.58 96.05 98.24 98.09 103.45 105.23 103.00 106.05 104.91 101.14101.88 97.22 97.60 99.98 98.54 99.85 97.27 96.79 100.81 99.85103.00 103.87 100.38 106.75 106.70 104.60 106.53 103.39 104.52Can someone point out the mistake or the joe's sobol numbers are not suitable for financial applications???
 
User avatar
nwhitehe
Posts: 0
Joined: March 3rd, 2006, 6:57 am

Sobol Numbers

July 26th, 2011, 8:54 pm

I can vouch for the goodness of the direction vectors on the site you referenced. For the CURAND random number generation library in the CUDA Toolkit, we initially took the buggy numbers from before June 2010. As we added tests we started seeing problems, then we went back and saw that the data set had been updated. With the latest vectors we haven't seen any problems with Sobol' generation (CUDA 4.0 Toolkit has the good ones).I can't say exactly what's going wrong in the code (if anything), but I would simplify and start with 2 dimensional rather than 1000 dimensional. With 2d you can plot the data and visualize it to see what's going on. Things can be incredibly obvious visually that are impossible to realize when staring at numbers.
 
User avatar
animeshsaxena
Topic Author
Posts: 18
Joined: June 19th, 2008, 2:56 pm

Sobol Numbers

July 27th, 2011, 2:27 am

I found the mistake in my code. Had interchanged the variables while accessing the matrix of sobol numberspaths[j] = paths[i-1][j]*exp((0.05-0.20*0.20*0.5)*dt + inverse(phi[j])*0.2*pow(dt,0.5));i corresponding to dimension and j corresponding to simulations, should have been paths[j] instead of paths[j]. Silly mistake!!i got good sobol numbers and am able to price options using monte carlo simulations perfectly.
 
User avatar
Dostoevsky
Posts: 0
Joined: August 13th, 2001, 12:59 pm

Sobol Numbers

October 12th, 2014, 10:46 am

QuoteOriginally posted by: animeshsaxenaQuoteI am using the direction numbers given by this website http://web.maths.unsw.edu.au/~fkuo/sobol/index.html I understand it's widely used so direction numbers are bound to be correct!For the comparison of various Sobol' sequences generators based on quoted and other direction numbers used in the industry readI. Sobol', D. Asotsky, A. Kreinin, S. Kucherenko. Construction and Comparison of High-Dimensional Sobol' Generators, 2011, Wilmott Journal, Nov, pp. 64-79 here
Last edited by Dostoevsky on October 11th, 2014, 10:00 pm, edited 1 time in total.