philippsas
(philipp.sas Scneider)
December 7, 2016, 3:12pm
1
Dear all. Im desperately looking for Help. My capacities in Wolfram aren’t the biggest and I’m trying to get my Model to run. Can someone Help me? ~ Greetings Philipp. P.S. The Model is attached
(*Clear variables*)
Clear[P, DC, DF, DB, DS, F, ?, ?, ?, ?];
(*Model Equations*)
DC[t_] := DC[t] = ?*(P[t] - F);
DF[t_] := DF[t] = ?*(F - P[t]);
DB[t_] := DB[t] = ?;
DS[t_] := DS[t] = -?;
P[t_] := P[t] =
P[t - 1] + ?[(?*DC[t - 1] - ?*DF[t - 1])*(P[t - 1] -
F) + ? (DB[t - 1] - DS[t - 1])];
(*Abhängikeiten darstellen*)
(*parameter setting*)
? = 0.010;
F = 0;
? = 1.011;
? = 1.000;
? = 0.165;
(*Startwerte setzten*)
P[0] = F; P[1] = F;
logprices = Table[P[i], {i, 1, 5000}];
logreturns = Differences@logprices;
ListLinePlot[Exp@logprices, PlotStyle -> Black, PlotRange -> All,
Frame -> True, FrameLabel -> {{"price", None}, {"time", None}},
AspectRatio -> 0.4, GridLines -> {{}, {Exp[F]}}]
(*Entwicklung der log Renditen*)
ListLinePlot[logreturns,
PlotStyle -> Black, PlotRange -> All, Frame -> True,
FrameLabel -> {{"log returns", None}, {"time", None}},
AspectRatio -> 0.4, Axes -> None]
mthiel
(Marco Thiel)
December 7, 2016, 4:13pm
2
Hi,
I think that the model equations for P are incorrect. Just behind the \mu you are using square brackets where you should use round brackets.
P[t_] := P[t] =
P[t - 1] + \[Mu] ((\[Chi]*DC[t - 1] - \[Phi]*DF[t - 1])*(P[t - 1] -
F) + \[Kappa] (DB[t - 1] - DS[t - 1]));
should do. You will still have an overflow when you try to evaluate
Table[P[i], {i, 1, 5000}]
though. You see that this behaves badly if you use:
logprices = Table[P[i], {i, 1, 450}];
logreturns = Differences@logprices;
ListLinePlot[Exp@logprices, PlotStyle -> Black, PlotRange -> All,
Frame -> True, FrameLabel -> {{"price", None}, {"time", None}},
AspectRatio -> 0.4, GridLines -> {{}, {Exp[F]}}]
If you iterate to the first 480 elements you get:
At 481 you get to values of about 10^{183} .
Cheers,
Marco
Welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1ST
And please EDIT your post and make your title NOT generic, but about the actual model.
etm
(Eric Meyers)
December 7, 2016, 4:29pm
4
I think it’s the [ and ] near the mu in your P function. Also it diverges at around t=450. See if this fixes you up.
Eric
Ps. I see Marco found the same issue before me.
philippsas
(philipp.sas Scneider)
December 7, 2016, 6:00pm
5
Thank you very much,… I’ll see if it works better now