Skip to content

Commit abf214a

Browse files
committed
version 4.8
1 parent 2cf9ec2 commit abf214a

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

tests/MCM_test.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ sde.fun1d <- function(data, i){
2121
}
2222
# Parallel MOnte Carlo for mod1
2323

24-
mcm.mod1 = MCM.sde(model=mod1,statistic=sde.fun1d,R=1, exact=list(m=E.mod1(1),S=V.mod1(1)))
2524
mcm.mod1 = MCM.sde(model=mod1,statistic=sde.fun1d,R=5, names=c("Ex","Vx"))
2625
mcm.mod1 = MCM.sde(model=mod1,statistic=sde.fun1d,R=5, exact=list(m=E.mod1(1),S=V.mod1(1)))
2726
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"))

tests/snssde_test.R

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ lines(mod1[[1]],col=2,lwd=2)
4343
points(mod1[[1]],pch=21,col=5,cex=0.5)
4444

4545
s = 0.0554747
46+
summary(mod1[[1]], at = s)
4647
mean(mod1[[1]], at = s)
4748
moment(mod1[[1]], at = s , center = TRUE , order = 2) ## variance
4849
Median(mod1[[1]], at = s)
@@ -105,6 +106,7 @@ plot2d(mod2[[1]],type="n")
105106
lines2d(mod2[[1]],col=4)
106107
points2d(mod2[[1]],pch=19,cex=0.1)
107108

109+
summary(mod2[[1]], at = s)
108110
mean(mod2[[1]], at = s)
109111
moment(mod2[[1]], at = s , center = TRUE , order = 2) ## variance
110112
Median(mod2[[1]], at = s)
@@ -170,6 +172,7 @@ lines(mod3[[1]],col=2,lwd=2)
170172
points(mod3[[1]],pch=21,col=5,cex=0.1)
171173

172174
mean(mod3[[1]], at = s)
175+
summary(mod3[[1]], at = s)
173176
moment(mod3[[1]], at = s , center = TRUE , order = 2) ## variance
174177
Median(mod3[[1]], at = s)
175178
Mode(mod3[[1]], at = s)
@@ -193,6 +196,9 @@ s= 0.00458
193196
f <- expression( 2*(1-x) )
194197
g <- expression( 1 )
195198

199+
mod1 <- snssde1d(drift=f,diffusion=g,x0=2,N=50,M=12,Dt=0.001)
200+
plot(mod1)
201+
196202
mod1 <- snssde1d(drift=f,diffusion=g,x0=2,N=50,M=1,Dt=0.001)
197203
plot(mod1,type="n")
198204
lines(mod1,col=2)
@@ -214,6 +220,13 @@ max(mod1,at = s)
214220
fx <- expression(4*(-1-x) , x)
215221
gx <- expression(0.2 , 0)
216222

223+
mod2 <- snssde2d(drift=fx,diffusion=gx,M=1,N=50,Dt=0.001)
224+
plot(mod2,union = FALSE)
225+
plot(mod2,type="n")
226+
lines(mod2,col=2)
227+
points(mod2,cex=0.1,pch=19)
228+
plot2d(mod2)
229+
217230
mod2 <- snssde2d(drift=fx,diffusion=gx,M=5,N=50,Dt=0.001)
218231
plot(mod2,union = FALSE)
219232
plot(mod2,type="n")
@@ -236,10 +249,19 @@ max(mod2,at = s)
236249
fx <- expression(4*(-1-x), 4*(1-y), 4*(1-z))
237250
gx <- rep(expression(0.2),3)
238251

252+
mod3 <- snssde3d(drift=fx,diffusion=gx,N=50,M=1,Dt=0.001)
253+
plot(mod3,type="n")
254+
lines(mod3,col=2)
255+
points(mod3,cex=0.1,pch=19)
256+
plot3D(mod3,display="rgl")
257+
plot3D(mod3)
258+
239259
mod3 <- snssde3d(drift=fx,diffusion=gx,N=50,M=5,Dt=0.001)
240260
plot(mod3,type="n")
241261
lines(mod3,col=2)
242262
points(mod3,cex=0.1,pch=19)
263+
plot3D(mod3,display="rgl")
264+
plot3D(mod3)
243265

244266
mean(mod3,at = s)
245267
moment(mod3,at = s, center = TRUE , order = 2) ## variance

0 commit comments

Comments
 (0)