@@ -20,7 +20,13 @@ sde.fun1d <- function(data, i){
2020 return (c(mean(d ),var(d )))
2121}
2222# Parallel MOnte Carlo for mod1
23+
24+ mcm.mod1 = MCM.sde(model = mod1 ,statistic = sde.fun1d ,R = 1 , exact = list (m = E.mod1(1 ),S = V.mod1(1 )))
25+ mcm.mod1 = MCM.sde(model = mod1 ,statistic = sde.fun1d ,R = 5 , names = c(" Ex" ," Vx" ))
2326mcm.mod1 = MCM.sde(model = mod1 ,statistic = sde.fun1d ,R = 5 , exact = list (m = E.mod1(1 ),S = V.mod1(1 )))
27+ mcm.mod1 = MCM.sde(model = mod1 ,statistic = sde.fun1d ,R = 5 , exact = list (m = E.mod1(1 ),S = V.mod1(1 )),names = c(" Ex" ," Vx" ))
28+ mcm.mod1 = MCM.sde(model = mod1 ,statistic = sde.fun1d ,R = 5 )
29+ mcm.mod1 = MCM.sde(model = mod1 ,statistic = sde.fun1d ,R = 5 , exact = list (m = E.mod1(1 ),S = V.mod1(1 )),parallel = " multicore" ,ncpus = 2 )
2430mcm.mod1 = MCM.sde(model = mod1 ,statistic = sde.fun1d ,R = 5 , exact = list (m = E.mod1(1 ),S = V.mod1(1 )),parallel = " snow" ,cl = parallel :: makeCluster(getOption(" cl.cores" , 2 )),ncpus = 2 )
2531mcm.mod1 = MCM.sde(model = mod1 ,statistic = sde.fun1d ,R = 5 , exact = list (m = E.mod1(1 ),S = V.mod1(1 )),parallel = " snow" ,ncpus = 2 )
2632print(mcm.mod1 )
@@ -33,6 +39,8 @@ print(mcm.mod2)
3339plot(mcm.mod1 ,index = 1 ) # mean
3440plot(mcm.mod1 ,index = 2 ) # variance
3541
42+ plot(mcm.mod1 ,index = c(1 ,2 ))
43+
3644# # ----fig.cap=' MC output of mean and variance of `mod2`', fig.env='figure*'----
3745# plot(s) of Monte Carlo outputs of mod2
3846plot(mcm.mod2 ,index = 1 ) # mean
@@ -58,6 +66,7 @@ sde.fun2d <- function(data, i){
5866}
5967# # Parallel Monte-Carlo of 'OUI' at time 10
6068mcm.mod2d = MCM.sde(OUI ,statistic = sde.fun2d ,time = 10 ,R = 5 ,exact = tvalue )
69+ mcm.mod2d = MCM.sde(OUI ,statistic = sde.fun2d ,time = 10 ,R = 5 ,exact = tvalue ,parallel = " multicore" ,ncpus = 2 )
6170mcm.mod2d = MCM.sde(OUI ,statistic = sde.fun2d ,time = 10 ,R = 5 ,exact = tvalue ,parallel = " snow" ,cl = parallel :: makeCluster(getOption(" cl.cores" , 2 )),ncpus = 2 )
6271mcm.mod2d = MCM.sde(OUI ,statistic = sde.fun2d ,time = 10 ,R = 5 ,exact = tvalue ,parallel = " snow" ,ncpus = 2 )
6372print(mcm.mod2d )
@@ -139,6 +148,7 @@ sde.fun3d <- function(data, i){
139148}
140149# # Monte-Carlo at time = 10
141150mcm.mod3d = MCM.sde(modtra ,statistic = sde.fun3d ,R = 5 )
151+ mcm.mod3d = MCM.sde(modtra ,statistic = sde.fun3d ,R = 5 ,parallel = " multicore" ,ncpus = 2 )
142152mcm.mod3d = MCM.sde(modtra ,statistic = sde.fun3d ,R = 5 ,parallel = " snow" ,cl = parallel :: makeCluster(getOption(" cl.cores" , 2 )),ncpus = 2 )
143153mcm.mod3d = MCM.sde(modtra ,statistic = sde.fun3d ,R = 5 ,parallel = " snow" ,ncpus = 2 )
144154print(mcm.mod3d )
0 commit comments