[Yuima-commits] r98 - in pkg/yuima: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jul 11 13:27:02 CEST 2010


Author: iacus
Date: 2010-07-11 13:27:02 +0200 (Sun, 11 Jul 2010)
New Revision: 98

Modified:
   pkg/yuima/R/lse.R
   pkg/yuima/R/qmle.R
   pkg/yuima/man/quasi-likelihood.Rd
Log:
one dim par fixed

Modified: pkg/yuima/R/lse.R
===================================================================
--- pkg/yuima/R/lse.R	2010-07-11 11:09:40 UTC (rev 97)
+++ pkg/yuima/R/lse.R	2010-07-11 11:27:02 UTC (rev 98)
@@ -79,11 +79,30 @@
 		ret <- t(tmp) %*% tmp
 		return(sum(ret))
 	}
+
+	mydots <- as.list(call)[-(1:2)]
+	mydots$fixed <- NULL
+	mydots$fn <- as.name("f")
+	mydots$start <- NULL
+	mydots$par <- unlist(start)
+	mydots$hessian <- FALSE
+	mydots$upper <- unlist( upper[ nm[idx.diff] ])
+	mydots$lower <- unlist( lower[ nm[idx.diff] ])
 	
+	
 	if(length(start)>1){ # multidimensional optim				
-		oout <- optim(start, f, method = method, hessian = FALSE, lower=lower, upper=upper)
+		oout <- do.call(optim, args=mydots)
 	} else { ### one dimensional optim
-		opt1 <- optimize(f, ...) ## an interval should be provided
+		mydots$f <- mydots$fn
+		mydots$fn <- NULL
+		mydots$par <- NULL
+		mydots$hessian <- NULL	
+		mydots$method <- NULL	
+		mydots$interval <- as.numeric(c(lower[drift.par],upper[drift.par])) 
+		mydots$lower <- NULL	
+		mydots$upper <- NULL
+		opt1 <- do.call(optimize, args=mydots)
+#opt1 <- optimize(f, ...) ## an interval should be provided
 		oout <- list(par = opt1$minimum, value = opt1$objective)
 	} 
 	

Modified: pkg/yuima/R/qmle.R
===================================================================
--- pkg/yuima/R/qmle.R	2010-07-11 11:09:40 UTC (rev 97)
+++ pkg/yuima/R/qmle.R	2010-07-11 11:27:02 UTC (rev 98)
@@ -225,6 +225,9 @@
 			 mydots$par <- NULL
 			 mydots$hessian <- NULL	
 			 mydots$method <- NULL	
+			 mydots$interval <- as.numeric(c(lower[diff.par],upper[diff.par])) 
+			 mydots$lower <- NULL	
+			 mydots$upper <- NULL	
 			 opt1 <- do.call(optimize, args=mydots)
 			 theta1 <- opt1$minimum
 			 names(theta1) <- diff.par
@@ -251,7 +254,9 @@
 			mydots$hessian <- TRUE
 			mydots$upper <- unlist( upper[ nm[idx.drift] ])
 			mydots$lower <- unlist( lower[ nm[idx.drift] ])
-			
+			mydots$lower <- NULL	
+			mydots$upper <- NULL	
+		
 			if(length(mydots$par)>1)
 			  oout1 <- do.call(optim, args=mydots)
 			else {
@@ -260,6 +265,7 @@
 				mydots$par <- NULL
 				mydots$hessian <- NULL	
 				mydots$method <- NULL	
+				mydots$interval <- as.numeric(c(lower[drift.par],upper[drift.par])) 
 				opt1 <- do.call(optimize, args=mydots)
 				theta2 <- opt1$minimum
 				names(theta2) <- drift.par

Modified: pkg/yuima/man/quasi-likelihood.Rd
===================================================================
--- pkg/yuima/man/quasi-likelihood.Rd	2010-07-11 11:09:40 UTC (rev 97)
+++ pkg/yuima/man/quasi-likelihood.Rd	2010-07-11 11:27:02 UTC (rev 98)
@@ -55,8 +55,6 @@
   \code{quasilogl} returns the valueof the  quasi loglikelihood for a given
   \code{yuima} object and list of parameters \code{coef}.
   
-  The argument \code{...} can accept \code{interval} for one-dimensional
-  optimization.
 }
 \value{
   \item{QL}{a real value.}
@@ -99,7 +97,7 @@
 print(coef(opt2))
 
 ## initial guess for theta2 by least squares estimator
-tmp <- lse(yuima, start=list(theta2=0.7), interval=c(0,2))
+tmp <- lse(yuima, start=list(theta2=0.7), lower=list(theta2=0), upper=list(theta2=1))
 tmp
 
 system.time(



More information about the Yuima-commits mailing list