@@ -63,6 +63,26 @@ mcm.mod2d = MCM.sde(OUI,statistic=sde.fun2d,time=10,R=5,exact=tvalue,parallel="s
6363print(mcm.mod2d )
6464plot(mcm.mod2d )
6565
66+
67+ mu = 1 ;sigma = 0.5 ;theta = 2
68+ x0 = 0 ;y0 = 0 ;init = c(x0 ,y0 )
69+ f <- expression(1 / mu * (theta - x ), x )
70+ g <- expression(sqrt(sigma ),0 )
71+ Sigma <- matrix (c(1 , 0.75 , 0.75 , 1 ), nrow = 2 , ncol = 2 )
72+ OUI <- snssde2d(drift = f ,diffusion = g ,corr = Sigma ,M = 10 ,Dt = 0.015 ,x0 = c(x = 0 ,y = 0 ))
73+
74+ # # function of the statistic(s) of interest.
75+ sde.fun2d <- function (data , i ){
76+ d <- data [i ,]
77+ return (c(mean(d $ x ),mean(d $ y ),var(d $ x ),var(d $ y ),cov(d $ x ,d $ y )))
78+ }
79+ # # Parallel Monte-Carlo of 'OUI' at time 10
80+ mcm.mod2d = MCM.sde(OUI ,statistic = sde.fun2d ,time = 10 ,R = 5 )
81+ mcm.mod2d = MCM.sde(OUI ,statistic = sde.fun2d ,time = 10 ,R = 5 ,parallel = " snow" ,cl = parallel :: makeCluster(getOption(" cl.cores" , 2 )),ncpus = 2 )
82+ mcm.mod2d = MCM.sde(OUI ,statistic = sde.fun2d ,time = 10 ,R = 5 ,parallel = " snow" ,ncpus = 2 )
83+ print(mcm.mod2d )
84+ plot(mcm.mod2d )
85+
6686# ##
6787
6888mu = 1 ;sigma = 0.5 ;theta = 2
@@ -87,6 +107,26 @@ mcm.mod2d = MCM.sde(OUI,statistic=sde.fun2d,time=10,R=5,exact=tvalue,parallel="s
87107print(mcm.mod2d )
88108plot(mcm.mod2d )
89109
110+
111+ mu = 1 ;sigma = 0.5 ;theta = 2
112+ x0 = 0 ;y0 = 0 ;init = c(x0 ,y0 )
113+ f <- expression(1 / mu * (theta - x ), x )
114+ g <- expression(sqrt(sigma ),0 )
115+ Sigma <- matrix (c(1 , 0.75 , 0.75 , 1 ), nrow = 2 , ncol = 2 )
116+ OUI <- snssde2d(drift = f ,diffusion = g ,corr = Sigma ,M = 10 ,Dt = 0.015 ,x0 = c(x = 0 ,y = 0 ),type = " str" )
117+
118+ # # function of the statistic(s) of interest.
119+ sde.fun2d <- function (data , i ){
120+ d <- data [i ,]
121+ return (c(mean(d $ x ),mean(d $ y ),var(d $ x ),var(d $ y ),cov(d $ x ,d $ y )))
122+ }
123+ # # Parallel Monte-Carlo of 'OUI' at time 10
124+ mcm.mod2d = MCM.sde(OUI ,statistic = sde.fun2d ,time = 10 ,R = 5 )
125+ mcm.mod2d = MCM.sde(OUI ,statistic = sde.fun2d ,time = 10 ,R = 5 ,parallel = " snow" ,cl = parallel :: makeCluster(getOption(" cl.cores" , 2 )),ncpus = 2 )
126+ mcm.mod2d = MCM.sde(OUI ,statistic = sde.fun2d ,time = 10 ,R = 5 ,parallel = " snow" ,ncpus = 2 )
127+ print(mcm.mod2d )
128+ plot(mcm.mod2d )
129+
90130# # ------------------------------------------------------------------------
91131mu = 0.5 ;sigma = 0.25
92132fx <- expression(mu * y ,0 ,0 )
@@ -104,6 +144,23 @@ mcm.mod3d = MCM.sde(modtra,statistic=sde.fun3d,R=5,parallel="snow",ncpus=2)
104144print(mcm.mod3d )
105145plot(mcm.mod3d )
106146
147+ mu = 0.5 ;sigma = 0.25
148+ fx <- expression(mu * y ,0 ,0 )
149+ gx <- expression(sigma * z ,1 ,1 )
150+ Sigma <- matrix (c(1 ,- 0.5 ,- 0.25 ,- 0.5 ,1 ,0.95 ,- 0.25 ,0.95 ,1 ),nrow = 3 ,ncol = 3 )
151+ modtra <- snssde3d(drift = fx ,diffusion = gx ,M = 10 ,corr = Sigma )
152+ # # function of the statistic(s) of interest.
153+ sde.fun3d <- function (data , i ){
154+ d <- data [i ,]
155+ return (c(mean(d $ x ),median(d $ x ),Mode(d $ x ),var(d $ x ),cov(d $ x ,d $ y ),cov(d $ x ,d $ z )))
156+ }
157+ # # Monte-Carlo at time = 10
158+ mcm.mod3d = MCM.sde(modtra ,statistic = sde.fun3d ,R = 5 )
159+ mcm.mod3d = MCM.sde(modtra ,statistic = sde.fun3d ,R = 5 ,parallel = " snow" ,cl = parallel :: makeCluster(getOption(" cl.cores" , 2 )),ncpus = 2 )
160+ mcm.mod3d = MCM.sde(modtra ,statistic = sde.fun3d ,R = 5 ,parallel = " snow" ,ncpus = 2 )
161+ print(mcm.mod3d )
162+ plot(mcm.mod3d )
163+
107164# #
108165
109166mu = 0.5 ;sigma = 0.25
@@ -121,3 +178,19 @@ print(mcm.mod3d)
121178plot(mcm.mod3d )
122179plot(mcm.mod3d ,index = 2 )
123180
181+ mu = 0.5 ;sigma = 0.25
182+ fx <- expression(mu * y ,0 ,0 )
183+ gx <- expression(sigma * z ,1 ,1 )
184+ Sigma <- matrix (c(1 ,- 0.5 ,- 0.25 ,- 0.5 ,1 ,0.95 ,- 0.25 ,0.95 ,1 ),nrow = 3 ,ncol = 3 )
185+ modtra <- snssde3d(drift = fx ,diffusion = gx ,M = 10 ,corr = Sigma ,type = " str" )
186+ # # function of the statistic(s) of interest.
187+ sde.fun3d <- function (data , i ){
188+ d <- data [i ,]
189+ return (c(mean(d $ x ),median(d $ x ),Mode(d $ x ),var(d $ x ),cov(d $ x ,d $ y ),cov(d $ x ,d $ z )))
190+ }
191+ # # Monte-Carlo at time = 10
192+ mcm.mod3d = MCM.sde(modtra ,statistic = sde.fun3d ,R = 5 )
193+ mcm.mod3d = MCM.sde(modtra ,statistic = sde.fun3d ,R = 5 ,parallel = " snow" ,cl = parallel :: makeCluster(getOption(" cl.cores" , 2 )),ncpus = 2 )
194+ mcm.mod3d = MCM.sde(modtra ,statistic = sde.fun3d ,R = 5 ,parallel = " snow" ,ncpus = 2 )
195+ print(mcm.mod3d )
196+ plot(mcm.mod3d )
0 commit comments