Ralph Vince - Portfolio Mathematics

(Brent) #1

408 THE HANDBOOK OF PORTFOLIO MATHEMATICS


do{
generator.setSeed(random.nextLong());
long
pn=(long)(generator.nextDouble()*(double)nopermutations);
double
hprpermutation[]=nPqi(counter,pn);
double theB =
(double)B(hprpermutation,usedrawdowninsteadofruin);
if(theB>0.0){
theB *= probThisB;
passed += theB;
}
sumOfProbs += probThisB;
permutationcount++;

}while(permutationcount<samplesizeL);
}
double result=1.0-passed/sumOfProbs;
System.out.println(counter+” = ”+result);
counter++;
}
}
}

Unlike the previous code provided, this code class works only with one
market system, and the format for the input file differs from the first in that
in this class, each line from the third line on is a semicolon-delimited value
pair of outcome;probability.
Thus, the input file in this real-world example appears as:


Real-world example file of a single scenario spectrum
.45
-1889;0.015625
-1430.42;0.046875
-1295;0.015625
-750;0.0625
-450;0.125
0;0.203125
390;0.078125
800;0.328125
1150;0.0625
1830;0.046875


The technique of using a random sample gets our first few values for
the line ofRXtoqup and running with very good estimates in short order.

Free download pdf