3
$\begingroup$

I'm a full time undergraduate student from Peru, and I'm trying to use the Geometric Brownian Motion example used in the help section from Wolfram Mathematica in order to forecast future stock prices, as in the example. But it seems that there might be some kind of error, because when I take the mean function of the simulated future paths in order to find the predicted future values the resulting path is ridiculous due to the extremely low volatility it has.

The code I'm using is the same as the example provided by Mathematica:

Getting the data:

LUVdata = FinancialData["LUV", "Close", {{2015, 1, 1}, {2015, 4, 28}}];

Adjusting the data to a Time Series:

LUVseries = TimeSeries[LUVdata[[All, 2]], {LUVdata[[1, 1]]}];

Fitting a Geometric Brownian Motion Process to the values:

eprocess = EstimatedProcess[LUVseries["Values"],GeometricBrownianMotionProcess[\[Mu], \[Sigma], \[Alpha]]];

Simulate 4000 future paths for the next 17 days:

paths = RandomFunction[eprocess, {LUVseries["PathLength"], LUVseries["PathLength"] + 17, 1}, 4000];

td = TemporalData[paths["ValueList"], {LUVdata[[-1, 1]], Automatic, "Day"}, ValueDimensions -> 1];

Plot the simulations:

forecastPlot = DateListPlot[td, Joined -> True, PlotStyle -> Directive[Opacity[.4]]]

enter image description here

Now, calculate the mean function of the simulations to find predicted future values:

meanPath = TimeSeriesThread[Mean, td];

Plot the mean fuction of the simulations:

DateListPlot[meanPath]

enter image description here

As you see in the plot of the mean function, it says that the stock will only varies in a range of 0.05 cents in 17 days which is totally wrong taking into account that this stock varies more than 1 dollar in a normal trading day:

enter image description here

Please I will be very thankful to anyone who can tell me what is wrong with the code or with the estimation.

$\endgroup$
0
$\begingroup$

Maybe this is rather a comment then an answer but three points:

  • GBM is a stochastic model for stock prices. It is used to price derivatives in an arbitrage free setting. In this case you look at a process whose expected return is just the risk free rate (due to no-arbitrage). Forecast this price is trivial.
  • It is debatable how forecastable stock prices are. If you want to learn about forecasting in a statistical sense then you could look at Rob Hyndman's resources (papers, R packages, free online book).
  • one more point. You write: "As you see in the plot of the mean function, it says that the stock will only varies in a range of 0.05 cents in 17 days which is totally wrong taking into account that this stock varies more than 1 dollar in a normal trading". This is the dominance of variance over the mean that we often see in stock prices and for sure in stochastic models. During short time periods what you see in your (real or simulated) price path is mainly volatility (the sigma) while you "feel" the mu only for longer horizons. Just forecasting the price for the future with today's value will give you a forecast as precise as the mean that you apply - it is all noise on your timeframe.
$\endgroup$
1
$\begingroup$

There is probably nothing wrong with your code although I did not check it in Mathematica. Normally, Geometric Brownian motion is just a model. Here, you simulate lots of paths and then average over it. The first plot gives something like

$$ E(S_t) = S_0*\exp(\mu t) $$ with $S_0$ the initial stock price.

However, because of the simulation, you do not get an exponential (which increases only by a small amount over that time scale).

The second plot is the actual stock price. If you want to have something similar, just plot one trajectory of your simulation. One path of the geometric brownian motion has the same statistical properties as the stock price in the past had (if the actual process could be perfectly described by a geometric brownian motion!). And the jagged trajectory comes from the "random" Wiener process.

To summarize: The geometric brownian motion can be used as a model with similar parameters (which can change in practice) like the actual stock, but the actual price path will with certainty be different from your model.

PS If you want more realistic trajectories, you should sample with a smaller time difference and continue your studies including jumps etc.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.