Home

SSJ User's Guide Package stochprocess Stochastic Processes

image

Contents

1. Sets equidistant observation times at tj j for j 0 d and delta public double getObservationTimes Returns a reference to the array that contains the observation times to ta Warning This method should only be used to read the observation times Changing the values in the array directly may have unexpected consequences The method setObservationTimes should be used to modify the observation times public int getNbObservationTimes Returns the number of observation times excluding the time to public abstract double generatePath Generates returns and saves the sample path X to X t1 X ta It can then be accessed via getPath getSubpath or getObservation The generation method depends on the process type StochasticProcess 4 public double generatePath RandomStream stream Same as generatePath but first resets the stream to stream public double getPath Returns a reference to the last generated sample path X to X tq Warning The returned array and its size should not be modified because this is the one that memorizes the observations not a copy of it To obtain a copy use getSubpath instead public void getSubpath double subpath int pathIndices Returns in subpath the values of the process at a subset of the observation times specified as the times t whose indices j are in the array pathIndices The size of pathIndices should be at least as much as th
2. well as the value of the previous observation X t Warning This method will reset the observations time 1 for this process to nextTime The user must make sure that the t 1 supplied is gt tj CIRProcess 29 public double nextObservation double x double dt Generates an observation of the process in dt time units assuming that the process has value x at the current time Uses the process parameters specified in the constructor Note that this method does not affect the sample path of the process stored internally if any public void setParams double x0 double alpha double b double sigma Resets the parameters X to x0 a alpha b b and sigma of the process Warning This method will recompute some quantities stored internally which may be slow if called too frequently public void setStream RandomStream stream Resets the random stream of the noncentral chi square generator to stream public RandomStream getStream Returns the random stream of the noncentral chi square generator public double getAlpha Returns the value of a public double getB Returns the value of b public double getSigma Returns the value of public ChiSquareNoncentralGen getGen Returns the noncentral chi square random variate generator used The RandomStream used for that generator can be changed via getGen setStream stream for example 30 CIRProcessEuler This class represents a CIR process as
3. W t 1 of this process are then transformed into independent U 0 1 random variates Vj via Vj 8 VTi rjia W r W y a j 1 8 Finally the increments of the Gamma process are computed as Y t Y t 1 G71 Vj where G is the gamma distribution function package umontreal iro lecuyer stochprocess public class GammaProcessPCA extends GammaProcess Constructors public GammaProcessPCA double s0 double mu double nu RandomStream stream Constructs a new GammaProcessPCA with parameters y mu y nu and initial value S to s0 The random variables are created using stream Note that the same Random Stream is used for the GammaProcessPCA and for the BrownianMotionPCA included in this class Both the GammaProcessPCA and the BrownianMotionPCA are generated by inversion public GammaProcessPCA double s0 double mu double nu GammaGen Ggen Constructs a new GammaProcessPCA with parameters y mu y nu and initial value S to s0 All the random variables i e the gamma ones and the normal ones are created using the RandomStream included in the GammaGen Ggen Note that the parameters of the GammaGen object are not important since the implementation forces the generator to use the correct parameters as defined above Methods public double nextObservation This method is not implemented in this class since the path cannot be generated sequentially public double nextObservation double nextT This
4. at the current time Uses the process parameters specified in the constructor Note that this method does not affect the sample path of the process stored internally if any public void setParams double x0 double alpha double b double sigma Resets the parameters X ty x0 a alpha b b and o sigma of the process Warning This method will recompute some quantities stored internally which may be slow if called too frequently CIRProcessEuler 31 public void setStream RandomStream stream Resets the random stream of the normal generator to stream public RandomStream getStream Returns the random stream of the normal generator public double getAlpha Returns the value of a public double getB Returns the value of b public double getSigma Returns the value of public NormalGen getGen Returns the normal random variate generator used The RandomStream used for that gen erator can be changed via getGen setStream stream for example 32 GammaProcess This class represents a gamma process 12 page 82 S t G t u v t gt 0 with mean parameter u and variance parameter v It is a continuous time process with stationary independent gamma increments such that for any At gt 0 S t At S t X 15 where X is a random variate from the gamma distribution Gamma p At v p v In this class the gamma process is sampled sequentially using equation 15 package umontreal
5. double delta double gamma RandomStream stream Constructs a new InverseGaussianProcess The initial value s0 will be overridden by t 0 when the observation times are set Methods public double generatePath double uniforms01 Instead of using the internal stream to generate the path uses an array of uniforms U 0 1 The array should be of the length of the number of periods in the observation times This method is useful for NormalInverseGaussianProcess public double generatePath double uniforms01 double uniforms01b This method does not work for this class but will be useful for the subclasses that require two streams public void setParams double delta double gamma Sets the parameters public double getDelta Returns public double getGamma Returns y InverseGaussianProcess 15 public double getAnalyticAverage double time Returns the analytic average which is t y with t time public double getAnalyticVariance double time Returns the analytic variance which is 9t with t time public int getNumber0fRandomStreams Returns the number of random streams of this process It is useful because some subclasses use different number of streams It returns 1 for InverseGaussianProcess 16 InverseGaussianProcessBridge Samples the path by bridge sampling first finding the process value at the final time and then the middle time etc The method nextObservation returns the path va
6. iro lecuyer stochprocess public class GammaProcess extends StochasticProcess Constructors public GammaProcess double s0 double mu double nu RandomStream stream Constructs a new GammaProcess with parameters u mu y nu and initial value S to s0 The gamma variates X in 15 are generated by inversion using stream public GammaProcess double s0 double mu double nu GammaGen Ggen Constructs a new GammaProcess with parameters mu y nu and initial value S to s0 The gamma variates X in are supplied by the gamma random variate generator Ggen Note that the parameters of the GammaGen object Ggen are not important since the implementation forces the generator to use the correct parameters as defined above Methods public double nextObservation double nextT Generates and returns the next observation at time t 1 nextTime using the previous observation time t defined earlier either by this method or by setObservationTimes as well as the value of the previous observation X t Warning This method will reset the observations time tj for this process to nextT The user must make sure that the tj 1 supplied is gt tj public double generatePath Generates returns and saves the path X to X t1 X ta The gamma variates X in are generated using the RandomStream stream or the RandomStream included in the GammaGen Ggen public double generatePath double uniform01 Generates returns and s
7. the process with the method setObservationTimes The random stream used to generate the sample path can also be changed using setStrean StochasticProcess Abstract base class for a stochastic process X t t gt 0 sampled or observed at a finite number of time points 0 to lt t lt lt tg The observation times are usually all specified before generating a sample path This can be done via setObservationTimes The method generatePath generates X t X ta and memorizes them in a vector which can be recovered by getPath Alternatively for some types of processes the observations X t can be generated se quentially one at a time by invoking resetStartProcess first and then nextObservation repeatedly For some types of processes the observation times can be specified one by one as well when generating the path This may be convenient or even necessary if the observation times are random for example WARNING After having called the constructor for one of the subclass one must always set the observation times of the process by calling method setObservationTimes for example or otherwise package umontreal iro lecuyer stochprocess public abstract class StochasticProcess Methods public void setObservationTimes double T int d Sets the observation times of the process to a copy of T with t T O and tg T d The size of T must be d 1 public void setObservationTimes double delta int d
8. CA Returns the inner BrownianMotionPCA 39 GammaProcessPCASymmetricalBridge Same as GammaProcessPCABridge but uses the fast inversion method for the symmetrical beta distribution proposed by L Ecuyer and Simard 11 to accelerate the generation of the beta random variables This class works only in the case where the number of intervals is a power of 2 and all these intervals are of equal size package umontreal iro lecuyer stochprocess public class GammaProcessPCASymmetricalBridge extends GammaProcessPCABridge Constructors public GammaProcessPCASymmetricalBridge double s0 double mu double nu RandomStream stream Constructs a new GammaProcessPCASymmetricalBridge with parameters mu y nu and initial value S to s0 The RandomStream stream is used in the GammaGen and in the BetaSymmetricalGen These two generators use inversion to generate random numbers The first uniform random number generated by stream is used for the gamma and the other d 1 for the beta s 40 VarianceGammaProcess This class represents a variance gamma VG process S t X t 0 0 v t gt 0 This process is obtained as a subordinate of the Brownian motion process B t 0 0 using the operational time G t 1 v see 6 PJ X t 0 0 v B G t 1 v 0 6 16 See also for applications to modelling asset returns and option pricing The process is sampled as follows when generatePath is called the method generate Path o
9. Diff public VarianceGammaProcessDiffPCA double s0 double theta double sigma double nu GammaProcessPCA gpos GammaProcessPCA gneg Constructs a new VarianceGammaProcessDiffPCA with parameters 0 theta o sigma v nu and initial value S tp s0 As in VarianceGammaProcessDiff the RandomStream of gneg is replaced by the one of gpos to avoid any confusion Methods public double nextObservation This method is not implemented is this class since the path cannot be generated sequentially 46 VarianceGammaProcessDiffPCA Bridge Same as VarianceGammaProcessDiff but the two inner GammaProcess es are of the type PCABridge Also generatePath double uniform01 distributes the lowest coordinates uniforms to the inner GammaProcessPCABridge according to their eigenvalues package umontreal iro lecuyer stochprocess public class VarianceGammaProcessDiffPCABridge extends VarianceGammaProcessDiffPCA Constructors public VarianceGammaProcessDiffPCABridge double s0 double theta double sigma double nu RandomStream stream Constructs a new VarianceGammaProcessDiffPCABridge with parameters 0 theta o sigma v nu and initial value S tp s0 There is only one RandomStream here which is used for the two inner GammaProcessPCABridge s The other parameters are set as in VarianceGammaProcessDiff AT VarianceGammaProcessDiffP CASymmetricalBridge Same as VarianceGammaProcessDiff but the two inner GammaProcess
10. GeometricVarianceGammaProcess and GeometricBrownianMotion package umontreal iro lecuyer stochprocess public abstract class GeometricLevyProcess extends StochasticProcess Methods public double generatePath Generates a path public double nextObservation Returns the next observation It will also work on a L vy process which is sampled using the bridge order but it will return the observations in the bridge order If the underlying L vy process is of the PCA type this method is not usable public void resetStartProcess Resets the step counter of the geometric process and the underlying L vy process to the start value public void setObservationTimes double time int d Sets the observation times on the geometric process and the underlying L vy process public double getOmega Returns the risk neutral correction public double getMuGeom Returns the geometric drift parameter which is usually the interest rate r public void setMuGeom double muGeom Sets the drift parameter interest rate of the geometric term public StochasticProcess getLevyProcess Returns the L vy process GeometricLevyProcess 13 public void resetRiskNeutralCorrection double omegaRN Changes the value of wrn There should usually be no need to redefine the risk neutral correction from the value set by the constructor However it is sometimes not unique e g in GeometricNormalInverseGaussianProcess I public Ra
11. SSJ Users Guide Package stochprocess Stochastic Processes Version December 17 2014 This package provides tools to generate various stochastic processes CONTENTS 1 Contents E A 2 St chasticProcess lt v awe x one e a a A A A ariei 3 AIRES 6 eae AA a 8 AE NE 9 A ee wie Gt we eee ee 10 bd a a ee ae ee es ee ee e A 12 InverseGaussianProcess 2 2 oa a a 14 iS he siete eas Bee ee we a 16 eee egw ee He ee eee we oe wR 17 Gr LAER EE eee ae ae oe Be wy 19 bee ha eu Gomer Ge ome a Beg eae epee 20 eK a AE oe A e 23 re ee ae ee ee ee ee ee ee 25 bE SOR ey Pala a pod Gs ode oe 27 CIPSA 6 a5 eos O 2 6 Om be he bE we BE wee doe me oH 28 CIR Process lent y 2 lt ei koe ED koe YR KORE EOD oe AR ae RS 30 ee ee ee ee ee ee ee ae ee 32 hd any A des oes eee as 34 do de decd Ae in Aa A A iv e Gee ee Se eh 35 ae ete eee ee ee ee ee are eee er 36 di dde do E Gea Sk Sk eh ae eee ee a 38 jae gh E 39 shaw eee ae ee ee ee ee 40 Petes AN 43 a ee eee editan a 45 Cee Oe Bee ae ee See ee 46 e E eee ee ee 47 GeometricVarianceGammabProcesal 000 a ee 48 CONTENTS 2 Overview This package provides classes to define stochastic processes X t t gt 0 and to simulate their sample paths at a finite number of discrete observation times ty lt t lt lt ty The observation of the generated path is thus the vector X to X t1 X ta The observation times to t can be specified or changed after defining
12. Stream s used to generate the underlying NormalInverseGaussianProcess and its underlying InverseGaussianProcess are set to the same given streamA11 25 OrnsteinUhlenbeckProcess This class represents an Ornstein Uhlenbeck process X t t gt 0 sampled at times 0 to lt t lt lt ta This process obeys the stochastic differential equation dX t a b X t dt o dB t 9 with initial condition X 0 zo where a b and are positive constants and B t t gt 0 is a standard Brownian motion with drift 0 and volatility 1 This process is mean reverting in the sense that it always tends to drift toward its general mean b The process is generated using the sequential technique 7 p 110 1 e 2a tj tj 1 2a X t tb X ti b 1 e7 lti ti1 ay Zj 10 where Z N 0 1 The time intervals t tj can be arbitrarily large package umontreal iro lecuyer stochprocess public class OrnsteinUhlenbeckProcess extends StochasticProcess Constructors public OrnsteinUhlenbeckProcess double x0 double alpha double b double sigma RandomStream stream Constructs a new OrnsteinUhlenbeckProcess with parameters a alpha b o sigma and initial value X t x0 The normal variates Z will be generated by inversion using the stream stream public OrnsteinUhlenbeckProcess double x0 double alpha double b double sigma NormalGen gen Here the normal variate generator is s
13. To allow for differences due to floating point errors time steps are considered to be equal if their relative difference is less than 107 package umontreal iro lecuyer stochprocess public class GammaProcessSymmetricalBridge extends GammaProcessBridge Constructors public GammaProcessSymmetricalBridge double s0 double mu double nu RandomStream stream Constructs a new GammaProcessSymmetricalBridge with parameters u mu y nu and initial value S to s0 The random variables are created using the RandomStream stream Note that the same RandomStream stream is used for the GammaGen and for the BetaSymmetricalGen inluded in this class public GammaProcessSymmetricalBridge double s0 double mu double nu GammaGen Ggen BetaSymmetricalGen BSgen Constructs a new GammaProcessSymmetricalBridge with parameters u mu v nu and initial value S to s0 Note that the RandomStream included in the BetaSymmetricalGen is sets to the one included in the GammaGen to avoid confusion This RandomStream is then used to generate all the random variables 36 GammaProcessPCA Represents a gamma process sampled using the principal component analysis PCA To simulate the gamma process at times ty lt t lt lt tg by PCA sampling a Brownian motion W t t gt 0 with mean 0 and variance parameter y is first generated at times to lt ti lt lt tg by PCA sampling see class BrownianMotionPCA The independent increments W t
14. am public void setOtherStream RandomStream otherStream Sets the otherStream which is the stream used to choose between the two roots in the MSH method InverseGaussianProcessMSH 18 public RandomStream getOtherStream Returns the otherStream which is the stream used to choose between the two quadratic roots from the MSH method public void setNormalGen NormalGen normalGen Sets the normal generator It also sets one of the two inner streams to the stream of the normal generator public NormalGen getNormalGen Returns the normal generator 19 InverseGaussianProcessPCA Approximates a principal component analysis PCA decomposition of the InverseGaussianProcess The PCA decomposition of a BrownianMotionPCA with a covariance matrix identical to the one of our InverseGaussianProcess is used to generate the path of our InverseGaussianProcess 10 Such a path is a perfectly random path and it is hoped that it will provide reduction in the simulation variance when using quasi Monte Carlo The method nextObservation cannot be used with PCA decompositions since the whole path must be generated at once package umontreal iro lecuyer stochprocess public class InverseGaussianProcessPCA extends InverseGaussianProcess Constructors public InverseGaussianProcessPCA double s0 double delta double gamma RandomStream stream Constructs a new InverseGaussianProcessPCA The initial value sO will be overridden by t 0 whe
15. am is used to generate the VarianceGammaProcess object used to implement X in 19 public GeometricVarianceGammaProcess double s0 double mu VarianceGammaProcess vargamma Constructs a new GeometricVarianceGammaProcess The parameters 0 0 v are set to the parameters of the VarianceGammaProcess vargamma The parameter p is set to mu and the initial values S to s0 Methods public void resetStartProcess Resets the GeometricaVarianceGammaProcess but also applies the resetStartProcess method to the VarianceGammaProcess object used to generate this process public void setParams double s0 double theta double sigma double nu double mu Sets the parameters S to s0 0 theta o sigma y nu and u mu of the process Warning This method will recompute some quantities stored internally which may be slow if called repeatedly public double getTheta Returns the value of the parameter 0 GeometricVarianceGammaProcess public double getMu Returns the value of the parameter u public double getNu Returns the value of the parameter v public double getSigma Returns the value of the parameter co public double getOmega Returns the value of the quantity w defined in 20 public VarianceGammaProcess getVarianceGammaProcess Returns a reference to the variance gamma process X defined in the constructor 49 REFERENCES 50 References 1 H Albrecher and M Predota On As
16. ammabProcessDiff This class represents a variance gamma VG process S t X t 0 0 v t gt 0 This process is generated using difference of gamma sampling see 3 2 which uses the representation of the VG process as the difference of two independent GammaProcess es see 12 X 1 9 0 v X 0 T t jay Vp 3 tens Yn 17 where X 0 is a constant corresponding to the initial value of the process and lp VPF 0 2 Un 4 0 202 v 0 2 Vp Vu 2 Vn Vip package umontreal iro lecuyer stochprocess public class VarianceGammaProcessDiff extends VarianceGammaProcess Constructors public VarianceGammaProcessDiff double s0 double theta double sigma double nu RandomStream stream Constructs a new VarianceGammaProcessDiff with parameters O theta 0 sigma v nu and initial value S tp sO stream is used by two instances of GammaProcess T and I respectively The other parameters are as in the class VarianceGammaProcess The GammaProcess objects for PT and I are constructed using the parameters from and their initial values T to and I to are set to 0 public VarianceGammaProcessDiff double s0 double theta double sigma double nu GammaProcess gpos GammaProcess gneg The parameters of the GammaProcess objects for and I are set to those of 18 and their initial values to and T7 to are set to to The RandomStream of the I process is overwritten with the RandomStr
17. at of subpath public double getObservation int j Returns X t from the current sample path Warning If the observation X t for the current path has not yet been generated then the value returned is unpredictable public void resetStartProcess Resets the observation counter to its initial value j 0 so that the current observation X t becomes X to This method should be invoked before generating observations sequentially one by one via nextObservation for a new sample path public boolean hasNextObservation Returns true if j lt d where j is the number of observations of the current sample path generated since the last call to resetStartProcess Otherwise returns false public double nextObservation Generates and returns the next observation X t of the stochastic process The processes are usually sampled sequentially i e if the last observation generated was for time t 1 the next observation returned will be for time tj In some cases subclasses extending this abstract class may use non sequential sampling algorithms such as bridge sampling The order of generation of the s is then specified by the subclass All the processes generated using principal components analysis PCA do not have this method public int getCurrentObservationIndex Returns the value of the index j corresponding to the time t of the last generated observa tion public double getCurrentObservation Returns the value
18. aves the path X to X t1 X ta This method does not use the RandomStream stream nor the GammaGen Ggen It uses the vector of uniform random GammaProcess 33 numbers U 0 1 provided by the user and generates the path by inversion The vector uniform01 must be of dimension d public void setParams double s0 double mu double nu Sets the parameters S tp s0 u mu and y nu of the process Warning This method will recompute some quantities stored internally which may be slow if called repeatedly public double getMu Returns the value of the parameter p public double getNu Returns the value of the parameter v public void setStream RandomStream stream Resets the RandomStream of the GammaGen to stream public RandomStream getStream Returns the RandomStream stream 34 GammaProcessBridge This class represents a gamma process S t G t u v t gt 0 with mean parameter u and variance parameter v sampled using the gamma bridge method see for example B This is analogous to the bridge sampling used in BrownianMotionBridge Note that gamma bridge sampling requires not only gamma variates but also beta vari ates The latter generally take a longer time to generate than the former The class GammaSymmetricalBridgeProcess provides a faster implementation when the number of observation times is a power of two The warning from class BrownianMotionBridge applies verbatim to this class pa
19. ckage umontreal iro lecuyer stochprocess public class GammaProcessBridge extends GammaProcess Constructors public GammaProcessBridge double s0 double mu double nu RandomStream stream Constructs a new GammaProcessBridge with parameters y mu y nu and initial value S to s0 Uses stream to generate the gamma and beta variates by inversion public GammaProcessBridge double s0 double mu double nu GammaGen Ggen BetaGen Bgen Constructs a new GammaProcessBridge Uses the random variate generators Ggen and Bgen to generate the gamma and beta variates respectively Note that both generator uses the same RandomStream Furthermore the parameters of the GammaGen and BetaGen objects are not important since the implementation forces the generators to use the correct parameters as defined in page 7 Methods public void setStream RandomStream stream Resets the RandomStream of the GammaGen and the BetaGen to stream 35 GammaProcessSymmetricalBridge This class differs from GammaProcessBridge only in that it requires the number of interval of the path to be a power of 2 and of equal size It is then possible to generate the bridge process using a special implementation of the beta random variate generator using the symmetrical beta distribution that is much faster HOW MUCH QUANTIFY than the general case Note that when the method setObservationTimes is called the equality of the size of the time steps is verified
20. e observation times on the VarianceGammaProcesDiff as usual but also sets the observation times of the underlying GammaProcess es public RandomStream getStream Returns the RandomStream of the T process public void setStream RandomStream stream Sets the RandomStream of the two GammaProcess es to stream 45 VarianceGammaProcessDiffPCA Same as VarianceGammaProcessDiff but the two inner GammaProcess es are of PCA type Also generatePath double uniforms01 distributes the uniform random variates to the GammaProcessPCA s according to their eigenvalues i e the GammaProcessPCA with the higher eigenvalue gets the next uniform random number If one should decide to create a VarianceGammaProcessDiffPCA by giving two GammaProcessPCA s to an objet of the class VarianceGammaProcessDiff the uniform random numbers would not be given this way to the GammaProcessPCA s this might give less variance reduction when used with QMC package umontreal iro lecuyer stochprocess public class VarianceGammaProcessDiffPCA extends VarianceGammaProcessDiff Constructors public VarianceGammaProcessDiffPCA double s0 double theta double sigma double nu RandomStream stream Constructs a new VarianceGammaProcessDiffPCA with parameters 6 theta o sigma v nu and initial value S tp sO There is only one RandomStream here which is used for the two inner GammaProcessPCA s The other parameters are set as in VarianceGammaProcess
21. e of b public double getSigma Returns the value of public NormalGen getGen Returns the normal random variate generator used The RandomStream used for that gen erator can be changed via getGen setStream stream for example 27 OrnsteinUhlenbeckProcessEuler This class represents an Ornstein Uhlenbeck process as in OrnsteinUhlenbeckProcess but the process is generated using the simple Euler scheme X tj X tj 1 a b X tj 1 tj t1 0 yt tj Zj 11 where Z N 0 1 This is a good approximation only for small time intervals t tj 1 package umontreal iro lecuyer stochprocess public class OrnsteinUhlenbeckProcessEuler extends OrnsteinUhlenbeckProcess Constructors public OrnsteinUhlenbeckProcessEuler double x0 double alpha double b double sigma RandomStream stream Constructor with parameters a alpha b 0 sigma and initial value X to x0 The normal variates Z will be generated by inversion using the stream stream public OrnsteinUhlenbeckProcessEuler double x0 double alpha double b double sigma NormalGen gen Here the normal variate generator is specified directly instead of specifying the stream The normal generator gen can use another method than inversion 28 CIRProcess This class represents a CIR Cox Ingersoll Ross process 5 X t t gt 0 sampled at times 0 to lt t lt lt tg This process obeys the stochastic differential
22. eam of the T process Methods public double generatePath Generates returns and saves the path To do so the path of T is first generated and then the path of This is not the optimal way of proceeding in order to reduce the variance in QMC simulations for that use generatePath double uniform01 instead VarianceGammaProcessDiff 44 public double generatePath double uniform01 Similar to the usual generatePath but here the uniform random numbers used for the simulation must be provided to the method This allows to properly use the uniform random variates in QMC simulations This method divides the table of uniform random numbers uniform01 in two smaller tables the first one containing the odd indices of uniform01 are used to generate the path of and the even indices are used to generate the path of I This way of proceeding further reduces the variance for QMC simulations public void resetStartProcess Sets the observation times on the VarianceGammaProcessDiff as usual but also applies the resetStartProcess method to the two GammaProcess objects used to generate this process public GammaProcess getGpos Returns a reference to the GammaProcess object gpos used to generate the component of the process public GammaProcess getGneg Returns a reference to the GammaProcess object gneg used to generate the component of the process public void setObservationTimes double t int d Sets th
23. equation dX t a b X t dt oy X t dB t 12 with initial condition X 0 zo where a b and are positive constants and B t t gt 0 is a standard Brownian motion with drift 0 and volatility 1 This process is mean reverting in the sense that it always tends to drift toward its general mean b The process is generated using the sequential technique 7 p 122 gay PAZE y daeet ty 1 13 a 4a q 1 eee i 13 where v 4ba o and y A is a noncentral chi square random variable with v degrees of freedom and noncentrality parameter A package umontreal iro lecuyer stochprocess public class CIRProcess extends StochasticProcess Constructors public CIRProcess double x0 double alpha double b double sigma RandomStream stream Constructs a new CIRProcess with parameters a alpha b 0 sigma and initial value X tg x0 The noncentral chi square variates y A will be generated by inversion using the stream stream public CIRProcess double x0 double alpha double b double sigma ChiSquareNoncentralGen gen The noncentral chi square variate generator gen is specified directly instead of specifying the stream gen can use a method other than inversion Methods public double nextObservation double nextTime Generates and returns the next observation at time tj nextTime using the previous observation time t defined earlier either by this method or by setObservationTimes as
24. es are of the PCASymmetricalBridge type Also generatePath double uniform01 distributes the lowest coordinates uniforms to the inner GammaProcessPCA according to their eigenvalues package umontreal iro lecuyer stochprocess public class VarianceGammaProcessDiffPCASymmetricalBridge extends VarianceGammaProcessDiffPCA Constructors public VarianceGammaProcessDiffPCASymmetricalBridge double s0 double theta double sigma double nu RandomStream stream Constructs a new VarianceGammaProcessDiffPCASymmetricalBridge with parameters 0 theta o sigma y nu and initial value S tp s0 There is only one RandomStream here which is used for the two inner GammaProcessPCASymmetricalBridge s The other parameters are set as in VarianceGammaProcessDiff 48 Geometric VarianceGammaProcess This class represents a geometric variance gamma process S t see 12 page 86 This stochastic process is defined by the equation S t S O exp yt X t 0 v 0 wt 19 where X is a variance gamma process and w 1 v In 1 0v 07 2 20 package umontreal iro lecuyer stochprocess public class GeometricVarianceGammaProcess extends StochasticProcess Constructors public GeometricVarianceGammaProcess double s0 double theta double sigma double nu double mu RandomStream stream Constructs a new GeometricVarianceGammaProcess with parameters 0 theta o sigma v nu y mu and initial value S ty s0 The stre
25. f the inner GammaProcess is called its path is then used to set the observation times of the BrownianMotion Finally the method generatePath of the BrownianMotion is called Warning If one wants to reduced the variance as much as possible in a QMC sim ulation this way of proceeding is not optimal Use the method generatePath uniform01 instead If one calls the nextObservation method the operational time is generated first followed by the corresponding brownian motion increment which is then returned Note that if one wishes to use bridge sampling with the nextObservation method both the gamma process G and the Brownian motion process B should use bridge sampling so that their observations are synchronized package umontreal iro lecuyer stochprocess public class VarianceGammaProcess extends StochasticProcess Constructors public VarianceGammaProcess double s0 double theta double sigma double nu RandomStream stream Constructs a new VarianceGammaProcess with parameters 0 theta o sigma v nu and initial value S tp s0 stream is used to generate both the BrownianMotion B and the GammaProcess G in 16 public VarianceGammaProcess double s0 BrownianMotion BM GammaProcess Gamma Constructs a new VarianceGammaProcess The parameters 0 and are set to the param eters u and g respectively of the BrownianMotion BM and the parameter v is set to the parameter y of the GammaProcess Gamma The parameters u and x0 of
26. ian option pricing for NIG L vy processes Journal of computational and applied mathematics 172 153 168 2004 2 T Avramidis and P L Ecuyer Efficient Monte Carlo and quasi Monte Carlo option pricing under the variance gamma model Management Science 52 12 1930 1944 2006 3 T Avramidis P L Ecuyer and P A Tremblay Efficient simulation of gamma and variance gamma processes In Proceedings of the 2003 Winter Simulation Conference pages 319 326 Piscataway New Jersey 2003 IEEE Press 4 O E Barndorff Nielsen Processes of normal inverse gaussian type Finance and Stochastics 2 41 68 1998 5 J C Cox J E Ingersoll and S A Ross A theory of the term structure of interest rates Econometrica 53 385 407 1985 6 W Feller An Introduction to Probability Theory and Its Applications Vol 2 Wiley New York NY first edition 1966 7 P Glasserman Monte Carlo Methods in Financial Engineering Springer Verlag New York 2004 8 J Imai and K S Tan A general dimension reduction technique for derivative pricing Journal of Computational Finance 10 2 129 155 2006 9 P L Ecuyer Quasi Monte Carlo methods in finance In R G Ingalls M D Ros setti J S Smith and B A Peters editors Proceedings of the 2004 Winter Simulation Conference Piscataway New Jersey 2004 IEEE Press 10 P L Ecuyer J S Parent Chartier and M Dion Simulation of a L vy process by PCA sampling to reduce the effective dimentio
27. in CIRProcess but the process is generated using the simple Euler scheme X 6 X tj 1 a b X tj 1 ty tj 1 oy t tj 1 X tj 1 Zj 14 where Z N 0 1 This is a good approximation only for small time intervals t tj 1 package umontreal iro lecuyer stochprocess public class CIRProcessEuler extends StochasticProcess Constructors public CIRProcessEuler double x0 double alpha double b double sigma RandomStream stream Constructs a new CIRProcessEuler with parameters alpha b o sigma and initial value X to x0 The normal variates Z will be generated by inversion using the stream stream public CIRProcessEuler double x0 double alpha double b double sigma NormalGen gen The normal variate generator gen is specified directly instead of specifying the stream gen can use another method than inversion Methods public double nextObservation double nextTime Generates and returns the next observation at time t 1 nextTime using the previous observation time tj defined earlier either by this method or by setObservationTimes as well as the value of the previous observation X t Warning This method will reset the observations time tj 1 for this process to nextTime The user must make sure that the tj 1 supplied is gt tj public double nextObservation double x double dt Generates an observation of the process in dt time units assuming that the process has value x
28. independent increments over disjoint time intervals it is a L vy process and the increment over an interval of length t is normally distributed with mean ut and variance E In this class this process is generated using the sequential or random walk technique X 0 zo and X ti Xt 4 plt ty 1 0 yt GZ 2 where Z N 0 1 package umontreal iro lecuyer stochprocess public class BrownianMotion extends StochasticProcess Constructors public BrownianMotion double x0 double mu double sigma RandomStream stream Constructs a new BrownianMotion with parameters y mu dc sigma and initial value X to x0 The normal variates Z in will be generated by inversion using stream public BrownianMotion double x0 double mu double sigma NormalGen gen Constructs a new BrownianMotion with parameters y mu o sigma and initial value X to x0 Here the normal variate generator NormalGen is specified directly instead of specifying the stream and using inversion The normal generator gen can use another method than inversion Methods public double nextObservation double nextTime Generates and returns the next observation at time t nextTime It uses the previous observation time tj defined earlier either by this method or by setObservationTimes as well as the value of the previous observation X t Warning This method will reset the observations time tj 1 for this process to nextTime The use
29. lue in that non sequential order This class uses two RandomStream s to generate a path 17 package umontreal iro lecuyer stochprocess public class InverseGaussianProcessBridge extends InverseGaussianProcessMSH Constructors public InverseGaussianProcessBridge double s0 double delta double gamma RandomStream stream RandomStream otherStream Constructs a new InverseGaussianProcessBridge The initial value sO will be overridden by t 0 when the observation times are set Methods public double generatePath Generates the path The two inner RandomStream s are sampled alternatively public double generatePath double unifNorm double unifOther Instead of using the internal streams to generate the path it uses two arrays of uniforms U 0 1 The length of the arrays unifNorm and unifOther should be equal to the number of time steps excluding to public double nextObservation Returns the next observation in the bridge order not the sequential order public RandomStream getStream Only returns a stream if both inner streams are the same public void setStream RandomStream stream RandomStream otherStream Sets the streams public void setStream RandomStream stream Sets both inner streams to the same stream 17 InverseGaussianProcessMSH Uses a faster generating method MSH 15 than the simple inversion of the distribution function used by InverseGaussianProcess It is about 60 times fa
30. method is not implemented in this class since the path cannot be generated sequentially public BrownianMotionPCA getBMPCA Returns the BrownianMotionPCA that is included in the GammaProcessPCA object GammaProcessPCA 37 public void setObservationTimes double t int d Sets the observation times of the GammaProcessPCA and the BrownianMotionPCA public void setParams double s0 double mu double nu Sets the parameters s0 u and y to new values and sets the variance parameters of the BrownianMotionPCA to v public void setStream RandomStream stream Resets the RandomStream of the gamma generator and the RandomStream of the inner BrownianMotionPCA to stream 38 GammaProcessPCA Bridge Same as GammaProcessPCA but the generated uniforms correspond to a bridge transfor mation of the BrownianMotionPCA instead of a sequential transformation package umontreal iro lecuyer stochprocess public class GammaProcessPCABridge extends GammaProcessPCA Constructors public GammaProcessPCABridge double s0 double mu double nu RandomStream stream Constructs a new GammaProcessPCABridge with parameters u mu y nu and initial value S to s0 The same stream is used to generate the gamma and beta random numbers All these numbers are generated by inversion in the following order the first uniform random number generated is used for the gamma and the other d 1 for the beta s Methods public BrownianMotionPCA getBMP
31. n In Proceedings of the 2008 Winter Simulation Conference pages 436 443 Piscataway NJ 2008 IEEE Press 11 P L Ecuyer and R Simard Inverting the symmetrical beta distribution ACM Trans actions on Mathematical Software 32 4 509 520 2006 12 D B Madan P P Carr and E C Chang The variance gamma process and option pricing European Finance Review 2 79 105 1998 13 D B Madan and F Milne Option pricing with V G martingale components Mathe matical Finance 1 39 55 1991 14 D B Madan and E Seneta The variance gamma V G model for share market returns Journal of Business 63 511 524 1990 15 16 17 REFERENCES 51 J R Michael W R Schuchany and R W Haas Generating random variates using transformations with multiple roots The American Statistician 30 88 90 1976 C Ribeiro and N Webber Valuing path dependent options in the variance gamma model by Monte Carlo with a gamma bridge manuscript December 2002 N Webber and C Ribeiro A Monte Carlo method for the normal inverse gaussian option valuation model using an inverse gaussian bridge Technical Report 5 Society for Computational Economics 2003
32. n the observation times are set Methods public double generatePath double uniforms01 Instead of using the internal stream to generate the path uses an array of uniforms U 0 1 The length of the array should be equal to the length of the number of periods in the observation times This method is useful for NormalInverseGaussianProcess public double nextObservation Not implementable for PCA public void setObservationTimes double t int d Sets the observation times of both the InverseGaussianProcessPCA and the inner BrownianMotionPCA public void setBrownianMotionPCA BrownianMotionPCA bmPCA Sets the brownian motion PCA The observation times will be overriden when the method observationTimes is called on the InverseGaussianProcessPCA public BrownianMotion getBrownianMotionPCA Returns the BrownianMotionPCA 20 NormallnverseGaussianProcess This class represents a normal inverse gaussian process NIG It obeys the stochastic differential equation 4 dX t pdt dB h t 6 where B t t gt 0 is a BrownianMotion with drift and variance 1 and A t is an InverseGaussianProcess G v y v7 with v ddt and y ya B In this class the process is generated using the sequential technique X 0 zo and where Z N 0 1 and Y IG v y v with v 6 t t _1 There is one RandomStream used to generate the Z s and there are one or two streams used to generate the underlying InverseGaus
33. ndomStream getStream Returns the stream from the underlying L vy process If the underlying L vy process has multiple streams it returns what the getStream method of that process was made to return public void setStream RandomStream stream Resets the stream in the underlying L vy process If the underlying L vy process has multiple streams it sets the streams on this process in the same way as setStream for that process 14 InverseGaussianProcess The inverse Gaussian process is a non decreasing process where the increments are ad ditive and are given by the inverse gaussian distribution InverseGaussianDist With parameters 6 and y the time increments are given by InverseGaussianDist ddt 7 9 dt We here use the inverse gaussian distribution parametrized with IGDist p A where u 6 y and A 6 If we instead used the parametrization IGDist 6 y then the increment distribution of our process would have been written more simply as IGDist ddt y The increments are generated by using the inversion of the cumulative distribution func tion It therefore uses only one RandomStream Subclasses of this class use different gener ating methods and some need two RandomStream s The initial value of this process is the initial observation time package umontreal iro lecuyer stochprocess public class InverseGaussianProcess extends StochasticProcess Constructors public InverseGaussianProcess double s0
34. nvalues Returns the sorted eigenvalues obtained in the PCA decomposition 10 GeometricBrownianMotion Represents a geometric Brownian motion GBM process S t t gt 0 which evolves according to the stochastic differential equation dS t 1S t dt oS t dB t 3 where u and are the drift and volatility parameters and B t t gt 0 is a standard Brownian motion for which B t N 0 t This process can also be written as the exponential of a Brownian motion S t S 0 exp u 0 2 t ot B t S 0 exp X 4 where X t u 0 2 t ot B t The GBM process is simulated by simulating the BM process X and taking the exponential This BM process is stored internally package umontreal iro lecuyer stochprocess public class GeometricBrownianMotion extends StochasticProcess Constructors public GeometricBrownianMotion double s0 double mu double sigma RandomStream stream Same as GeometricBrownianMotion s0 mu sigma new BrownianMotion 0 0 0 0 1 0 stream public GeometricBrownianMotion double s0 double mu double sigma BrownianMotion bm Constructs a new GeometricBrownianMotion with parameters y mu o sigma and S to sO using bm as the underlying BrownianMotion The parameters of bm are auto matically reset to 0 2 and o regardless of the original parameters of bm The observation times are the same as those of bm The generation method depends on that of bm se
35. of the last generated observation X t public double getX0 Returns the initial value X to for this process public void setX0 double s0 Sets the initial value X to for this process to sO and reinitializes StochasticProcess 5 public abstract void setStream RandomStream stream Resets the random stream of the underlying generator to stream public abstract RandomStream getStream Returns the random stream of the underlying generator public int getArrayMappingCounterToIndex Returns a reference to an array that maps an integer k to iz the index of the observation S t corresponding to the k th observation to be generated for a sample path of this process If this process is sampled sequentially then this map is trivial i e ip k But it can be useful in a more general setting where the process is not sampled sequentially for example by a Brownian or gamma bridge and one wants to know which observations of the current sample path were previously generated or will be generated next BrownianMotion This class represents a Brownian motion process X t t gt 0 sampled at times 0 to lt t lt lt ta This process obeys the stochastic differential equation dX t udt 0dB t 1 with initial condition X 0 zo where u and o are the drift and volatility parameters and B t t gt 0 is a standard Brownian motion with drift 0 and volatility 1 This process has stationary and
36. pecified directly instead of specifying the stream The normal generator gen can use another method than inversion Methods public double nextObservation double nextTime Generates and returns the next observation at time t 1 nextTime using the previous observation time tj defined earlier either by this method or by setObservationTimes as well as the value of the previous observation X t Warning This method will reset the observations time tj 1 for this process to nextTime The user must make sure that the tj 1 supplied is gt tj public double nextObservation double x double dt Generates an observation of the process in dt time units assuming that the process has value x at the current time Uses the process parameters specified in the constructor Note that this method does not affect the sample path of the process stored internally if any OrnsteinUhlenbeckProcess 26 public void setParams double x0 double alpha double b double sigma Resets the parameters X to x0 a alpha b b and sigma of the process Warning This method will recompute some quantities stored internally which may be slow if called too frequently public void setStream RandomStream stream Resets the random stream of the normal generator to stream public RandomStream getStream Returns the random stream of the normal generator public double getAlpha Returns the value of a public double getB Returns the valu
37. process public class BrownianMotionBridge extends BrownianMotion Constructors public BrownianMotionBridge double x0 double mu double sigma RandomStream stream Constructs a new BrownianMotionBridge with parameters y mu o sigma and ini tial value X ty x0 The normal variates will be generated by inversion using the RandomStream stream public BrownianMotionBridge double x0 double mu double sigma NormalGen gen Constructs a new BrownianMotionBridge with parameters u mu o sigma and initial value X to x0 The normal variates will be generated by the NormalGen gen 1 From Pierre We should probably remove the nextObservation methods from here BrownianMotionPCA A Brownian motion process X t t gt 0 sampled using the principal component decomposition PCA 7 8 9 package umontreal iro lecuyer stochprocess public class BrownianMotionPCA extends BrownianMotion Constructors public BrownianMotionPCA double x0 double mu double sigma RandomStream stream Constructs a new BrownianMotionBridge with parameters u mu o sigma and initial value X to x0 The normal variates will be generated by inversion using stream public BrownianMotionPCA double x0 double mu double sigma NormalGen gen Constructs a new BrownianMotionBridge with parameters u mu o sigma and initial value X to x0 The normal variates will be generated by gen Methods public double getSortedEige
38. quential bridge sampling PCA etc Methods public void resetStartProcess Same as in StochasticProcess but also invokes resetStartProcess for the underlying BrownianMotion object public void setParams double s0 double mu double sigma Sets the parameters S ty s0 y mu and o sigma of the process Warning This method will recompute some quantities stored internally which may be slow if called re peatedly GeometricBrownianMotion 11 public void setStream RandomStream stream Resets the RandomStream for the underlying Brownian motion to stream public RandomStream getStream Returns the RandomStream for the underlying Brownian motion public double getMu Returns the value of y public double getSigma Returns the value of public NormalGen getGen Returns the NormalGen used public BrownianMotion getBrownianMotion Returns a reference to the BrownianMotion object used to generate the process 12 GeometricLevyProcess Abstract class used as a parent class for the exponentiation of a L vy process X t S t S 0 exp X t r wrn t 5 The interest is here denoted r and is refered to as muGeom in the class below The risk neutral correction is given by wry and takes into account risk aversion in the pricing of assets its value depends on the specific L vy process that is used GeometricNormalInverseGaussianProcess is implemented as a child of this class and so could
39. r example 7 This technique generates first the value X t at the last observation time then the value at time y2 or the nearest integer then the values at time taja and at time t3q 4 or the nearest integers and so on If the process has already been sampled at times t lt tg but not in between the next sampling point in that interval will be t where j i k 2 For example if the sampling times used are to t1 t2 t3 ta ts then the observations are generated in the following order X ts X t2 X ti X ts X ta Warning Both the generatePath and the nextObservation methods from Brownian Motion are modified to use the bridge method In the case of nextObservation the user should understand that the observations returned are not ordered chronologically However they will be once an entire path is generated and the observations are read from the internal array referenced by the getPath method that contains them The method nextObservation double nextTime differs from that of the class Brown ianMotion in that nextTime represents the next observation time of the Brownian bridge However the t supplied must still be non decreasing with 7 Note also that if the path is not entirely generated before being read from this array there will be pollution from the previous path generated and the observations will not represent a sample path of this process package umontreal iro lecuyer stoch
40. r must make sure that the tj 1 supplied is gt tj BrownianMotion 7 public double nextObservation double x double dt Generates an observation of the process in dt time units assuming that the process has value x at the current time Uses the process parameters specified in the constructor Note that this method does not affect the sample path of the process stored internally if any public double generatePath double uniform01 Same as generatePath but a vector of uniform random numbers must be provided to the method These uniform random numbers are used to generate the path public void setParams double x0 double mu double sigma Resets the parameters X to x0 u mu and o sigma of the process Warning This method will recompute some quantities stored internally which may be slow if called too frequently public void setStream RandomStream stream Resets the random stream of the normal generator to stream public RandomStream getStream Returns the random stream of the normal generator public double getMu Returns the value of yu public double getSigma Returns the value of public NormalGen getGen Returns the normal random variate generator used The RandomStream used by that gener ator can be changed via getGen setStream stream for example BrownianMotionBridge Represents a Brownian motion process X t t gt 0 sampled using the bridge sampling technique see fo
41. rocess The parameters of the NIG process will be overwritten by the parameters given to the GNIG with the initial value of the NIG set to 0 The observation times of the NIG will also be changed to those of the GNIG public GeometricNormalInverseGaussianProcess double s0 double muGeom double alpha double beta double mu double delta RandomStream streamBrownian InverseGaussianProcess igP Constructs a new GeometricNormalInverseGaussianProcess The process igP will be used internally by the underlying NormalInverseGaussianProcess public GeometricNormalInverseGaussianProcess double s0 double muGeom double alpha double beta double mu double delta RandomStream streamBrownian RandomStream streamNIG1 RandomStream streamNIG2 String igType Constructs a new GeometricNormalInverseGaussianProcess The drift of the geometric term muGeon is usually the interest rate r sO is the initial value of the process and the other GeometricNormallInverseGaussianProcess 24 four parameters are the parameters of the underlying Normal InverseGaussianProcess pro cess public GeometricNormalInverseGaussianProcess double s0 double muGeom double alpha double beta double mu double delta RandomStream streamAll String igType Constructs a new GeometricNormalInverseGaussianProcess The String igType cor responds to the type of InverseGaussianProcess that will be used by the underlying NormalInverseGaussianProcess All Random
42. sianProcess depending on which IG subclass is used In finance a NIG process usually means that the log return is given by a NIG process GeometricNormalInverseGaussianProcess should be used in that case package umontreal iro lecuyer stochprocess public class NormalInverseGaussianProcess extends StochasticProcess Constructors public NormalInverseGaussianProcess double x0 double alpha double beta double mu double delta RandomStream streamBrownian InverseGaussianProcess igP Given an InverseGaussianProcess igP constructs a new NormalInverseGaussianProcess The parameters and observation times of the IG process will be overriden by the parameters of the NIG process If there are two RandomStream s in the InverseGaussianProcess this constructor assumes that both streams have been set to the same stream public NormalInverseGaussianProcess double x0 double alpha double beta double mu double delta RandomStream streamBrownian RandomStream streamIGi RandomStream streamIG2 String igType Constructs a new NormalInverseGaussianProcess The string argument corresponds to the type of underlying InverseGaussianProcess The choices are SEQUENTIAL_SLOW SEQUENTIAL_MSH BRIDGE and PCA which correspond respectively to Inverse GaussianProcess InverseGaussianProcessMSH InverseGaussianProcessBridge and Inverse GaussianProcessPCA The third RandomStream streamIG2 will not be used at all if the SEQUENTIAL_SLOW or PCA me
43. ster However it requires two RandomStream s instead of only one for InverseGaussianProcess The second stream is called otherStream below and it is used to randomly choose between two roots at each time step package umontreal iro lecuyer stochprocess public class InverseGaussianProcessMSH extends InverseGaussianProcess Constructors public InverseGaussianProcessMSH double s0 double delta double gamma RandomStream stream RandomStream otherStream Constructs a new InverseGaussianProcessMSH The initial value sO will be overridden by t 0 when the observation times are set Methods public double generatePath Generates the path It is done by successively calling nextObservation therefore the two RandomStreams are sampled alternatively public double generatePath double unifNorm double unifOther Instead of using the internal streams to generate the path uses two arrays of uniforms U 0 1 The length of the arrays should be equal to the number of periods in the observation times This method is useful for NormalInverseGaussianProcess public double generatePath double uniforms01 Not implemented requires two RandomStream s public RandomStream getStream Only returns a stream if both inner RandomStream s are the same public void setStream RandomStream stream RandomStream otherStream Sets the streams public void setStream RandomStream stream Sets both inner streams to stre
44. tStartProcess Resets the observation index and counter to 0 and applies the resetStartProcess method to the BrownianMotion and the GammaProcess objects used to generate this process public void setParams double s0 double theta double sigma double nu Sets the parameters S to s0 0 theta o sigma and v nu of the process Warning This method will recompute some quantities stored internally which may be slow if called repeatedly public double getTheta Returns the value of the parameter 0 public double getSigma Returns the value of the parameter public double getNu Returns the value of the parameter v public void setObservationTimes double t int d Sets the observation times on the VarianceGammaProcess as usual but also sets the obser vation times of the underlying GammaProcess It furthermore sets the starting value of the GammaProcess to t 0 VarianceGammaProcess 42 public void setStream RandomStream stream Resets the RandomStream s Warning this method sets both the RandomStream of the BrownianMotion and of the GammaProcess to the same RandomStrean public RandomStream getStream Returns the random stream of the BrownianMotion process which should be the same as for the GammaProcess public BrownianMotion getBrownianMotion Returns a reference to the inner BrownianMotion public GammaProcess getGammaProcess Returns a reference to the inner GammaProcess 43 WarianceG
45. the GammaProcess are overwritten to equal 1 and 0 respectively The initial value of the process is S tp s0 VarianceGammaProcess 41 Methods public double nextObservation Generates the observation for the next time It also works with bridge sampling however both BrownianMotionBridge and GammaProcessBridge must be used in the constructor in that case Furthermore for bridge sampling the order of the observations is that of the bridge not sequential order public double generatePath Generates and returns the path To do so it first generates the complete path of the inner GammaProcess and sets the observation times of the inner BrownianMotion to this path This method is not optimal to reduce the variance in QMC simulations use generatePath double uniform01 for that public double generatePath double uniform01 Similar to the usual generatePath but here the uniform random numbers used for the simulation must be provided to the method This allows to properly use the uniform random variates in QMC simulations This method divides the table of uniform random numbers uniform01 in two smaller tables the first one containing the odd indices of uniform01 which are used to generate the path of the inner GammaProcess and the even indices in the second table are used to generate the path of the inner BrownianMotion This way of proceeding reduces the variance as much as possible for QMC simulations public void rese
46. thods are chosen NormalInverseGaussianProcess 21 public NormalInverseGaussianProcess double x0 double alpha double beta double mu double delta RandomStream streamAll String igType Same as above but all RandomStream s are set to the same stream streamAl1 Methods public double generatePath Generates the path This method samples each stream alternatively which is useful for quasi Monte Carlo where all streams are in fact the same iterator on a PointSet public double nextObservation Returns the value of the process for the next time step If the underlying InverseGaussian Process is of type InverseGaussianProcessPCA this method cannot be used It will work with InverseGaussianProcessBridge but the return order of the observations is the bridge order public void setObservationTimes double t int d Sets the observation times on the NIG process as usual but also sets the observation times of the underlying InverseGaussianProcess It furthermore sets the starting value of the InverseGaussianProcess to t 0 public void setParams double x0 double alpha double beta double mu double delta Sets the parameters Also computes y y a 82 public double getAlpha Returns alpha public double getBeta Returns beta public double getMu Returns mu public double getDelta Returns delta public double getGamma Returns gamma public double getAnalyticAverage double time Ret
47. urns the analytic average which is ut 0t0 7 NormalInverseGaussianProcess 22 public double getAnalyticVariance double time Returns the analytic variance which is ta y public RandomStream getStream Only returns the stream if all streams are equal including the stream s in the underlying InverseGaussianProcess public void setStream RandomStream stream Sets all internal streams to stream including the stream s of the underlying Inverse GaussianProcess 23 GeometricNormallnverseGaussianProcess The geometric normal inverse gaussian GNIG process is the exponentiation of a Normal InverseGaussianProcess S t So exp r wan t NIG t a 8 y 6 8 where r is the interest rate It is a strictly positive process which is useful in finance There is also a neutral correction in the exponential wry u dy 6 a 1 6 which takes into account the market price of risk The underlying NIG process must start at zero NIG to 0 and the initial time should also be set to zero to 0 both for the NIG and GNIG package umontreal iro lecuyer stochprocess public class GeometricNormalInverseGaussianProcess extends GeometricLevyProcess Constructors public GeometricNormalInverseGaussianProcess double s0 double muGeom double alpha double beta double mu double delta RandomStream streamBrownian NormalInverseGaussianProcess nigP Constructs a new GeometricNormalInverseGaussianP

Download Pdf Manuals

image

Related Search

Related Contents

Tecumseh AKA9433EXAXC Performance Data Sheet  SRK - 松定プレシジョン  PQube Installation & User`s Manual  Contents  Samsung ST60 Наръчник за потребителя  Bedienungsanleitung Croozer Kid plus  here - Snap-on Equipment  

Copyright © All rights reserved.
Failed to retrieve file