umontreal.iro.lecuyer.stochprocess
Class GeometricBrownianMotion
- java.lang.Object
-
- umontreal.iro.lecuyer.stochprocess.StochasticProcess
-
- umontreal.iro.lecuyer.stochprocess.GeometricBrownianMotion
-
public class GeometricBrownianMotion extends StochasticProcess
. Represents a geometric Brownian motion (GBM) process {S(t), t >= 0}, which evolves according to the stochastic differential equation where μ and σ are the drift and volatility parameters, and {B(t), t >= 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: where X(t) = (μ - σ2/2)t + σtB(t). The GBM process is simulated by simulating the BM process X and taking the exponential. This BM process is stored internally.
-
-
Constructor Summary
Constructors Constructor and Description GeometricBrownianMotion(double s0, double mu, double sigma, BrownianMotion bm)Constructs a new GeometricBrownianMotion with parameters μ =mu , σ =sigma , and S(t0) =s0 , using bm as the underlyingBrownianMotion.GeometricBrownianMotion(double s0, double mu, double sigma, RandomStream stream)Same as GeometricBrownianMotion (s0, mu, sigma, new BrownianMotion (0.0, 0.0, 1.0, stream)).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description double[]generatePath()Generates, returns, and saves the sample path {X(t0), X(t1),…, X(td)}.double[]generatePath(RandomStream stream)Same as generatePath(), but first resets the stream to stream.BrownianMotiongetBrownianMotion()Returns a reference to theBrownianMotionobject used to generate the process.NormalGengetGen()Returns theNormalGenused.doublegetMu()Returns the value of μ.doublegetSigma()Returns the value of σ.RandomStreamgetStream()Returns theRandomStreamfor the underlying Brownian motion.doublenextObservation()Generates and returns the next observation X(tj) of the stochastic process.voidresetStartProcess()Same as in StochasticProcess, but also invokes resetStartProcess for the underlying BrownianMotion object.voidsetObservationTimes(double[] t, int d)Sets the observation times of the process to a copy of T, with t0 = T[0] and td = T[d].voidsetParams(double s0, double mu, double sigma)Sets the parameters S(t0) =s0 , μ =mu and σ =sigma of the process.voidsetStream(RandomStream stream)Resets theRandomStreamfor the underlying Brownian motion to stream.-
Methods inherited from class umontreal.iro.lecuyer.stochprocess.StochasticProcess
getArrayMappingCounterToIndex, getCurrentObservation, getCurrentObservationIndex, getNbObservationTimes, getObservation, getObservationTimes, getPath, getSubpath, getX0, hasNextObservation, setObservationTimes, setX0
-
-
-
-
Constructor Detail
-
GeometricBrownianMotion
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)).
-
GeometricBrownianMotion
public GeometricBrownianMotion(double s0, double mu, double sigma, BrownianMotion bm)Constructs a new GeometricBrownianMotion with parameters μ =mu , σ =sigma , and S(t0) =s0 , using bm as the underlyingBrownianMotion. The parameters of bm are automatically reset to μ - σ2/2 and σ, 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 (sequential, bridge sampling, PCA, etc.).
-
-
Method Detail
-
setObservationTimes
public void setObservationTimes(double[] t, int d)Description copied from class:StochasticProcessSets the observation times of the process to a copy of T, with t0 = T[0] and td = T[d]. The size of T must be d + 1.- Overrides:
setObservationTimesin classStochasticProcess
-
nextObservation
public double nextObservation()
Description copied from class:StochasticProcessGenerates and returns the next observation X(tj) of the stochastic process. The processes are usually sampled sequentially, i.e. if the last observation generated was for time tj-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 tj's is then specified by the subclass. All the processes generated using principal components analysis (PCA) do not have this method.- Overrides:
nextObservationin classStochasticProcess
-
generatePath
public double[] generatePath()
Description copied from class:StochasticProcessGenerates, returns, and saves the sample path {X(t0), X(t1),…, X(td)}. It can then be accessed via getPath, getSubpath, or getObservation. The generation method depends on the process type.- Specified by:
generatePathin classStochasticProcess
-
generatePath
public double[] generatePath(RandomStream stream)
Description copied from class:StochasticProcessSame as generatePath(), but first resets the stream to stream.- Overrides:
generatePathin classStochasticProcess
-
resetStartProcess
public void resetStartProcess()
Same as in StochasticProcess, but also invokes resetStartProcess for the underlying BrownianMotion object.- Overrides:
resetStartProcessin classStochasticProcess
-
setParams
public void setParams(double s0, double mu, double sigma)Sets the parameters S(t0) =s0 , μ =mu and σ =sigma of the process. Warning: This method will recompute some quantities stored internally, which may be slow if called repeatedly.
-
setStream
public void setStream(RandomStream stream)
Resets theRandomStreamfor the underlying Brownian motion to stream.- Specified by:
setStreamin classStochasticProcess
-
getStream
public RandomStream getStream()
Returns theRandomStreamfor the underlying Brownian motion.- Specified by:
getStreamin classStochasticProcess
-
getMu
public double getMu()
Returns the value of μ.
-
getSigma
public double getSigma()
Returns the value of σ.
-
getBrownianMotion
public BrownianMotion getBrownianMotion()
Returns a reference to theBrownianMotionobject used to generate the process.
-
-
DMelt 3.0 © DataMelt by jWork.ORG