Metropois-Hastings(MH) Monte Carlo Integral

5.3 μs
40.8 μs
14.3 ms

V=abg(x)dx=abf(x)h(x)dxC=abh(x)dxp(x)=h(x)C,Probability Density : p(x)V=abg(x)dx=abf(x)h(x)dx=Cabf(x)p(x)dx=CE[f(x)]V=CExp[f(x)]C1NiNf(xi)

3.2 μs

예제

  • mh_integral_01 : g(z,y,z)의 MonteCarloIntegration 패키지의 값과 수치적분 비교

  • 아래 (1),(2),(3)의 각각에 대해 MH Monte Carlo 적분

g(x,y,z)=xyzln(x+2y+3z)sin(x+y+z)V=abababg(x,y,z)dxdydzmh_integral_02()(1)h(x,y,z)=1f(x,y,z)=xyzln(x+2y+3z)sin(x+y+z)mh_integral_03()(2)h(x,y,z)=sin(x+y+z)f(x,y,z)=xyzln(x+2y+3z)mh_integral_04(), mh_integral_05()(3)h(x,y,z)=ln(x+2y+3z)sin(x+y+z)f(x,y,z)=xyz※ 주의 : 0 ≤ a,b ≤ 1 범위에서 적분값이 제대로 나옴

11.0 μs
g (generic function with 1 method)
28.9 μs
MonteCarloIntegration::vegas와 HCubature::hcubature 의 적분값 비교
16.0 μs
mh_integral_01 (generic function with 1 method)
60.3 μs
518 ms
Metropolis-Hasting function 정의
6.3 μs
mh_integral (generic function with 1 method)
105 μs

f(x,y,z)=xyzln(x+2y+3z)sin(x+y+z)h(x,y,z)=1C=ababab1dxdydz=(ba)3

7.9 μs
mh_integral_02 (generic function with 1 method)
71.7 μs
281 ms

f(x,y,z)=xyzln(x+2y+3z)h(x,y,z)=sin(x+y+z)C=abababsin(x+y+z)dxdydz

4.3 μs
mh_integral_03 (generic function with 1 method)
107 μs
378 ms

f(x,y,z)=xyzh(x,y,z)=ln(x+2y+3z)sin(x+y+z)C=abababln(x+2y+3z)sin(x+y+z)dxdydz

3.5 μs
mh_integral_04 (generic function with 1 method)
77.1 μs
357 ms
C 값을 MH로 구하고 적분하기

f(x,y,z)=xyzh(x,y,z)=ln(x+2y+3z)sin(x+y+z)C=MetroPolis-Hasting MonteCarlo Integral

5.8 μs
mh_integral_05_C (generic function with 1 method)
69.3 μs
718 ms
mh_integral_05 (generic function with 1 method)
75.9 μs
569 ms