我正在考虑使用Sobol序列作为方差减少技术来加速模拟。然而,QMC方法的收敛似乎很弱。
有谁知道这是怎么回事? QMC的优势是否在这些高维度情况下丢失了?我得到了布朗桥的类似结果。
下面的代码试图在Julia中模拟以下
$$ \ mathbb {E} \ int B_t dt $$
其中$ B_t $是标准布朗运动。真正的价值是$ \ frac {1} {2} T ^ 2 $。
using PyPlot
import Distributions: Normal
import PyPlot: plt
using Sobol
function pseudo_path_variation(dt, T, M)
# The pseudo random approach
N = round(Int, T/dt);
Z = zeros(N, M);
d = Normal(0, 1.0);
sum = 0.0;
for j in 1:M, i in 1:N-1
Z[i+1, j] = Z[i, j] + sqrt(dt)*rand(d, 1)[1];
end
# Calculate sum
return sumabs2(Z)*dt/M;
end
function quasi_path_variation(dt, T, M)
# An attempt at the above using a N dimensional sobol sequence
N = round(Int, T/dt);
Z = zeros(N, M);
d = Normal(0, 1.0);
sum = 0.0;
# The N dimensional sobol sequence
s = SobolSeq(N);
# Burn in the sequence
for i in 1:10
next(s);
end
for j in 1:M
B = next(s);
for i in 1:N-1
Z[i+1, j] = Z[i, j] + sqrt(dt)*quantile(d, B[i]);
end
end
# Calculate sum
return sumabs2(Z)*dt/M;
end
dt = 0.5;
T = 10;
M = 1000;
estims = zeros(M);
for N = 1:M-1
estims[N+1] = quasi_path_variation(dt, T, N)
end
p = plot(linspace(0, M, M), estims);
estims = zeros(M);
for N = 1:M-1
estims[N+1] = pseudo_path_variation(dt, T, N)
end
p = plot(linspace(0, M, M), estims);
答案 0 :(得分:1)
这是一个评论,而不是一个答案,但我的SO分数不够高,无法发表评论 用tic()... toc()计时 - 在3秒内完成。
tic()
dt = 0.5;
T = 10;
...
...
p = plot(linspace(0, M, M), estims);
toc()
elapsed time: 2.928828918 seconds