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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Apr 19 12:23:08 CEST 2015


Author: lorenzo
Date: 2015-04-19 12:23:08 +0200 (Sun, 19 Apr 2015)
New Revision: 373

Modified:
   pkg/yuima/DESCRIPTION
   pkg/yuima/R/MM.COGARCH.R
   pkg/yuima/man/gmm.rd
Log:
Add documentation for arg "aggregation" in gmm function

Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION	2015-04-03 00:03:45 UTC (rev 372)
+++ pkg/yuima/DESCRIPTION	2015-04-19 10:23:08 UTC (rev 373)
@@ -1,8 +1,8 @@
 Package: yuima
 Type: Package
 Title: The YUIMA Project package for SDEs
-Version: 1.0.62
-Date: 2015-04-02
+Version: 1.0.63
+Date: 2015-04-19
 Depends: methods, zoo, stats4, utils, expm, cubature, mvtnorm
 Author: YUIMA Project Team
 Maintainer: Stefano M. Iacus <stefano.iacus at unimi.it>

Modified: pkg/yuima/R/MM.COGARCH.R
===================================================================
--- pkg/yuima/R/MM.COGARCH.R	2015-04-03 00:03:45 UTC (rev 372)
+++ pkg/yuima/R/MM.COGARCH.R	2015-04-19 10:23:08 UTC (rev 373)
@@ -44,7 +44,7 @@
 # The estimation procedure for cogarch(p,q) implemented in this code are based on the 
 # Chadraa phd's thesis
 gmm<-function(yuima, data = NULL, start, method="BFGS", fixed = list(), 
-                           lower, upper, lag.max = NULL, aggr.G = TRUE, 
+                           lower, upper, lag.max = NULL, aggr.G = TRUE, aggregation=TRUE,
                            Est.Incr = "NoIncr", objFun = "L2"){
   print <- FALSE
 
@@ -214,6 +214,7 @@
   assign("objFun",objFun, envir=env)
   
   if(aggr.G==TRUE){
+    # Aggregate returns G
     #dt<-round(deltat(onezoo(observ)[,1])*10^5)/10^5
     # Time<-index(observ at zoo.data[[1]])[n]
     G_i <- diff(env$Data[seq(1,length(env$Data),by=env$deltaData)])
@@ -331,8 +332,9 @@
                          acoeff=avect,cost=out$par[loc.par], b=bvect,  
                          r=env$r, h=seq(1, env$d, by = 1)*env$r, type=typeacf, 
                          m2=env$mu_G2, var=env$var_G2)
-    
-              
+    if(objFun == "L2"){
+      min <- log(sum((score0$acfG2[CovQuad>0]-CovQuad[CovQuad>0])^2))
+    }          
   idx.aaa<-match(loc.par,names_coef)           
   gradVect <- gradVect0[names_coef[-idx.aaa],]
   score <- c(score0$acfG2)%*%matrix(1,1,example$leng)
@@ -397,7 +399,7 @@
     fixedCon <- constdum(fixed, meas.par)
     lowerCon <- constdum(lower, meas.par)
     upperCon <- constdum(upper, meas.par)
-    if(aggr.G==TRUE){
+    if(aggregation==TRUE){
       if(floor(n/index(observ at zoo.data[[1]])[n])!=env$deltaData){
         yuima.stop("the n/Terminal in sampling information is not an integer. Aggregation=FALSE is recommended")
       }
@@ -416,7 +418,7 @@
                                   upper=upperCon[meas.par],
                                   measure=model at measure,
                                   measure.type=model at measure.type,
-                                  aggregation=aggr.G,
+                                  aggregation=aggregation,
                                   dt=1/env$deltaData
                               )   
     
@@ -596,7 +598,13 @@
  }
 
  if(env$objFun=="L2"){
-  res <- sum(log((TheoCovQuad[CovQuad>0]-CovQuad[CovQuad>0])^2))
+ #  res <- log(sum((TheoCovQuad[CovQuad>0]-CovQuad[CovQuad>0])^2))
+#    emp <- log(CovQuad[CovQuad>0])
+#    theo <- log(TheoCovQuad[CovQuad>0])
+   res <- sum((log(TheoCovQuad[CovQuad>0])-log(CovQuad[CovQuad>0]))^2)
+  # res <- sum((TheoCovQuad[CovQuad>0]-CovQuad[CovQuad>0])^2)
+ # res <- sum((log(abs(TheoCovQuad))-log(abs(CovQuad)))^2)
+  # res <- sum((log(TheoCovQuad[CovQuad>0]))-log(CovQuad[CovQuad>0]))^2)
   return(res)
  }
   
@@ -778,6 +786,12 @@
           }
 )
 
+# errorfun <- function(estimates, labelFun = "L2"){
+#   if(LabelFun == "L2"){
+#     
+#   }
+#     
+# }
 
 setMethod("show", "summary.cogarch.gmm",
           function (object)

Modified: pkg/yuima/man/gmm.rd
===================================================================
--- pkg/yuima/man/gmm.rd	2015-04-03 00:03:45 UTC (rev 372)
+++ pkg/yuima/man/gmm.rd	2015-04-19 10:23:08 UTC (rev 373)
@@ -15,7 +15,7 @@
 \usage{
 gmm(yuima, data = NULL, start, 
  method="BFGS", fixed = list(), lower, upper, lag.max = NULL, 
- aggr.G = TRUE, Est.Incr = "NoIncr", objFun = "L2")
+ aggr.G = TRUE, aggregation=TRUE, Est.Incr = "NoIncr", objFun = "L2")
 }
 %- maybe also 'usage' for other objects documented here.
 \arguments{
@@ -27,7 +27,8 @@
   \item{lower}{a named list for specifying lower bounds of parameters.}
   \item{upper}{a named list for specifying upper bounds of parameters.}
   \item{lag.max}{maximum lag at which to calculate the theoretical and empirical acf. Default is \code{sqrt{N}} where \code{N} is the number of observation.}
-  \item{aggr.G}{Logical variable. If \code{aggr.G = TRUE.}, the function use the increments of COGARCH(P,Q) evaluated at unitary length. If \code{aggr.G = FALSE}, the increments are evaluated on the interval with frequency specified in an object of class \code{\link{yuima.data-class}} that contains the observed time series.}
+  \item{aggr.G}{Logical variable. If \code{aggr.G = TRUE.}, the function use the returns of COGARCH(P,Q) evaluated at unitary length for the computation of the empirical autocorrelations. If \code{aggr.G = FALSE}, the increments are evaluated on the interval with frequency specified in an object of class \code{\link{yuima.data-class}} that contains the observed time series.}
+  \item{aggregation}{If \code{aggregation=TRUE}, before the estimation of the levy parameters we aggregate the estimated increments}
   \item{Est.Incr}{ a string variable, If \code{Est.Incr = "NoIncr"}, default value, \code{gmm} returns an object of class  \code{\link{cogarch.gmm-class}} that contains the COGARCH parameters. 
   If \code{Est.Incr = "Incr"} or \code{Est.Incr = "IncrPar"} the output is an object of class \code{\link{cogarch.gmm.incr-class}}. In the first case the object contains the increments of underlying noise while in the second case also the estimated parameter of levy measure.}
   \item{objFun}{a string variable that indentifies the objective function in the optimization step. \code{objFun = "L2"}, default value, the objective function is  a quadratic form where the weighting Matrix is the identity one. \code{objFun = "L2CUE"} the weighting matrix is estimated using Continuously Updating GMM (L2CUE). 
@@ -35,9 +36,9 @@
   
   }
 }
-%\details{
-%Please complete !!!
-%}
+\details{
+The routine is based on three steps: estimation of the COGARCH parameters, recovering the increments of the underlying Levy process and estimation of the levy measure parameters. The last two steps are available on request by the user. 
+}
 \value{ The function returns a list with the same components of the object obtained when the function  \code{\link{optim}} is used.
 }
 \references{



More information about the Yuima-commits mailing list