11options(prompt = " R> " ,scipen = 16 ,digits = 4 ,warning = FALSE , message = FALSE )
22library(Sim.DiffProc )
33
4-
4+ RNGkind( kind = " L'Ecuyer-CMRG " )
55# #####
66
77theta = 0.75 ; x0 = 1
@@ -20,6 +20,8 @@ sde.fun1d <- function(data, i){
2020 return (c(mean(d ),var(d )))
2121}
2222# Parallel MOnte Carlo for mod1
23+ mcm.mod1 = MCM.sde(model = mod1 ,statistic = sde.fun1d ,R = 5 , exact = list (m = E.mod1(1 ),S = V.mod1(1 )))
24+ mcm.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 )
2325mcm.mod1 = MCM.sde(model = mod1 ,statistic = sde.fun1d ,R = 5 , exact = list (m = E.mod1(1 ),S = V.mod1(1 )),parallel = " snow" ,ncpus = 2 )
2426print(mcm.mod1 )
2527# Parallel MOnte Carlo for mod2
@@ -55,6 +57,8 @@ sde.fun2d <- function(data, i){
5557 return (c(mean(d $ x ),mean(d $ y ),var(d $ x ),var(d $ y ),cov(d $ x ,d $ y )))
5658}
5759# # Parallel Monte-Carlo of 'OUI' at time 10
60+ mcm.mod2d = MCM.sde(OUI ,statistic = sde.fun2d ,time = 10 ,R = 5 ,exact = tvalue )
61+ mcm.mod2d = MCM.sde(OUI ,statistic = sde.fun2d ,time = 10 ,R = 5 ,exact = tvalue ,parallel = " snow" ,cl = parallel :: makeCluster(getOption(" cl.cores" , 2 )),ncpus = 2 )
5862mcm.mod2d = MCM.sde(OUI ,statistic = sde.fun2d ,time = 10 ,R = 5 ,exact = tvalue ,parallel = " snow" ,ncpus = 2 )
5963print(mcm.mod2d )
6064plot(mcm.mod2d )
@@ -94,6 +98,8 @@ sde.fun3d <- function(data, i){
9498 return (c(mean(d $ x ),median(d $ x ),Mode(d $ x ),var(d $ x ),cov(d $ x ,d $ y ),cov(d $ x ,d $ z )))
9599}
96100# # Monte-Carlo at time = 10
101+ mcm.mod3d = MCM.sde(modtra ,statistic = sde.fun3d ,R = 5 )
102+ mcm.mod3d = MCM.sde(modtra ,statistic = sde.fun3d ,R = 5 ,parallel = " snow" ,cl = parallel :: makeCluster(getOption(" cl.cores" , 2 )),ncpus = 2 )
97103mcm.mod3d = MCM.sde(modtra ,statistic = sde.fun3d ,R = 5 ,parallel = " snow" ,ncpus = 2 )
98104print(mcm.mod3d )
99105plot(mcm.mod3d )
@@ -113,4 +119,5 @@ sde.fun3d <- function(data, i){
113119mcm.mod3d = MCM.sde(modtra ,statistic = sde.fun3d ,R = 5 ,parallel = " snow" ,ncpus = 2 )
114120print(mcm.mod3d )
115121plot(mcm.mod3d )
122+ plot(mcm.mod3d ,index = c(1 ,7 ))
116123
0 commit comments