[Yuima-commits] r101 - in pkg/yuima: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jul 13 21:27:41 CEST 2010


Author: iacus
Date: 2010-07-13 21:27:41 +0200 (Tue, 13 Jul 2010)
New Revision: 101

Modified:
   pkg/yuima/DESCRIPTION
   pkg/yuima/R/qmle.R
Log:
further optimizitaion

Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION	2010-07-13 16:03:47 UTC (rev 100)
+++ pkg/yuima/DESCRIPTION	2010-07-13 19:27:41 UTC (rev 101)
@@ -1,7 +1,7 @@
 Package: yuima
 Type: Package
 Title: The YUIMA Project package (unstable version)
-Version: 0.0.99
+Version: 0.1.00
 Date: 2010-07-13
 Depends: methods, zoo, stats4, utils
 Suggests: cubature, mvtnorm

Modified: pkg/yuima/R/qmle.R
===================================================================
--- pkg/yuima/R/qmle.R	2010-07-13 16:03:47 UTC (rev 100)
+++ pkg/yuima/R/qmle.R	2010-07-13 19:27:41 UTC (rev 101)
@@ -9,6 +9,7 @@
 ### calc.diffusion to make them independent of the specification of the 
 ### parameters.  S.M.I. 22/06/2010
 
+
 drift.term <- function(yuima, theta, env){
 	r.size <- yuima at model@noise.number
 	d.size <- yuima at model@equation.number
@@ -16,22 +17,20 @@
 	DRIFT <- yuima at model@drift
 	n <- length(yuima)[1]
 	drift <- matrix(0,n,d.size)
-
+	
+	
 	for(i in 1:length(theta)){
 		assign(names(theta)[i],theta[[i]])
 	}
-	for(t in 1:n){
-		for(d in 1:d.size)
-			assign(modelstate[d], env$X[t,d])
-# do not collapse the two for loops					
-		for(d in 1:d.size)
-			drift[t,d] <- eval(DRIFT[d])
+	
+	for(d in 1:d.size){
+		assign(modelstate[d], env$X[,d])
+		drift[,d] <- eval(DRIFT[d])
 	}
 	return(drift)  
 }
 
 
-
 diffusion.term <- function(yuima, theta, env){
 	r.size <- yuima at model@noise.number
 	d.size <- yuima at model@equation.number
@@ -44,13 +43,9 @@
 	}
 
 	for(r in 1:r.size){
-		for(t in 1:n){
-			for(d in 1:d.size)
-				assign(modelstate[d], env$X[t,d])
-# do not collapse the two for loops			
-			for(d in 1:d.size)
-				diff[d, r, t] <- eval(DIFFUSION[[d]][r])
-			
+		for(d in 1:d.size){
+			assign(modelstate[d], env$X[,d])
+			diff[d, r, ] <- eval(DIFFUSION[[d]][r])
 		}
 	}
 	return(diff)
@@ -62,6 +57,9 @@
 
 
 
+
+
+
 ### I have rewritten qmle as a version of ml.ql
 ### This function has an interface more similar to mle.
 ### ml.ql is limited in that it uses fixed names for drift and diffusion



More information about the Yuima-commits mailing list