Skip to main content
deleted 38 characters in body
Source Link

I have the following problem: I have a watermark in this model where not only the mean of all stochastic processes is calculated, but also the mean of those processes, which remain beyond a given threshold/ watermark. Now, I want to introduce a second watermark which is lower than the first one. And I also want to calculate and display the mean of the stochastic processes which are beyond the second watermark. My

My code so far is:

Manipulate[SeedRandom[seed]; meanvector := Mean[assets]; 
 assets = Table[
   RandomFunction[
     GeometricBrownianMotionProcess[\[Mu]GeometricBrownianMotionProcess[μ, \[Sigma]σ, S0], {0, time, 
      0.1}]["Path"], {P}]; 
 processes = Transpose[assets[[#]]][[2]] & /@ Range@Length[assets];
 processes2 = Transpose[assets[[#]]][[2]] & /@ Range@Length[assets]; 
 processesposition = 
  Flatten[Position[
    Min[processes[[#]]] & /@ 
     Range@Length[assets], _?(# > watermark &)]];
 processesposition2 = 
  Flatten[Position[
    Min[processes2[[#]]] & /@ 
     Range@Length[assets], _?(# > watermark2 &)]];
watermarkedassets = assets[[#]] & /@ processesposition; 
 watermarkedmeanvector = Mean[watermarkedassets];
 watermarkedassets2 = assets[[#]] & /@ processesposition2; 
 watermarkedmeanvector2 = Mean[watermarkedassets2];
 
 G1 := ListLogPlot[assets, GridLines -> {{}, {watermark}}, 
    GridLinesStyle -> {Directive[Green, Thick]}, Joined -> True, 
    AxesLabel -> {"Time", "St"}, 
    PlotLabel -> 
     Style["Forecasted Stock Price\n (Brownian Motion)", Bold], 
    PlotRange -> All, PlotStyle -> Directive[{Thin, Lighter@GrayLighter @ Gray}]];
 
 G2 := ListLogPlot[{meanvector, watermarkedmeanvector, 
     watermarkedmeanvector2, GridLines -> {{}, {watermark2}}, 
     GridLinesStyle -> {Directive[Orange, Thick]}}, Joined -> True, 
    PlotStyle -> {Directive[{Thick, Darker@RedDarker @ Red}], 
      Directive[{Thick, Darker@BlueDarker @ Blue}], 
      Directive[{Thick, Darker@PinkDarker @ Pink}]}];
 
 
 Show[G1, G2], {{S0, 100, "Initial Stock Value"}, 1, 500, 0.5, 
  Appearance -> "Labeled"}, {{\[Mu]μ, 0.08, "Drift \[Mu]"μ"}, 0.01, 0.2, 
  0.01, Appearance -> "Labeled"}, {{\[Sigma]σ, 0.2, 
   "Standard Deviation \[Sigma]"σ"}, 0.01, 1, 0.05, 
  Appearance -> "Labeled"}, {{P, 6, "Paths"}, 1, 20, 1, 
  Appearance -> "Labeled"}, {{time, 10, "Time t"}, 1, 20, 1, 
  Appearance -> "Labeled"}, {{watermark, 75, "Watermark"}, 1, 500, 
  Appearance -> "Labeled"},
 {{watermark2, 70, "Watermark2"}, 1, 500, Appearance -> "Labeled"},
 {{seed, 1, "New Random Case"}, 1, 100, 1}, 
 Button["Set Initial Values", {S0 = 100, \[Mu]μ = 0.08, \[Sigma]σ = 
    0.20, P = 6, time = 10, watermark = 75, watermark2 = 70}, 
  ImageSize -> 150],
 
 Dynamic["Mean watermarked processes = " <> 
   ToString[watermarkedmeanvector[[-1]][[2]]]],
 Dynamic["Mean watermarked2 processes = " <> 
   ToString[watermarkedmeanvector2[[-1]][[2]]]], 
 Dynamic["Mean of all processes = " <> 
   ToString[meanvector[[-1]][[2]]]], ControlPlacement -> Left]

doDo you have any suggestions?

I have the following problem: I have a watermark in this model where not only the mean of all stochastic processes is calculated but also the mean of those processes, which remain beyond a given threshold/ watermark. Now I want to introduce a second watermark which is lower than the first one. And I also want to calculate and display the mean of the stochastic processes which are beyond the second watermark. My code so far is:

Manipulate[SeedRandom[seed]; meanvector := Mean[assets]; 
 assets = Table[
   RandomFunction[
     GeometricBrownianMotionProcess[\[Mu], \[Sigma], S0], {0, time, 
      0.1}]["Path"], {P}]; 
 processes = Transpose[assets[[#]]][[2]] & /@ Range@Length[assets];
 processes2 = Transpose[assets[[#]]][[2]] & /@ Range@Length[assets]; 
 processesposition = 
  Flatten[Position[
    Min[processes[[#]]] & /@ 
     Range@Length[assets], _?(# > watermark &)]];
 processesposition2 = 
  Flatten[Position[
    Min[processes2[[#]]] & /@ 
     Range@Length[assets], _?(# > watermark2 &)]];
watermarkedassets = assets[[#]] & /@ processesposition; 
 watermarkedmeanvector = Mean[watermarkedassets];
 watermarkedassets2 = assets[[#]] & /@ processesposition2; 
 watermarkedmeanvector2 = Mean[watermarkedassets2];
 
 G1 := ListLogPlot[assets, GridLines -> {{}, {watermark}}, 
    GridLinesStyle -> {Directive[Green, Thick]}, Joined -> True, 
    AxesLabel -> {"Time", "St"}, 
    PlotLabel -> 
     Style["Forecasted Stock Price\n (Brownian Motion)", Bold], 
    PlotRange -> All, PlotStyle -> Directive[{Thin, Lighter@Gray}]];
 
 G2 := ListLogPlot[{meanvector, watermarkedmeanvector, 
     watermarkedmeanvector2, GridLines -> {{}, {watermark2}}, 
     GridLinesStyle -> {Directive[Orange, Thick]}}, Joined -> True, 
    PlotStyle -> {Directive[{Thick, Darker@Red}], 
      Directive[{Thick, Darker@Blue}], 
      Directive[{Thick, Darker@Pink}]}];
 
 
 Show[G1, G2], {{S0, 100, "Initial Stock Value"}, 1, 500, 0.5, 
  Appearance -> "Labeled"}, {{\[Mu], 0.08, "Drift \[Mu]"}, 0.01, 0.2, 
  0.01, Appearance -> "Labeled"}, {{\[Sigma], 0.2, 
   "Standard Deviation \[Sigma]"}, 0.01, 1, 0.05, 
  Appearance -> "Labeled"}, {{P, 6, "Paths"}, 1, 20, 1, 
  Appearance -> "Labeled"}, {{time, 10, "Time t"}, 1, 20, 1, 
  Appearance -> "Labeled"}, {{watermark, 75, "Watermark"}, 1, 500, 
  Appearance -> "Labeled"},
 {{watermark2, 70, "Watermark2"}, 1, 500, Appearance -> "Labeled"},
 {{seed, 1, "New Random Case"}, 1, 100, 1}, 
 Button["Set Initial Values", {S0 = 100, \[Mu] = 0.08, \[Sigma] = 
    0.20, P = 6, time = 10, watermark = 75, watermark2 = 70}, 
  ImageSize -> 150],
 
 Dynamic["Mean watermarked processes = " <> 
   ToString[watermarkedmeanvector[[-1]][[2]]]],
 Dynamic["Mean watermarked2 processes = " <> 
   ToString[watermarkedmeanvector2[[-1]][[2]]]], 
 Dynamic["Mean of all processes = " <> 
   ToString[meanvector[[-1]][[2]]]], ControlPlacement -> Left]

do you have any suggestions?

I have the following problem: I have a watermark in this model where not only the mean of all stochastic processes is calculated, but also the mean of those processes which remain beyond a given threshold/ watermark. Now, I want to introduce a second watermark which is lower than the first one. And I also want to calculate and display the mean of the stochastic processes which are beyond the second watermark.

My code so far is:

Manipulate[SeedRandom[seed]; meanvector := Mean[assets]; 
 assets = Table[
   RandomFunction[
     GeometricBrownianMotionProcess[μ, σ, S0], {0, time, 
      0.1}]["Path"], {P}]; 
 processes = Transpose[assets[[#]]][[2]] & /@ Range@Length[assets];
 processes2 = Transpose[assets[[#]]][[2]] & /@ Range@Length[assets]; 
 processesposition = 
  Flatten[Position[
    Min[processes[[#]]] & /@ 
     Range@Length[assets], _?(# > watermark &)]];
 processesposition2 = 
  Flatten[Position[
    Min[processes2[[#]]] & /@ 
     Range@Length[assets], _?(# > watermark2 &)]];
watermarkedassets = assets[[#]] & /@ processesposition; 
 watermarkedmeanvector = Mean[watermarkedassets];
 watermarkedassets2 = assets[[#]] & /@ processesposition2; 
 watermarkedmeanvector2 = Mean[watermarkedassets2];
 
 G1 := ListLogPlot[assets, GridLines -> {{}, {watermark}}, 
    GridLinesStyle -> {Directive[Green, Thick]}, Joined -> True, 
    AxesLabel -> {"Time", "St"}, 
    PlotLabel -> 
     Style["Forecasted Stock Price\n (Brownian Motion)", Bold], 
    PlotRange -> All, PlotStyle -> Directive[{Thin, Lighter @ Gray}]];
 
 G2 := ListLogPlot[{meanvector, watermarkedmeanvector, 
     watermarkedmeanvector2, GridLines -> {{}, {watermark2}}, 
     GridLinesStyle -> {Directive[Orange, Thick]}}, Joined -> True, 
    PlotStyle -> {Directive[{Thick, Darker @ Red}], 
      Directive[{Thick, Darker @ Blue}], 
      Directive[{Thick, Darker @ Pink}]}];
 
 
 Show[G1, G2], {{S0, 100, "Initial Stock Value"}, 1, 500, 0.5, 
  Appearance -> "Labeled"}, {{μ, 0.08, "Drift μ"}, 0.01, 0.2, 
  0.01, Appearance -> "Labeled"}, {{σ, 0.2, 
   "Standard Deviation σ"}, 0.01, 1, 0.05, 
  Appearance -> "Labeled"}, {{P, 6, "Paths"}, 1, 20, 1, 
  Appearance -> "Labeled"}, {{time, 10, "Time t"}, 1, 20, 1, 
  Appearance -> "Labeled"}, {{watermark, 75, "Watermark"}, 1, 500, 
  Appearance -> "Labeled"},
 {{watermark2, 70, "Watermark2"}, 1, 500, Appearance -> "Labeled"},
 {{seed, 1, "New Random Case"}, 1, 100, 1}, 
 Button["Set Initial Values", {S0 = 100, μ = 0.08, σ = 
    0.20, P = 6, time = 10, watermark = 75, watermark2 = 70}, 
  ImageSize -> 150],
 
 Dynamic["Mean watermarked processes = " <> 
   ToString[watermarkedmeanvector[[-1]][[2]]]],
 Dynamic["Mean watermarked2 processes = " <> 
   ToString[watermarkedmeanvector2[[-1]][[2]]]], 
 Dynamic["Mean of all processes = " <> 
   ToString[meanvector[[-1]][[2]]]], ControlPlacement -> Left]

Do you have any suggestions?

Introduction Plotting the simulation of second watermarkBrownian Motions with multiple thresholds

Source Link
Milan Ivica
  • 361
  • 2
  • 11

Introduction of second watermark

I have the following problem: I have a watermark in this model where not only the mean of all stochastic processes is calculated but also the mean of those processes, which remain beyond a given threshold/ watermark. Now I want to introduce a second watermark which is lower than the first one. And I also want to calculate and display the mean of the stochastic processes which are beyond the second watermark. My code so far is:

Manipulate[SeedRandom[seed]; meanvector := Mean[assets]; 
 assets = Table[
   RandomFunction[
     GeometricBrownianMotionProcess[\[Mu], \[Sigma], S0], {0, time, 
      0.1}]["Path"], {P}]; 
 processes = Transpose[assets[[#]]][[2]] & /@ Range@Length[assets];
 processes2 = Transpose[assets[[#]]][[2]] & /@ Range@Length[assets]; 
 processesposition = 
  Flatten[Position[
    Min[processes[[#]]] & /@ 
     Range@Length[assets], _?(# > watermark &)]];
 processesposition2 = 
  Flatten[Position[
    Min[processes2[[#]]] & /@ 
     Range@Length[assets], _?(# > watermark2 &)]];
watermarkedassets = assets[[#]] & /@ processesposition; 
 watermarkedmeanvector = Mean[watermarkedassets];
 watermarkedassets2 = assets[[#]] & /@ processesposition2; 
 watermarkedmeanvector2 = Mean[watermarkedassets2];
 
 G1 := ListLogPlot[assets, GridLines -> {{}, {watermark}}, 
    GridLinesStyle -> {Directive[Green, Thick]}, Joined -> True, 
    AxesLabel -> {"Time", "St"}, 
    PlotLabel -> 
     Style["Forecasted Stock Price\n (Brownian Motion)", Bold], 
    PlotRange -> All, PlotStyle -> Directive[{Thin, Lighter@Gray}]];
 
 G2 := ListLogPlot[{meanvector, watermarkedmeanvector, 
     watermarkedmeanvector2, GridLines -> {{}, {watermark2}}, 
     GridLinesStyle -> {Directive[Orange, Thick]}}, Joined -> True, 
    PlotStyle -> {Directive[{Thick, Darker@Red}], 
      Directive[{Thick, Darker@Blue}], 
      Directive[{Thick, Darker@Pink}]}];
 
 
 Show[G1, G2], {{S0, 100, "Initial Stock Value"}, 1, 500, 0.5, 
  Appearance -> "Labeled"}, {{\[Mu], 0.08, "Drift \[Mu]"}, 0.01, 0.2, 
  0.01, Appearance -> "Labeled"}, {{\[Sigma], 0.2, 
   "Standard Deviation \[Sigma]"}, 0.01, 1, 0.05, 
  Appearance -> "Labeled"}, {{P, 6, "Paths"}, 1, 20, 1, 
  Appearance -> "Labeled"}, {{time, 10, "Time t"}, 1, 20, 1, 
  Appearance -> "Labeled"}, {{watermark, 75, "Watermark"}, 1, 500, 
  Appearance -> "Labeled"},
 {{watermark2, 70, "Watermark2"}, 1, 500, Appearance -> "Labeled"},
 {{seed, 1, "New Random Case"}, 1, 100, 1}, 
 Button["Set Initial Values", {S0 = 100, \[Mu] = 0.08, \[Sigma] = 
    0.20, P = 6, time = 10, watermark = 75, watermark2 = 70}, 
  ImageSize -> 150],
 
 Dynamic["Mean watermarked processes = " <> 
   ToString[watermarkedmeanvector[[-1]][[2]]]],
 Dynamic["Mean watermarked2 processes = " <> 
   ToString[watermarkedmeanvector2[[-1]][[2]]]], 
 Dynamic["Mean of all processes = " <> 
   ToString[meanvector[[-1]][[2]]]], ControlPlacement -> Left]

do you have any suggestions?