Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Calculating mean of multiple stochastic process...' topicStudent Support Forum > General > "Calculating mean of multiple stochastic process..."

Help | Reply To Topic
Author Comment/Response
Milan
06/02/13 12:04pm

Thanks to “Rod Lm” I got some very nice input for the following Problem.

My intention is to simulate within a manipulative function a given number of possible stock price paths and to calculate their mean. So If something is manipulated the “new mean” is also calculated automatically and both shown by a line and numerically within the chart. I would also like to know how I can also calculate the mean outside the Chart, I tried the following but it didn't work:

Mean[Table[
RandomFunction[
GeometricBrownianMotionProcess[0.1, 0.2, 100], {0, 250, 0.05}][
"Path"], {20}][[All, -1]]]

The next step if possible is to introduce a lower boundary. So e.g. if the initial Stock Price is 100 then the boundary could be at let’ s say 70. First, I want the boundary to be shown by a line. Second, I would like to stop all stochastic processes that fall below this threshold and then receiving the mean from all remaining processes.

Alternatively, if it’s not possible to stop the processes that fall below the threshold, I also just want the mean of the remaining processes that are beyond the threshold. Third, I also would like to have a manipulable threshold. So In short, I want to be able to switch the threshold between 20 and 90 and then receive the mean of the processes that remain beyond this boundary.

Is something possible? If yes, I would be really thankful if I would receive some suggestions how to solve my problem, or at least parts of it. So far I have done the following and is it even possible to modify this code in such a manner that my problem can be solved?

My code so far:

Manipulate[SeedRandom[seed];
ListLogPlot[
Table[RandomFunction[
GeometricBrownianMotionProcess[μ,σ,S_0], {0, 250, 0.05}]["Path"], {P}], Joined -> True,
AxesLabel -> {"Time", "S_t"},
PlotLabel ->
Style["Forecasted Stock Price\n (Brownian Motion)", Bold],
PlotRange -> All, ImageSize -> 500,
PlotStyle -> Directive[{Thin, Lighter@Gray}]], {{S_0,
100, "Initial Stock Value"}, 100, 500, 0.05,
Appearance -> "Labeled"}, {{μ, 0.01, "Drift μ"}, 0.01, 1,
0.05, Appearance -> "Labeled"}, {{σ, 0.01,
"Standard Deviation σ"}, 0.01, 1, 0.05,
Appearance -> "Labeled"}, {{P, 1, "Paths"}, 1, 100, 1,
Appearance -> "Labeled"}, {{seed, 77777, "New Random Case"}, 10000,
999999, 1},
Button["Set Initial Values", {S_0 = 25, μ =
0.01, σ = 0.01}, ImageSize -> 150],
ControlPlacement -> Left]


URL: ,
Help | Reply To Topic