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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Oct 25 23:53:25 CEST 2016


Author: iacus
Date: 2016-10-25 23:53:25 +0200 (Tue, 25 Oct 2016)
New Revision: 489

Modified:
   pkg/yuima/R/yuima.data.R
   pkg/yuima/man/setData.Rd
Log:
fixed setData

Modified: pkg/yuima/R/yuima.data.R
===================================================================
--- pkg/yuima/R/yuima.data.R	2016-10-25 17:04:49 UTC (rev 488)
+++ pkg/yuima/R/yuima.data.R	2016-10-25 21:53:25 UTC (rev 489)
@@ -4,7 +4,7 @@
 
  
 setMethod("initialize", "yuima.data",
-           function(.Object, original.data, delta=NULL){
+           function(.Object, original.data, delta=NULL, t0=0){
              .Object at original.data <- original.data
              if(is.list(original.data) && is.zoo(original.data[[1]])) {
                .Object at zoo.data <- original.data
@@ -15,7 +15,7 @@
                  delta <- rep(delta, length(.Object at zoo.data))
                  for(i in 1:length(.Object at zoo.data)){
                     n <- length(.Object at zoo.data[[i]])
-                    t <- seq(0, delta[i]*n, length=n)
+                    t <- t0 + (0:(n-1))*delta[i]
                     index(.Object at zoo.data[[i]]) <- t
                  }
              }
@@ -46,8 +46,8 @@
 
 # accessors
 setData <-
-  function(original.data, delta=NULL){
-    return(new("yuima.data", original.data=original.data, delta=delta ))
+  function(original.data, delta=NULL, t0=0){
+    return(new("yuima.data", original.data=original.data, delta=delta, t0=t0 ))
   }
 
 

Modified: pkg/yuima/man/setData.Rd
===================================================================
--- pkg/yuima/man/setData.Rd	2016-10-25 17:04:49 UTC (rev 488)
+++ pkg/yuima/man/setData.Rd	2016-10-25 21:53:25 UTC (rev 489)
@@ -26,7 +26,7 @@
 \code{cbind.yuima} bind yuima.data object.
 }
 \usage{
-  setData(original.data, delta=NULL)
+  setData(original.data, delta=NULL, t0=0)
   get.zoo.data(x)
 }
 \arguments{  
@@ -36,6 +36,7 @@
   \item{x}{an object of type \code{\link{yuima.data-class}} or 
   \code{\link{yuima-class}}.}
   \item{delta}{If there is the need to redefine on the fly the \code{delta} increment of the data to make it consistent to statistical theory. See Details.}
+\item{t0}{the time origin for the internal \code{zoo.data} slot, defaults to 0.}
 }
 \details{
 Objects in the  \code{\link{yuima.data-class}} contain two slots:
@@ -84,5 +85,13 @@
 dim(mysde2)
 length(mysde2)
 
+# changing delta on the fly to 1/252 and shifting time to t0=1
+mysde2 <- setYuima(data=setData(X, delta=1/252, t0=1))
+str(get.zoo.data(mysde2))
+plot(mysde2)
+dim(mysde2)
+length(mysde2)
+
+
 }
 \keyword{ts}



More information about the Yuima-commits mailing list