I'm fairly new to Mathematica and i want to review the average prices of this model. In order to do that i need to perform a Monte Carlo simulation on my financial markets model:
P[t_] := P[t] = P[t - 1] + μ*ED[t - 1] + RandomVariate[NormalDistribution[0, 0.03]]; ED[t_] := ED[t] = WC[t]*DC[t] + WF[t]*DF[t]; DC[t_] := DC[t] = b (P[t] - P[t - 1]); DF[t_] := DF[t] = c (F - P[t]); WF[t_] := WF[t] = 1/(1 + Exp[-β*a[t]]); WC[t_] := WC[t] = 1 - WF[t]; a[t_] := a[t] = α0 + αn*(WF[t - 1] - WC[t - 1]) + αp (P[t - 1] - F)^2; μ = 0.01; β = 1; b = 0.01; c = 0.01; α0 = 0; αn = -0.4; αp = 1; F = 1; P[0] = F; P[1] = F; P[2] = F; P[3] = F + 0.01; WF[1] = 0.2; WC[1] = 0.8; logprices = Table[P[t], {t, 1000, 6000}]; logreturns = Differences[logprices]; abslogreturns = Abs[logreturns]; Dis[t_] := Dis[t] = Abs[P[t] - F]; SumDis = Table[Dis[t], {t, 1000, 6000}]; Mean[SumDis] Mean[logprices] Kurtosis[logreturns] P = Price, ED = excess demand, DC/DF = demand, WC/WF = weights, a = influences of weights, F = fundamental value, dis = distortion
A single run is supposed to yield the average price, the average distortion and the kurtosis of the logreturns. P, DC/DF and WF/WC will be plotted using ListLineplot.
I want to run this about 2000-5000 times and compile the resulting 2000-5000 average prices and distortions in a list or something along those lines so i can average them to see what a change of a variable does to those.
I read the Mathematica documentation on how to perform a Monte Carlo simulation, but I couldn't see how to transfer it to my model.
I tried the table function but the only result I achieved is {Null}.
My question is: how do I set this up correctly?