[Yuima-commits] r24 - pkg/yuima/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 24 17:53:41 CET 2009


Author: iacus
Date: 2009-11-24 17:53:41 +0100 (Tue, 24 Nov 2009)
New Revision: 24

Modified:
   pkg/yuima/R/sim.euler.R
   pkg/yuima/R/sim.euler.space.discretized.R
   pkg/yuima/R/simulate.R
Log:
added env argument

Modified: pkg/yuima/R/sim.euler.R
===================================================================
--- pkg/yuima/R/sim.euler.R	2009-11-24 15:37:26 UTC (rev 23)
+++ pkg/yuima/R/sim.euler.R	2009-11-24 16:53:41 UTC (rev 24)
@@ -1,8 +1,6 @@
-euler<-function(xinit,yuima,dW){
+euler<-function(xinit,yuima,dW,env){
+
 	
-  
-##:: initialize state variable
-	
 	sdeModel<-yuima at model
 	
 	modelstate <- sdeModel at solve.variable

Modified: pkg/yuima/R/sim.euler.space.discretized.R
===================================================================
--- pkg/yuima/R/sim.euler.space.discretized.R	2009-11-24 15:37:26 UTC (rev 23)
+++ pkg/yuima/R/sim.euler.space.discretized.R	2009-11-24 16:53:41 UTC (rev 24)
@@ -1,4 +1,4 @@
-space.discretized<-function(xinit,yuima){
+space.discretized<-function(xinit,yuima, env){
 
 
 ##:: initialize state variable

Modified: pkg/yuima/R/simulate.R
===================================================================
--- pkg/yuima/R/simulate.R	2009-11-24 15:37:26 UTC (rev 23)
+++ pkg/yuima/R/simulate.R	2009-11-24 16:53:41 UTC (rev 24)
@@ -53,14 +53,25 @@
   ##   print(yuima at sampling@division)
   ##   readline()
   
-  if(missing(true.parameter)){
-    true.parameter <- numeric(length(sdeModel at parameter@all))
+  par.len <- length(sdeModel at parameter@all)
+				
+  if(missing(true.parameter) & par.len>0){
+	true.parameter <- vector(par.len, mode="list")
+	for(i in 1:par.len)
+     true.parameter[[i]] <- 0
+	names(true.parameter) <-   sdeModel at parameter@all
   }
-  
- 
-  
-  
-  
+    
+  yuimaEnv <- new.env()
+				
+  if(par.len>0){
+	for(i in 1:par.len){
+	 pars <- sdeModel at parameter@all[i]
+	 assign(sdeModel at parameter@all[i], true.parameter[i], yuimaEnv)
+	}
+  }
+
+				
   if(space.discretized){
     if(r.size>1){
       warning("Space-discretized EM cannot be used for multi-dimentional models. Use standard method.")
@@ -101,26 +112,20 @@
   }
   
     
-  par.len <- length(sdeModel at parameter@all)
-  if(par.len>0){
-    for(i in 1:par.len){
-      pars <- sdeModel at parameter@all[i]
-      assign(pars, true.parameter[i])
-    }
-  }
 
 				
   
   if(space.discretized){   	  
 	  ##:: using Space-discretized Euler-Maruyama method	  
-	  yuima at data <- space.discretized(xinit, yuima)
+	  yuima at data <- space.discretized(xinit, yuima, yuimaEnv)
 	  return(yuima)  
   }
 	
 	
     
   ##:: using Euler-Maruyama method
-  
+  delta <- Terminal/division 
+				
   ##:: Diffusion terms
   if( missing(increment.W)){
   	
@@ -130,6 +135,6 @@
     dW <- increment.W
   }
     
-  yuima at data <- euler(xinit,yuima,dW)
+  yuima at data <- euler(xinit, yuima, dW, yuimaEnv)
   return(yuima)
 })



More information about the Yuima-commits mailing list